Changeset 54701 in webkit for trunk/JavaScriptCore/runtime/SmallStrings.cpp
- Timestamp:
- Feb 11, 2010, 9:01:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/SmallStrings.cpp
r54574 r54701 35 35 static const unsigned numCharactersToStore = 0x100; 36 36 37 static inline bool isMarked(JSString* string) 38 { 39 return string && Heap::isCellMarked(string); 40 } 41 37 42 class SmallStringsStorage : public Noncopyable { 38 43 public: … … 67 72 void SmallStrings::markChildren(MarkStack& markStack) 68 73 { 74 /* 75 Our hypothesis is that small strings are very common. So, we cache them 76 to avoid GC churn. However, in cases where this hypothesis turns out to 77 be false -- including the degenerate case where all JavaScript execution 78 has terminated -- we don't want to waste memory. 79 80 To test our hypothesis, we check if any small string has been marked. If 81 so, it's probably reasonable to mark the rest. If not, we clear the cache. 82 */ 83 84 bool isAnyStringMarked = isMarked(m_emptyString); 85 for (unsigned i = 0; i < numCharactersToStore && !isAnyStringMarked; ++i) 86 isAnyStringMarked |= isMarked(m_singleCharacterStrings[i]); 87 88 if (!isAnyStringMarked) { 89 clear(); 90 return; 91 } 92 69 93 if (m_emptyString) 70 94 markStack.append(m_emptyString);
Note:
See TracChangeset
for help on using the changeset viewer.