Changeset 248143 in webkit
- Timestamp:
- Aug 1, 2019, 6:58:11 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r248133 r248143 1 2019-08-01 Mark Lam <mark.lam@apple.com> 2 3 Add crash diagnostics for debugging unexpected zapped cells. 4 https://bugs.webkit.org/show_bug.cgi?id=200149 5 <rdar://problem/53570112> 6 7 Reviewed by Yusuke Suzuki. 8 9 Add a check for zapped cells in SlotVisitor::appendToMarkStack() and 10 SlotVisitor::visitChildren(). If a zapped cell is detected, we will crash with 11 some diagnostic info. 12 13 To facilitate this, we've made the following changes: 14 1. Changed FreeCell to preserve the 1st 8 bytes. This is fine to do because all 15 cells are at least 16 bytes long. 16 2. Changed HeapCell::zap() to only zap the structureID. Leave the rest of the 17 cell header info intact (including the cell JSType). 18 3. Changed HeapCell::zap() to record the reason for zapping the cell. We stash 19 the reason immediately after the first 8 bytes. This is the same location as 20 FreeCell::scrambledNext. However, since a cell is not expected to be zapped 21 and on the free list at the same time, it is also fine to do this. 22 4. Added a few utility functions to MarkedBlock for checking if a cell points 23 into the block. 24 5. Added VMInspector and JSDollarVM utilities to dump in-use subspace hashes. 25 6. Added some comments to document the hashes of known subspaces. 26 7. Added Options::dumpZappedCellCrashData() to make this check conditional. 27 We use this option to disable this check for slower machines so that their 28 PLT5 performance is not impacted. 29 30 * assembler/CPU.cpp: 31 (JSC::hwL3CacheSize): 32 (JSC::hwPhysicalCPUMax): 33 * assembler/CPU.h: 34 (JSC::hwL3CacheSize): 35 (JSC::hwPhysicalCPUMax): 36 * heap/FreeList.h: 37 (JSC::FreeCell::offsetOfScrambledNext): 38 * heap/HeapCell.h: 39 (JSC::HeapCell::zap): 40 (JSC::HeapCell::isZapped const): 41 * heap/MarkedBlock.cpp: 42 (JSC::MarkedBlock::Handle::stopAllocating): 43 * heap/MarkedBlock.h: 44 (JSC::MarkedBlock::Handle::start const): 45 (JSC::MarkedBlock::Handle::end const): 46 (JSC::MarkedBlock::Handle::contains const): 47 * heap/MarkedBlockInlines.h: 48 (JSC::MarkedBlock::Handle::specializedSweep): 49 * heap/MarkedSpace.h: 50 (JSC::MarkedSpace::forEachSubspace): 51 * heap/SlotVisitor.cpp: 52 (JSC::SlotVisitor::appendToMarkStack): 53 (JSC::SlotVisitor::visitChildren): 54 (JSC::SlotVisitor::reportZappedCellAndCrash): 55 * heap/SlotVisitor.h: 56 * jit/AssemblyHelpers.cpp: 57 (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): 58 * runtime/Options.cpp: 59 (JSC::Options::initialize): 60 * runtime/Options.h: 61 * runtime/VM.cpp: 62 (JSC::VM::VM): 63 * tools/JSDollarVM.cpp: 64 (JSC::functionDumpSubspaceHashes): 65 (JSC::JSDollarVM::finishCreation): 66 * tools/VMInspector.cpp: 67 (JSC::VMInspector::dumpSubspaceHashes): 68 * tools/VMInspector.h: 69 1 70 2019-08-01 Keith Miller <keith_miller@apple.com> 2 71 -
trunk/Source/JavaScriptCore/assembler/CPU.cpp
r244237 r248143 67 67 return result; 68 68 } 69 70 int64_t hwL3CacheSize() 71 { 72 int64_t val = 0; 73 size_t valSize = sizeof(val); 74 int rc = sysctlbyname("hw.l3cachesize", &val, &valSize, nullptr, 0); 75 if (rc < 0) 76 return 0; 77 return val; 78 } 79 80 int32_t hwPhysicalCPUMax() 81 { 82 int64_t val = 0; 83 size_t valSize = sizeof(val); 84 int rc = sysctlbyname("hw.physicalcpu_max", &val, &valSize, nullptr, 0); 85 if (rc < 0) 86 return 0; 87 return val; 88 } 89 69 90 #endif // #if (CPU(X86) || CPU(X86_64)) && OS(DARWIN) 70 91 -
trunk/Source/JavaScriptCore/assembler/CPU.h
r246368 r248143 1 1 /* 2 * Copyright (C) 2008-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 146 146 bool enableKernTCSM(); 147 147 int kernTCSMAwareNumberOfProcessorCores(); 148 int64_t hwL3CacheSize(); 149 int32_t hwPhysicalCPUMax(); 148 150 #else 149 151 ALWAYS_INLINE bool isKernTCSMAvailable() { return false; } 150 152 ALWAYS_INLINE bool enableKernTCSM() { return false; } 151 153 ALWAYS_INLINE int kernTCSMAwareNumberOfProcessorCores() { return WTF::numberOfProcessorCores(); } 154 ALWAYS_INLINE int64_t hwL3CacheSize() { return 0; } 155 ALWAYS_INLINE int32_t hwPhysicalCPUMax() { return kernTCSMAwareNumberOfProcessorCores(); } 152 156 #endif 153 157 -
trunk/Source/JavaScriptCore/heap/FreeList.h
r247900 r248143 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 54 54 } 55 55 56 static ptrdiff_t offsetOfScrambledNext() { return OBJECT_OFFSETOF(FreeCell, scrambledNext); } 57 58 uint64_t preservedBitsForCrashAnalysis; 56 59 uintptr_t scrambledNext; 57 60 }; -
trunk/Source/JavaScriptCore/heap/HeapCell.h
r247900 r248143 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 48 48 HeapCell() { } 49 49 50 void zap() { *reinterpret_cast_ptr<uintptr_t**>(this) = 0; } 51 bool isZapped() const { return !*reinterpret_cast_ptr<uintptr_t* const*>(this); } 50 // We're intentionally only zapping the bits for the structureID and leaving 51 // the rest of the cell header bits intact for crash analysis uses. 52 enum ZapReason : int8_t { Unspecified, Destruction, StopAllocating }; 53 void zap(ZapReason reason) 54 { 55 uint32_t* cellWords = bitwise_cast<uint32_t*>(this); 56 cellWords[0] = 0; 57 // Leaving cellWords[1] alone for crash analysis if needed. 58 cellWords[2] = reason; 59 } 60 bool isZapped() const { return !*bitwise_cast<const uint32_t*>(this); } 52 61 53 62 bool isLive(); -
trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp
r247900 r248143 162 162 dataLog("Free cell: ", RawPointer(cell), "\n"); 163 163 if (m_attributes.destruction == NeedsDestruction) 164 cell->zap( );164 cell->zap(HeapCell::StopAllocating); 165 165 block().clearNewlyAllocated(cell); 166 166 }); -
trunk/Source/JavaScriptCore/heap/MarkedBlock.h
r247900 r248143 199 199 void didRemoveFromDirectory(); 200 200 201 void* start() const { return &m_block->atoms()[0]; } 202 void* end() const { return &m_block->atoms()[m_endAtom]; } 203 bool contains(void* p) const { return start() <= p && p < end(); } 204 201 205 void dumpState(PrintStream&); 202 206 -
trunk/Source/JavaScriptCore/heap/MarkedBlockInlines.h
r247900 r248143 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 259 259 if (!jsCell->isZapped()) { 260 260 destroyFunc(vm, jsCell); 261 jsCell->zap( );261 jsCell->zap(HeapCell::Destruction); 262 262 } 263 263 }; -
trunk/Source/JavaScriptCore/heap/MarkedSpace.h
r247900 r248143 125 125 template<typename Functor> void forEachDeadCell(HeapIterationScope&, const Functor&); 126 126 template<typename Functor> void forEachBlock(const Functor&); 127 template<typename Functor> void forEachSubspace(const Functor&); 127 128 128 129 void shrink(); … … 241 242 } 242 243 244 template<typename Functor> 245 void MarkedSpace::forEachSubspace(const Functor& functor) 246 { 247 for (auto subspace : m_subspaces) { 248 if (functor(*subspace) == IterationStatus::Done) 249 return; 250 } 251 } 252 253 243 254 ALWAYS_INLINE size_t MarkedSpace::optimalSizeFor(size_t bytes) 244 255 { -
trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp
r247900 r248143 287 287 { 288 288 ASSERT(m_heap.isMarked(cell)); 289 #if CPU(X86_64) 290 if (Options::dumpZappedCellCrashData()) { 291 if (UNLIKELY(cell->isZapped())) 292 reportZappedCellAndCrash(cell); 293 } 294 #endif 289 295 ASSERT(!cell->isZapped()); 290 296 291 297 container.noteMarked(); 292 298 … … 386 392 // FIXME: This could be so much better. 387 393 // https://bugs.webkit.org/show_bug.cgi?id=162462 394 #if CPU(X86_64) 395 if (Options::dumpZappedCellCrashData()) { 396 Structure* structure = cell->structure(vm()); 397 if (LIKELY(structure)) { 398 const MethodTable* methodTable = &structure->classInfo()->methodTable; 399 methodTable->visitChildren(const_cast<JSCell*>(cell), *this); 400 break; 401 } 402 reportZappedCellAndCrash(const_cast<JSCell*>(cell)); 403 } 404 #endif 388 405 cell->methodTable(vm())->visitChildren(const_cast<JSCell*>(cell), *this); 389 406 break; … … 805 822 } 806 823 824 #if CPU(X86_64) 825 NEVER_INLINE NO_RETURN_DUE_TO_CRASH NOT_TAIL_CALLED void SlotVisitor::reportZappedCellAndCrash(JSCell* cell) 826 { 827 MarkedBlock::Handle* foundBlock = nullptr; 828 uint32_t* cellWords = reinterpret_cast_ptr<uint32_t*>(this); 829 830 uintptr_t cellAddress = bitwise_cast<uintptr_t>(cell); 831 uintptr_t headerWord = cellWords[1]; 832 uintptr_t zapReason = cellWords[2]; 833 unsigned subspaceHash = 0; 834 size_t cellSize = 0; 835 836 m_heap.objectSpace().forEachBlock([&] (MarkedBlock::Handle* block) { 837 if (block->contains(cell)) { 838 foundBlock = block; 839 return IterationStatus::Done; 840 } 841 return IterationStatus::Continue; 842 }); 843 844 if (foundBlock) { 845 subspaceHash = StringHasher::computeHash(foundBlock->subspace()->name()); 846 cellSize = foundBlock->cellSize(); 847 } 848 849 CRASH_WITH_INFO(cellAddress, headerWord, zapReason, subspaceHash, cellSize); 850 } 851 #endif // PLATFORM(MAC) 852 807 853 } // namespace JSC -
trunk/Source/JavaScriptCore/heap/SlotVisitor.h
r247925 r248143 228 228 bool didReachTermination(const AbstractLocker&); 229 229 230 #if CPU(X86_64) 231 NEVER_INLINE NO_RETURN_DUE_TO_CRASH NOT_TAIL_CALLED void reportZappedCellAndCrash(JSCell*); 232 #endif 233 230 234 template<typename Func> 231 235 IterationStatus forEachMarkStack(const Func&); -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp
r247900 r248143 547 547 // The object is half-allocated: we have what we know is a fresh object, but 548 548 // it's still on the GC's free list. 549 loadPtr(Address(resultGPR ), scratchGPR);549 loadPtr(Address(resultGPR, FreeCell::offsetOfScrambledNext()), scratchGPR); 550 550 storePtr(scratchGPR, Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfScrambledHead())); 551 551 -
trunk/Source/JavaScriptCore/runtime/Options.cpp
r247543 r248143 604 604 } 605 605 } 606 #endif 607 608 #if CPU(X86_64) && OS(DARWIN) 609 Options::dumpZappedCellCrashData() = 610 (hwPhysicalCPUMax() >= 4) && (hwL3CacheSize() >= static_cast<int64_t>(6 * MB)); 606 611 #endif 607 612 }); -
trunk/Source/JavaScriptCore/runtime/Options.h
r247925 r248143 242 242 v(bool, stealEmptyBlocksFromOtherAllocators, true, Normal, nullptr) \ 243 243 v(bool, eagerlyUpdateTopCallFrame, false, Normal, nullptr) \ 244 v(bool, dumpZappedCellCrashData, false, Normal, nullptr) \ 244 245 \ 245 246 v(bool, useOSREntryToDFG, true, Normal, nullptr) \ -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r247900 r248143 266 266 , webAssemblyFunctionHeapCellType(std::make_unique<WebAssemblyFunctionHeapCellType>()) 267 267 #endif 268 , primitiveGigacageAuxiliarySpace("Primitive Gigacage Auxiliary", heap, auxiliaryHeapCellType.get(), primitiveGigacageAllocator.get()) 269 , jsValueGigacageAuxiliarySpace("JSValue Gigacage Auxiliary", heap, auxiliaryHeapCellType.get(), jsValueGigacageAllocator.get()) 270 , immutableButterflyJSValueGigacageAuxiliarySpace("ImmutableButterfly Gigacage JSCellWithInteriorPointers", heap, immutableButterflyHeapCellType.get(), jsValueGigacageAllocator.get()) 271 , cellSpace("JSCell", heap, cellHeapCellType.get(), fastMallocAllocator.get()) 272 , jsValueGigacageCellSpace("JSValue Gigacage JSCell", heap, cellHeapCellType.get(), jsValueGigacageAllocator.get()) 273 , destructibleCellSpace("Destructible JSCell", heap, destructibleCellHeapCellType.get(), fastMallocAllocator.get()) 274 , stringSpace("JSString", heap, stringHeapCellType.get(), fastMallocAllocator.get()) 275 , destructibleObjectSpace("JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) 276 , eagerlySweptDestructibleObjectSpace("Eagerly Swept JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) 277 , executableToCodeBlockEdgeSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), ExecutableToCodeBlockEdge) 278 , functionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSFunction) 279 , internalFunctionSpace ISO_SUBSPACE_INIT(heap, destructibleObjectHeapCellType.get(), InternalFunction) 280 , nativeExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), NativeExecutable) 281 , propertyTableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), PropertyTable) 282 , structureRareDataSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), StructureRareData) 283 , structureSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), Structure) 284 , symbolTableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), SymbolTable) 268 , primitiveGigacageAuxiliarySpace("Primitive Gigacage Auxiliary", heap, auxiliaryHeapCellType.get(), primitiveGigacageAllocator.get()) // Hash:0x3e7cd762 269 , jsValueGigacageAuxiliarySpace("JSValue Gigacage Auxiliary", heap, auxiliaryHeapCellType.get(), jsValueGigacageAllocator.get()) // Hash:0x241e946 270 , immutableButterflyJSValueGigacageAuxiliarySpace("ImmutableButterfly Gigacage JSCellWithInteriorPointers", heap, immutableButterflyHeapCellType.get(), jsValueGigacageAllocator.get()) // Hash:0x7a945300 271 , cellSpace("JSCell", heap, cellHeapCellType.get(), fastMallocAllocator.get()) // Hash:0xadfb5a79 272 , jsValueGigacageCellSpace("JSValue Gigacage JSCell", heap, cellHeapCellType.get(), jsValueGigacageAllocator.get()) // Hash:0x2f5b102b 273 , destructibleCellSpace("Destructible JSCell", heap, destructibleCellHeapCellType.get(), fastMallocAllocator.get()) // Hash:0xbfff3d73 274 , stringSpace("JSString", heap, stringHeapCellType.get(), fastMallocAllocator.get()) // Hash:0x90cf758f 275 , destructibleObjectSpace("JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) // Hash:0x4f5ed7a9 276 , eagerlySweptDestructibleObjectSpace("Eagerly Swept JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) // Hash:0x6ebf28e2 277 , executableToCodeBlockEdgeSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), ExecutableToCodeBlockEdge) // Hash:0x7b730b20 278 , functionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSFunction) // Hash:0x800fca72 279 , internalFunctionSpace ISO_SUBSPACE_INIT(heap, destructibleObjectHeapCellType.get(), InternalFunction) // Hash:0xf845c464 280 , nativeExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), NativeExecutable) // Hash:0x67567f95 281 , propertyTableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), PropertyTable) // Hash:0xc6bc9f12 282 , structureRareDataSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), StructureRareData) // Hash:0xaca4e62d 283 , structureSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), Structure) // Hash:0x1f1bcdca 284 , symbolTableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), SymbolTable) // Hash:0xc5215afd 285 285 , executableToCodeBlockEdgesWithConstraints(executableToCodeBlockEdgeSpace) 286 286 , executableToCodeBlockEdgesWithFinalizers(executableToCodeBlockEdgeSpace) 287 , codeBlockSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), CodeBlock) 288 , functionExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), FunctionExecutable) 289 , programExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), ProgramExecutable) 290 , unlinkedFunctionExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), UnlinkedFunctionExecutable) 287 , codeBlockSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), CodeBlock) // Hash:0x77e66ec9 288 , functionExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), FunctionExecutable) // Hash:0x5d158f3 289 , programExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), ProgramExecutable) // Hash:0x527c77e7 290 , unlinkedFunctionExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), UnlinkedFunctionExecutable) // Hash:0xf6b828d9 291 291 , vmType(vmType) 292 292 , clientData(0) … … 1244 1244 1245 1245 1246 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(boundFunctionSpace, cellHeapCellType.get(), JSBoundFunction) 1247 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(callbackFunctionSpace, destructibleObjectHeapCellType.get(), JSCallbackFunction) 1248 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(customGetterSetterFunctionSpace, cellHeapCellType.get(), JSCustomGetterSetterFunction) 1249 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(errorInstanceSpace, destructibleObjectHeapCellType.get(), ErrorInstance) 1250 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(nativeStdFunctionSpace, cellHeapCellType.get(), JSNativeStdFunction) 1251 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(proxyRevokeSpace, destructibleObjectHeapCellType.get(), ProxyRevoke) 1252 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(weakMapSpace, destructibleObjectHeapCellType.get(), JSWeakMap) 1253 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(weakSetSpace, destructibleObjectHeapCellType.get(), JSWeakSet) 1254 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(weakObjectRefSpace, cellHeapCellType.get(), JSWeakObjectRef) 1246 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(boundFunctionSpace, cellHeapCellType.get(), JSBoundFunction) // Hash:0xd7916d41 1247 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(callbackFunctionSpace, destructibleObjectHeapCellType.get(), JSCallbackFunction) // Hash:0xe7648ebc 1248 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(customGetterSetterFunctionSpace, cellHeapCellType.get(), JSCustomGetterSetterFunction) // Hash:0x18091000 1249 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(errorInstanceSpace, destructibleObjectHeapCellType.get(), ErrorInstance) // Hash:0x3f40d4a 1250 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(nativeStdFunctionSpace, cellHeapCellType.get(), JSNativeStdFunction) // Hash:0x70ed61e4 1251 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(proxyRevokeSpace, destructibleObjectHeapCellType.get(), ProxyRevoke) // Hash:0xb506a939 1252 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(weakMapSpace, destructibleObjectHeapCellType.get(), JSWeakMap) // Hash:0x662b12a3 1253 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(weakSetSpace, destructibleObjectHeapCellType.get(), JSWeakSet) // Hash:0x4c781b30 1254 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(weakObjectRefSpace, cellHeapCellType.get(), JSWeakObjectRef) // Hash:0x8ec68f1f 1255 1255 #if JSC_OBJC_API_ENABLED 1256 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(objCCallbackFunctionSpace, destructibleObjectHeapCellType.get(), ObjCCallbackFunction) 1256 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(objCCallbackFunctionSpace, destructibleObjectHeapCellType.get(), ObjCCallbackFunction) // Hash:0x10f610b8 1257 1257 #endif 1258 1258 #if ENABLE(WEBASSEMBLY) 1259 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyCodeBlockSpace, webAssemblyCodeBlockHeapCellType.get(), JSWebAssemblyCodeBlock) 1260 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyFunctionSpace, webAssemblyFunctionHeapCellType.get(), WebAssemblyFunction) 1261 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyWrapperFunctionSpace, cellHeapCellType.get(), WebAssemblyWrapperFunction) 1259 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyCodeBlockSpace, webAssemblyCodeBlockHeapCellType.get(), JSWebAssemblyCodeBlock) // Hash:0x9ad995cd 1260 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyFunctionSpace, webAssemblyFunctionHeapCellType.get(), WebAssemblyFunction) // Hash:0x8b7c32db 1261 DYNAMIC_ISO_SUBSPACE_DEFINE_MEMBER_SLOW(webAssemblyWrapperFunctionSpace, cellHeapCellType.get(), WebAssemblyWrapperFunction) // Hash:0xd4a5ff01 1262 1262 #endif 1263 1263 … … 1274 1274 } 1275 1275 1276 DYNAMIC_SPACE_AND_SET_DEFINE_MEMBER_SLOW(evalExecutableSpace, destructibleCellHeapCellType.get(), EvalExecutable) 1277 DYNAMIC_SPACE_AND_SET_DEFINE_MEMBER_SLOW(moduleProgramExecutableSpace, destructibleCellHeapCellType.get(), ModuleProgramExecutable) 1276 DYNAMIC_SPACE_AND_SET_DEFINE_MEMBER_SLOW(evalExecutableSpace, destructibleCellHeapCellType.get(), EvalExecutable) // Hash:0x958e3e9d 1277 DYNAMIC_SPACE_AND_SET_DEFINE_MEMBER_SLOW(moduleProgramExecutableSpace, destructibleCellHeapCellType.get(), ModuleProgramExecutable) // Hash:0x6506fa3c 1278 1278 1279 1279 #undef DYNAMIC_SPACE_AND_SET_DEFINE_MEMBER_SLOW -
trunk/Source/JavaScriptCore/tools/JSDollarVM.cpp
r248105 r248143 1395 1395 } 1396 1396 1397 // Dumps the hashes of all subspaces currently registered with the VM. 1398 // Usage: $vm.dumpSubspaceHashes() 1399 static EncodedJSValue JSC_HOST_CALL functionDumpSubspaceHashes(ExecState* exec) 1400 { 1401 VM& vm = exec->vm(); 1402 VMInspector::dumpSubspaceHashes(&vm); 1403 return JSValue::encode(jsUndefined()); 1404 } 1405 1397 1406 // Gets a JSDollarVMCallFrame for a specified frame index. 1398 1407 // Usage: var callFrame = $vm.callFrame(0) // frame 0 is the top frame. … … 2226 2235 addFunction(vm, "gc", functionGC, 0); 2227 2236 addFunction(vm, "edenGC", functionEdenGC, 0); 2237 addFunction(vm, "dumpSubspaceHashes", functionDumpSubspaceHashes, 0); 2228 2238 2229 2239 addFunction(vm, "callFrame", functionCallFrame, 1); -
trunk/Source/JavaScriptCore/tools/VMInspector.cpp
r247900 r248143 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 627 627 } 628 628 629 void VMInspector::dumpSubspaceHashes(VM* vm) 630 { 631 unsigned count = 0; 632 vm->heap.objectSpace().forEachSubspace([&] (const Subspace& subspace) -> IterationStatus { 633 const char* name = subspace.name(); 634 unsigned hash = StringHasher::computeHash(name); 635 void* hashAsPtr = reinterpret_cast<void*>(static_cast<uintptr_t>(hash)); 636 dataLogLn(" [", count++, "] ", name, " Hash:", RawPointer(hashAsPtr)); 637 return IterationStatus::Continue; 638 }); 639 dataLogLn(); 640 } 641 629 642 } // namespace JSC -
trunk/Source/JavaScriptCore/tools/VMInspector.h
r247900 r248143 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 79 79 JS_EXPORT_PRIVATE static void dumpCellMemory(JSCell*); 80 80 JS_EXPORT_PRIVATE static void dumpCellMemoryToStream(JSCell*, PrintStream&); 81 JS_EXPORT_PRIVATE static void dumpSubspaceHashes(VM*); 81 82 82 83 private: -
trunk/Source/WebCore/ChangeLog
r248141 r248143 1 2019-08-01 Mark Lam <mark.lam@apple.com> 2 3 Add crash diagnostics for debugging unexpected zapped cells. 4 https://bugs.webkit.org/show_bug.cgi?id=200149 5 <rdar://problem/53570112> 6 7 Reviewed by Yusuke Suzuki. 8 9 No new tests because this is a feature for debugging crashes. It has been tested 10 manually by modifying the code to force a crash at the point of interest. 11 12 Added some comments to document the hashes of known subspaces. 13 14 * bindings/js/WebCoreJSClientData.cpp: 15 (WebCore::JSVMClientData::JSVMClientData): 16 1 17 2019-08-01 Saam Barati <sbarati@apple.com> 2 18 -
trunk/Source/WebCore/bindings/js/WebCoreJSClientData.cpp
r247900 r248143 44 44 : m_builtinFunctions(vm) 45 45 , m_builtinNames(&vm) 46 , m_runtimeMethodSpace ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), RuntimeMethod) 47 , m_outputConstraintSpace("WebCore Wrapper w/ Output Constraint", vm.heap, vm.destructibleObjectHeapCellType.get(), vm.fastMallocAllocator.get()) 48 , m_globalObjectOutputConstraintSpace("WebCore Global Object w/ Output Constraint", vm.heap, vm.cellHeapCellType.get(), vm.fastMallocAllocator.get()) 46 , m_runtimeMethodSpace ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), RuntimeMethod) // Hash:0xf70c4a85 47 , m_outputConstraintSpace("WebCore Wrapper w/ Output Constraint", vm.heap, vm.destructibleObjectHeapCellType.get(), vm.fastMallocAllocator.get()) // Hash:0x7724c2e4 48 , m_globalObjectOutputConstraintSpace("WebCore Global Object w/ Output Constraint", vm.heap, vm.cellHeapCellType.get(), vm.fastMallocAllocator.get()) // Hash:0x522d6ec9 49 49 { 50 50 }
Note:
See TracChangeset
for help on using the changeset viewer.