Changeset 116822 in webkit
- Timestamp:
- May 11, 2012 4:50:02 PM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r116818 r116822 1 2012-05-11 Michael Saboff <msaboff@apple.com> 2 3 Rolling out r116659. 4 5 Causes ASSERT failures on bots. 6 7 Rubber stamped by Geoff Garen. 8 9 * heap/Heap.cpp: 10 (JSC::Heap::markRoots): 11 * heap/MarkStack.cpp: 12 (JSC::MarkStackThreadSharedData::markingThreadMain): 13 (JSC::MarkStackThreadSharedData::markingThreadStartFunc): 14 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData): 15 (JSC::MarkStackThreadSharedData::reset): 16 (JSC::MarkStack::reset): 17 (JSC): 18 (JSC::SlotVisitor::copyAndAppend): 19 * heap/MarkStack.h: 20 (MarkStackThreadSharedData): 21 (MarkStack): 22 * runtime/JSString.h: 23 (JSString): 24 (JSC::JSString::finishCreation): 25 (JSC::JSString::is8Bit): 26 (JSC::JSRopeString::finishCreation): 27 1 28 2012-05-11 Oliver Hunt <oliver@apple.com> 2 29 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r116659 r116822 657 657 visitor.reset(); 658 658 m_sharedData.reset(); 659 #if ENABLE(PARALLEL_GC)660 m_sharedData.resetChildren();661 #endif662 659 m_storageSpace.doneCopying(); 663 660 -
trunk/Source/JavaScriptCore/heap/MarkStack.cpp
r116785 r116822 37 37 #include "ScopeChain.h" 38 38 #include "Structure.h" 39 #include "UString.h"40 39 #include "WriteBarrier.h" 41 40 #include <wtf/MainThread.h> … … 220 219 221 220 #if ENABLE(PARALLEL_GC) 222 void MarkStackThreadSharedData::resetChildren() 223 { 224 for (unsigned i = 0; i < m_slaveMarkStacks.size(); ++i) 225 m_slaveMarkStacks[i]->reset(); 226 } 227 228 void MarkStackThreadSharedData::markingThreadMain(SlotVisitor* slotVisitor) 221 void MarkStackThreadSharedData::markingThreadMain() 229 222 { 230 223 WTF::registerGCThread(); 231 224 { 232 ParallelModeEnabler enabler(*slotVisitor); 233 slotVisitor->drainFromShared(SlotVisitor::SlaveDrain); 234 } 235 delete slotVisitor; 236 } 237 238 void MarkStackThreadSharedData::markingThreadStartFunc(void* myVisitor) 239 { 240 SlotVisitor* slotVisitor = static_cast<SlotVisitor*>(myVisitor); 241 slotVisitor->sharedData().markingThreadMain(slotVisitor); 225 SlotVisitor slotVisitor(*this); 226 ParallelModeEnabler enabler(slotVisitor); 227 slotVisitor.drainFromShared(SlotVisitor::SlaveDrain); 228 } 229 } 230 231 void MarkStackThreadSharedData::markingThreadStartFunc(void* shared) 232 { 233 static_cast<MarkStackThreadSharedData*>(shared)->markingThreadMain(); 242 234 } 243 235 #endif … … 252 244 #if ENABLE(PARALLEL_GC) 253 245 for (unsigned i = 1; i < Options::numberOfGCMarkers; ++i) { 254 SlotVisitor* slotVisitor = new SlotVisitor(*this); 255 m_slaveMarkStacks.append(slotVisitor); 256 m_markingThreads.append(createThread(markingThreadStartFunc, slotVisitor, "JavaScriptCore::Marking")); 246 m_markingThreads.append(createThread(markingThreadStartFunc, this, "JavaScriptCore::Marking")); 257 247 ASSERT(m_markingThreads.last()); 258 248 } … … 286 276 ASSERT(m_opaqueRoots.isEmpty()); 287 277 #endif 278 288 279 m_weakReferenceHarvesters.removeAll(); 289 280 } … … 298 289 m_opaqueRoots.clear(); 299 290 #endif 300 m_uniqueStrings.clear();301 291 } 302 292 … … 499 489 } 500 490 501 inline void MarkStack::internalAppend(JSValue* slot)502 {503 ASSERT(slot);504 JSValue value = *slot;505 ASSERT(value);506 if (!value.isCell())507 return;508 509 if (value.isString()) {510 JSString* string = jsCast<JSString*>(value.asCell());511 if (!string->isHashConstSingleton() && string->length() > 1 && !string->isRope()) {512 UniqueStringMap::AddResult addResult = m_uniqueStrings.add(string->string().impl(), value);513 if (addResult.isNewEntry)514 string->setHashConstSingleton();515 else {516 JSValue existingJSValue = addResult.iterator->second;517 if (value != existingJSValue)518 jsCast<JSString*>(existingJSValue.asCell())->clearHashConstSingleton();519 *slot = existingJSValue;520 return;521 }522 }523 }524 525 internalAppend(value.asCell());526 }527 528 529 491 void SlotVisitor::copyAndAppend(void** ptr, size_t bytes, JSValue* values, unsigned length) 530 492 { … … 540 502 if (!value) 541 503 continue; 542 internalAppend( &newValues[i]);504 internalAppend(value); 543 505 } 544 506 -
trunk/Source/JavaScriptCore/heap/MarkStack.h
r116659 r116822 35 35 #include "VTableSpectrum.h" 36 36 #include "WeakReferenceHarvester.h" 37 #include <wtf/Forward.h>38 37 #include <wtf/HashMap.h> 39 38 #include <wtf/HashSet.h> … … 42 41 #include <wtf/OSAllocator.h> 43 42 #include <wtf/PageBlock.h> 44 #include <wtf/text/StringHash.h>45 43 46 44 namespace JSC { … … 174 172 175 173 void reset(); 176 177 #if ENABLE(PARALLEL_GC) 178 void resetChildren(); 179 #endif 180 174 181 175 private: 182 176 friend class MarkStack; … … 184 178 185 179 #if ENABLE(PARALLEL_GC) 186 void markingThreadMain( SlotVisitor*);180 void markingThreadMain(); 187 181 static void markingThreadStartFunc(void* heap); 188 182 #endif … … 194 188 195 189 Vector<ThreadIdentifier> m_markingThreads; 196 Vector<MarkStack*> m_slaveMarkStacks;197 190 198 191 Mutex m_markingLock; … … 229 222 bool containsOpaqueRoot(void*); 230 223 int opaqueRootCount(); 231 232 MarkStackThreadSharedData& sharedData() { return m_shared; } 224 233 225 bool isEmpty() { return m_stack.isEmpty(); } 234 226 … … 236 228 237 229 size_t visitCount() const { return m_visitCount; } 238 230 239 231 #if ENABLE(SIMPLE_HEAP_PROFILING) 240 232 VTableSpectrum m_visitedTypeCounts; … … 260 252 void internalAppend(JSCell*); 261 253 void internalAppend(JSValue); 262 void internalAppend(JSValue*);263 254 264 255 JS_EXPORT_PRIVATE void mergeOpaqueRoots(); … … 280 271 MarkStackArray m_stack; 281 272 HashSet<void*> m_opaqueRoots; // Handle-owning data structures not visible to the garbage collector. 282 typedef HashMap<StringImpl*, JSValue> UniqueStringMap;283 UniqueStringMap m_uniqueStrings;284 273 285 274 #if !ASSERT_DISABLED -
trunk/Source/JavaScriptCore/runtime/JSString.h
r116659 r116822 68 68 friend class SpecializedThunkJIT; 69 69 friend class JSRopeString; 70 friend class MarkStack;71 70 friend struct ThunkHelpers; 72 71 … … 93 92 m_length = length; 94 93 m_is8Bit = m_value.impl()->is8Bit(); 95 m_isHashConstSingleton = false;96 94 } 97 95 … … 102 100 m_length = length; 103 101 m_is8Bit = m_value.impl()->is8Bit(); 104 m_isHashConstSingleton = false;105 102 Heap::heap(this)->reportExtraMemoryCost(cost); 106 103 } … … 112 109 m_length = 0; 113 110 m_is8Bit = true; 114 m_isHashConstSingleton = false;115 111 } 116 112 … … 166 162 bool isRope() const { return m_value.isNull(); } 167 163 bool is8Bit() const { return m_is8Bit; } 168 bool isHashConstSingleton() const { return m_isHashConstSingleton; }169 void clearHashConstSingleton() { m_isHashConstSingleton = false; }170 void setHashConstSingleton() { m_isHashConstSingleton = true; }171 164 172 165 // A string is represented either by a UString or a rope of fibers. 173 166 bool m_is8Bit : 1; 174 bool m_isHashConstSingleton : 1;175 167 unsigned m_length; 176 168 mutable UString m_value; … … 242 234 m_length = s1->length() + s2->length(); 243 235 m_is8Bit = (s1->is8Bit() && s2->is8Bit()); 244 m_isHashConstSingleton = false;245 236 m_fibers[0].set(globalData, this, s1); 246 237 m_fibers[1].set(globalData, this, s2); … … 252 243 m_length = s1->length() + s2->length() + s3->length(); 253 244 m_is8Bit = (s1->is8Bit() && s2->is8Bit() && s3->is8Bit()); 254 m_isHashConstSingleton = false;255 245 m_fibers[0].set(globalData, this, s1); 256 246 m_fibers[1].set(globalData, this, s2);
Note: See TracChangeset
for help on using the changeset viewer.