No need to keep setting needsVisit flag in SmallStrings
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 23:17:59 +0000 (23:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Oct 2015 23:17:59 +0000 (23:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149961

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-10-09
Reviewed by Andreas Kling.

SmallStrings are all initialized at once privately before the VM
enables Garbage Collection. There is no need to keep updating
this flag, as it couldn't have changed.

* runtime/SmallStrings.cpp:
(JSC::SmallStrings::createEmptyString):
(JSC::SmallStrings::createSingleCharacterString):
(JSC::SmallStrings::initialize):
* runtime/SmallStrings.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190829 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/SmallStrings.cpp
Source/JavaScriptCore/runtime/SmallStrings.h

index b9461f8fb5967735ed0e3b51349e576751d165de..3ac65ad5dee4eac6f092c66fff642e27becb56b2 100644 (file)
@@ -1,3 +1,20 @@
+2015-10-09  Joseph Pecoraro  <pecoraro@apple.com>
+
+        No need to keep setting needsVisit flag in SmallStrings
+        https://bugs.webkit.org/show_bug.cgi?id=149961
+
+        Reviewed by Andreas Kling.
+
+        SmallStrings are all initialized at once privately before the VM
+        enables Garbage Collection. There is no need to keep updating
+        this flag, as it couldn't have changed.
+
+        * runtime/SmallStrings.cpp:
+        (JSC::SmallStrings::createEmptyString):
+        (JSC::SmallStrings::createSingleCharacterString):
+        (JSC::SmallStrings::initialize):
+        * runtime/SmallStrings.h:
+
 2015-10-09  Geoffrey Garen  <ggaren@apple.com>
 
         Unreviewed, rolling back in r190694
index 9c6a43ae2138f4eefeba6e1d02bc2ead19e4de51..76316b7fe6e9dab755794408d36de2c8feea8ab1 100644 (file)
@@ -109,7 +109,7 @@ void SmallStrings::createEmptyString(VM* vm)
 {
     ASSERT(!m_emptyString);
     m_emptyString = JSString::createHasOtherOwner(*vm, StringImpl::empty());
-    m_needsToBeVisited = true;
+    ASSERT(m_needsToBeVisited);
 }
 
 void SmallStrings::createSingleCharacterString(VM* vm, unsigned char character)
@@ -118,7 +118,7 @@ void SmallStrings::createSingleCharacterString(VM* vm, unsigned char character)
         m_storage = std::make_unique<SmallStringsStorage>();
     ASSERT(!m_singleCharacterStrings[character]);
     m_singleCharacterStrings[character] = JSString::createHasOtherOwner(*vm, PassRefPtr<StringImpl>(m_storage->rep(character)));
-    m_needsToBeVisited = true;
+    ASSERT(m_needsToBeVisited);
 }
 
 StringImpl* SmallStrings::singleCharacterStringRep(unsigned char character)
@@ -131,7 +131,7 @@ StringImpl* SmallStrings::singleCharacterStringRep(unsigned char character)
 void SmallStrings::initialize(VM* vm, JSString*& string, const char* value)
 {
     string = JSString::create(*vm, Identifier::fromString(vm, value).impl());
-    m_needsToBeVisited = true;
+    ASSERT(m_needsToBeVisited);
 }
 
 } // namespace JSC
index 909bae1dea90e820563620ef309891ba21722dfd..74f6e28792dd034a8cb1236f595ac839b5ff29f0 100644 (file)
@@ -48,7 +48,6 @@ class StringImpl;
 
 namespace JSC {
 
-class HeapRootVisitor;
 class VM;
 class JSString;
 class SmallStringsStorage;
@@ -123,8 +122,8 @@ public:
 private:
     static const unsigned singleCharacterStringCount = maxSingleCharacterString + 1;
 
-    JS_EXPORT_PRIVATE void createEmptyString(VM*);
-    JS_EXPORT_PRIVATE void createSingleCharacterString(VM*, unsigned char);
+    void createEmptyString(VM*);
+    void createSingleCharacterString(VM*, unsigned char);
 
     void initialize(VM*, JSString*&, const char* value);