Diff
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (213674 => 213675)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2017-03-09 22:39:09 UTC (rev 213675)
@@ -499,11 +499,9 @@
heap/HeapSnapshot.cpp
heap/HeapSnapshotBuilder.cpp
heap/HeapTimer.cpp
- heap/HeapVerifier.cpp
heap/IncrementalSweeper.cpp
heap/JITStubRoutineSet.cpp
heap/LargeAllocation.cpp
- heap/LiveObjectList.cpp
heap/MachineStackMarker.cpp
heap/MarkStack.cpp
heap/MarkedAllocator.cpp
@@ -915,10 +913,12 @@
runtime/WeakSetConstructor.cpp
runtime/WeakSetPrototype.cpp
+ tools/CellList.cpp
tools/CodeProfile.cpp
tools/CodeProfiling.cpp
tools/FunctionOverrides.cpp
tools/FunctionWhitelist.cpp
+ tools/HeapVerifier.cpp
tools/JSDollarVM.cpp
tools/JSDollarVMPrototype.cpp
tools/SigillCrashAnalyzer.cpp
Modified: trunk/Source/_javascript_Core/ChangeLog (213674 => 213675)
--- trunk/Source/_javascript_Core/ChangeLog 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-03-09 22:39:09 UTC (rev 213675)
@@ -1,3 +1,59 @@
+2017-03-09 Mark Lam <[email protected]>
+
+ Refactoring some HeapVerifier code.
+ https://bugs.webkit.org/show_bug.cgi?id=169443
+
+ Reviewed by Filip Pizlo.
+
+ Renamed LiveObjectData to CellProfile.
+ Renamed LiveObjectList to CellList.
+ Moved CellProfile.*, CellList.*, and HeapVerifier.* from the heap folder to the tools folder.
+ Updated the HeapVerifier to handle JSCells instead of just JSObjects.
+
+ This is in preparation for subsequent patches to fix up the HeapVerifier for service again.
+
+ * CMakeLists.txt:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * heap/Heap.cpp:
+ (JSC::Heap::runBeginPhase):
+ (JSC::Heap::runEndPhase):
+ * heap/HeapVerifier.cpp: Removed.
+ * heap/HeapVerifier.h: Removed.
+ * heap/LiveObjectData.h: Removed.
+ * heap/LiveObjectList.cpp: Removed.
+ * heap/LiveObjectList.h: Removed.
+ * tools/CellList.cpp: Copied from Source/_javascript_Core/heap/LiveObjectList.cpp.
+ (JSC::CellList::findCell):
+ (JSC::LiveObjectList::findObject): Deleted.
+ * tools/CellList.h: Copied from Source/_javascript_Core/heap/LiveObjectList.h.
+ (JSC::CellList::CellList):
+ (JSC::CellList::reset):
+ (JSC::LiveObjectList::LiveObjectList): Deleted.
+ (JSC::LiveObjectList::reset): Deleted.
+ * tools/CellProfile.h: Copied from Source/_javascript_Core/heap/LiveObjectData.h.
+ (JSC::CellProfile::CellProfile):
+ (JSC::LiveObjectData::LiveObjectData): Deleted.
+ * tools/HeapVerifier.cpp: Copied from Source/_javascript_Core/heap/HeapVerifier.cpp.
+ (JSC::GatherCellFunctor::GatherCellFunctor):
+ (JSC::GatherCellFunctor::visit):
+ (JSC::GatherCellFunctor::operator()):
+ (JSC::HeapVerifier::gatherLiveCells):
+ (JSC::HeapVerifier::cellListForGathering):
+ (JSC::trimDeadCellsFromList):
+ (JSC::HeapVerifier::trimDeadCells):
+ (JSC::HeapVerifier::verifyButterflyIsInStorageSpace):
+ (JSC::HeapVerifier::reportCell):
+ (JSC::HeapVerifier::checkIfRecorded):
+ (JSC::GatherLiveObjFunctor::GatherLiveObjFunctor): Deleted.
+ (JSC::GatherLiveObjFunctor::visit): Deleted.
+ (JSC::GatherLiveObjFunctor::operator()): Deleted.
+ (JSC::HeapVerifier::gatherLiveObjects): Deleted.
+ (JSC::HeapVerifier::liveObjectListForGathering): Deleted.
+ (JSC::trimDeadObjectsFromList): Deleted.
+ (JSC::HeapVerifier::trimDeadObjects): Deleted.
+ (JSC::HeapVerifier::reportObject): Deleted.
+ * tools/HeapVerifier.h: Copied from Source/_javascript_Core/heap/HeapVerifier.h.
+
2017-03-09 Anders Carlsson <[email protected]>
Add delegate support to WebCore
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (213674 => 213675)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-03-09 22:39:09 UTC (rev 213675)
@@ -2360,6 +2360,11 @@
FE187A0D1C030D5C0038BBCA /* JITDivGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0B1C0229230038BBCA /* JITDivGenerator.h */; };
FE187A0E1C030D640038BBCA /* JITDivGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */; };
FE187A0F1C030D6C0038BBCA /* SnippetOperand.h in Headers */ = {isa = PBXBuildFile; fileRef = FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */; };
+ FE1BD01E1E72002A00134BC9 /* CellList.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1BD01C1E72002100134BC9 /* CellList.h */; };
+ FE1BD01F1E72002D00134BC9 /* CellList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1BD01B1E72002100134BC9 /* CellList.cpp */; };
+ FE1BD0211E72027900134BC9 /* CellProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1BD0201E72027000134BC9 /* CellProfile.h */; };
+ FE1BD0241E72053800134BC9 /* HeapVerifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1BD0221E72052F00134BC9 /* HeapVerifier.cpp */; };
+ FE1BD0251E72053800134BC9 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1BD0231E72052F00134BC9 /* HeapVerifier.h */; };
FE1C0FFD1B193E9800B53FCA /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1C0FFC1B193E9800B53FCA /* Exception.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE1C0FFF1B194FD100B53FCA /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE1C0FFE1B194FD100B53FCA /* Exception.cpp */; };
FE20CE9D15F04A9500DF3430 /* LLIntCLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE20CE9B15F04A9500DF3430 /* LLIntCLoop.cpp */; };
@@ -2377,9 +2382,6 @@
FE384EE61ADDB7AD0055DE2C /* JSDollarVM.h in Headers */ = {isa = PBXBuildFile; fileRef = FE384EE21ADDB7AD0055DE2C /* JSDollarVM.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE384EE71ADDB7AD0055DE2C /* JSDollarVMPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE384EE31ADDB7AD0055DE2C /* JSDollarVMPrototype.cpp */; };
FE384EE81ADDB7AD0055DE2C /* JSDollarVMPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = FE384EE41ADDB7AD0055DE2C /* JSDollarVMPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
- FE3913541B794F6E00EDAF71 /* LiveObjectList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE3913521B794AC900EDAF71 /* LiveObjectList.cpp */; };
- FE3913551B794F8A00EDAF71 /* LiveObjectData.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3913511B794AC900EDAF71 /* LiveObjectData.h */; settings = {ATTRIBUTES = (Private, ); }; };
- FE3913561B794F8F00EDAF71 /* LiveObjectList.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3913531B794AC900EDAF71 /* LiveObjectList.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE3A06A61C10B72D00390FDD /* JITBitOrGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3A06A41C10B70800390FDD /* JITBitOrGenerator.h */; };
FE3A06A81C10BC8100390FDD /* JITBitBinaryOpGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3A06A71C10BC7400390FDD /* JITBitBinaryOpGenerator.h */; };
FE3A06AC1C10C39E00390FDD /* JITBitOrGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE3A06A31C10B70800390FDD /* JITBitOrGenerator.cpp */; };
@@ -2406,8 +2408,6 @@
FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */; };
FE6F56DE1E64EAD600D17801 /* VMTraps.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F56DD1E64E92000D17801 /* VMTraps.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE6F56DF1E64EADB00D17801 /* VMTraps.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6F56DC1E64E92000D17801 /* VMTraps.cpp */; };
- FE7BA60F1A1A7CEC00F1F7B4 /* HeapVerifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */; };
- FE7BA6101A1A7CEC00F1F7B4 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE7C41961B97FC4B00F4D598 /* PingPongStackOverflowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */; };
FE80C1971D775CDD008510C0 /* CatchScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80C1961D775B27008510C0 /* CatchScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
FE80C1991D775FBE008510C0 /* CatchScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80C1981D775FB4008510C0 /* CatchScope.cpp */; };
@@ -4940,6 +4940,11 @@
FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITDivGenerator.cpp; sourceTree = "<group>"; };
FE187A0B1C0229230038BBCA /* JITDivGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITDivGenerator.h; sourceTree = "<group>"; };
FE187A0C1C02EBA70038BBCA /* SnippetOperand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SnippetOperand.h; sourceTree = "<group>"; };
+ FE1BD01B1E72002100134BC9 /* CellList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CellList.cpp; sourceTree = "<group>"; };
+ FE1BD01C1E72002100134BC9 /* CellList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CellList.h; sourceTree = "<group>"; };
+ FE1BD0201E72027000134BC9 /* CellProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CellProfile.h; sourceTree = "<group>"; };
+ FE1BD0221E72052F00134BC9 /* HeapVerifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapVerifier.cpp; sourceTree = "<group>"; };
+ FE1BD0231E72052F00134BC9 /* HeapVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapVerifier.h; sourceTree = "<group>"; };
FE1C0FFC1B193E9800B53FCA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; };
FE1C0FFE1B194FD100B53FCA /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; };
FE20CE9B15F04A9500DF3430 /* LLIntCLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntCLoop.cpp; path = llint/LLIntCLoop.cpp; sourceTree = "<group>"; };
@@ -4957,9 +4962,6 @@
FE384EE21ADDB7AD0055DE2C /* JSDollarVM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDollarVM.h; sourceTree = "<group>"; };
FE384EE31ADDB7AD0055DE2C /* JSDollarVMPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDollarVMPrototype.cpp; sourceTree = "<group>"; };
FE384EE41ADDB7AD0055DE2C /* JSDollarVMPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDollarVMPrototype.h; sourceTree = "<group>"; };
- FE3913511B794AC900EDAF71 /* LiveObjectData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveObjectData.h; sourceTree = "<group>"; };
- FE3913521B794AC900EDAF71 /* LiveObjectList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiveObjectList.cpp; sourceTree = "<group>"; };
- FE3913531B794AC900EDAF71 /* LiveObjectList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveObjectList.h; sourceTree = "<group>"; };
FE3A06A31C10B70800390FDD /* JITBitOrGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITBitOrGenerator.cpp; sourceTree = "<group>"; };
FE3A06A41C10B70800390FDD /* JITBitOrGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITBitOrGenerator.h; sourceTree = "<group>"; };
FE3A06A71C10BC7400390FDD /* JITBitBinaryOpGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITBitBinaryOpGenerator.h; sourceTree = "<group>"; };
@@ -4986,8 +4988,6 @@
FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerPrinter.h; sourceTree = "<group>"; };
FE6F56DC1E64E92000D17801 /* VMTraps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMTraps.cpp; sourceTree = "<group>"; };
FE6F56DD1E64E92000D17801 /* VMTraps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMTraps.h; sourceTree = "<group>"; };
- FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapVerifier.cpp; sourceTree = "<group>"; };
- FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapVerifier.h; sourceTree = "<group>"; };
FE80C1961D775B27008510C0 /* CatchScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatchScope.h; sourceTree = "<group>"; };
FE80C1981D775FB4008510C0 /* CatchScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CatchScope.cpp; sourceTree = "<group>"; };
FE80C19A1D7768FD008510C0 /* ExceptionEventLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionEventLocation.cpp; sourceTree = "<group>"; };
@@ -5871,8 +5871,6 @@
C2E526BB1590EF000054E48D /* HeapTimer.cpp */,
C2E526BC1590EF000054E48D /* HeapTimer.h */,
0FADE6721D4D23BC00768457 /* HeapUtil.h */,
- FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */,
- FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */,
C25F8BCB157544A900245B71 /* IncrementalSweeper.cpp */,
C25F8BCC157544A900245B71 /* IncrementalSweeper.h */,
0F766D2915A8CC34008F363E /* JITStubRoutineSet.cpp */,
@@ -5880,9 +5878,6 @@
0F070A451D543A89006E7232 /* LargeAllocation.cpp */,
0F070A461D543A89006E7232 /* LargeAllocation.h */,
0F431736146BAC65007E3890 /* ListableHandler.h */,
- FE3913511B794AC900EDAF71 /* LiveObjectData.h */,
- FE3913521B794AC900EDAF71 /* LiveObjectList.cpp */,
- FE3913531B794AC900EDAF71 /* LiveObjectList.h */,
142E3130134FF0A600AFADB5 /* Local.h */,
142E3131134FF0A600AFADB5 /* LocalScope.h */,
0F208AD61DF0925A007D3269 /* LockDuringMarking.h */,
@@ -6923,6 +6918,9 @@
8603CEF014C753EF00AE59E3 /* tools */ = {
isa = PBXGroup;
children = (
+ FE1BD01B1E72002100134BC9 /* CellList.cpp */,
+ FE1BD01C1E72002100134BC9 /* CellList.h */,
+ FE1BD0201E72027000134BC9 /* CellProfile.h */,
86B5822E14D2373B00A9C306 /* CodeProfile.cpp */,
86B5822F14D2373B00A9C306 /* CodeProfile.h */,
8603CEF214C7546400AE59E3 /* CodeProfiling.cpp */,
@@ -6931,6 +6929,8 @@
FE4BFF2A1AD476E700088F87 /* FunctionOverrides.h */,
FEA0C4001CDD7D0E00481991 /* FunctionWhitelist.cpp */,
FEA0C4011CDD7D0E00481991 /* FunctionWhitelist.h */,
+ FE1BD0221E72052F00134BC9 /* HeapVerifier.cpp */,
+ FE1BD0231E72052F00134BC9 /* HeapVerifier.h */,
FE384EE11ADDB7AD0055DE2C /* JSDollarVM.cpp */,
FE384EE21ADDB7AD0055DE2C /* JSDollarVM.h */,
FE384EE31ADDB7AD0055DE2C /* JSDollarVMPrototype.cpp */,
@@ -8294,6 +8294,7 @@
0FC3CCFC19ADA410006AC72A /* DFGBlockMap.h in Headers */,
0FC3CCFD19ADA410006AC72A /* DFGBlockMapInlines.h in Headers */,
5381B9391E60E97D0090F794 /* WasmFaultSignalHandler.h in Headers */,
+ FE1BD01E1E72002A00134BC9 /* CellList.h in Headers */,
0FC3CCFE19ADA410006AC72A /* DFGBlockSet.h in Headers */,
0FBF158D19B7A53100695DD0 /* DFGBlockSetInlines.h in Headers */,
0FC3CD0019ADA410006AC72A /* DFGBlockWorklist.h in Headers */,
@@ -8327,6 +8328,7 @@
C2981FD917BAEE4B00A3BC98 /* DFGDesiredWeakReferences.h in Headers */,
0FF427651591A1CE004CB9FF /* DFGDisassembler.h in Headers */,
0F5A1274192D9FDF008764A3 /* DFGDoesGC.h in Headers */,
+ FE1BD0251E72053800134BC9 /* HeapVerifier.h in Headers */,
0FD81AD3154FB4F000983E72 /* DFGDominators.h in Headers */,
E322E5A31DA64439006E7709 /* DFGDOMJITPatchpointParams.h in Headers */,
0F1E3A471534CBB9000F9456 /* DFGDoubleFormatState.h in Headers */,
@@ -8642,7 +8644,6 @@
C2E526BE1590EF000054E48D /* HeapTimer.h in Headers */,
0FD0E5EA1E43D34D0006AB08 /* GCConductor.h in Headers */,
0FADE6731D4D23BE00768457 /* HeapUtil.h in Headers */,
- FE7BA6101A1A7CEC00F1F7B4 /* HeapVerifier.h in Headers */,
0F4680D514BBD24B00BFE272 /* HostCallReturnValue.h in Headers */,
DC2143071CA32E55000A8869 /* ICStats.h in Headers */,
BC18C40F0E16F5CD00B34460 /* Identifier.h in Headers */,
@@ -8936,8 +8937,6 @@
86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */,
0F431738146BAC69007E3890 /* ListableHandler.h in Headers */,
A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */,
- FE3913551B794F8A00EDAF71 /* LiveObjectData.h in Headers */,
- FE3913561B794F8F00EDAF71 /* LiveObjectList.h in Headers */,
70DE9A091BE7D69E005D89D9 /* LLIntAssembly.h in Headers */,
0F0FC45A14BD15F500B81154 /* LLIntCallLinkInfo.h in Headers */,
FE20CE9E15F04A9500DF3430 /* LLIntCLoop.h in Headers */,
@@ -8961,6 +8960,7 @@
86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */,
A1A009C01831A22D00CF8711 /* MacroAssemblerARM64.h in Headers */,
86ADD1460FDDEA980006EEC2 /* MacroAssemblerARMv7.h in Headers */,
+ FE1BD0211E72027900134BC9 /* CellProfile.h in Headers */,
863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */,
E32AB2441DCD75F400D7533A /* MacroAssemblerHelpers.h in Headers */,
86C568E111A213EE0007F7F0 /* MacroAssemblerMIPS.h in Headers */,
@@ -10275,7 +10275,6 @@
A54C2AB01C6544EE00A18D78 /* HeapSnapshot.cpp in Sources */,
A5311C371C77CECA00E6B1B6 /* HeapSnapshotBuilder.cpp in Sources */,
C2E526BD1590EF000054E48D /* HeapTimer.cpp in Sources */,
- FE7BA60F1A1A7CEC00F1F7B4 /* HeapVerifier.cpp in Sources */,
0F4680D414BBD24900BFE272 /* HostCallReturnValue.cpp in Sources */,
DC2143081CA32E58000A8869 /* ICStats.cpp in Sources */,
147F39CE107EC37600427A48 /* Identifier.cpp in Sources */,
@@ -10480,7 +10479,6 @@
148F21B0107EC5410042EC2C /* Lexer.cpp in Sources */,
0FF4275715914A20004CB9FF /* LinkBuffer.cpp in Sources */,
A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */,
- FE3913541B794F6E00EDAF71 /* LiveObjectList.cpp in Sources */,
FE20CE9D15F04A9500DF3430 /* LLIntCLoop.cpp in Sources */,
0F4680D214BBD16500BFE272 /* LLIntData.cpp in Sources */,
0F38B01117CF078000B144D3 /* LLIntEntrypoint.cpp in Sources */,
@@ -10632,6 +10630,7 @@
0FDE87FD1DFE6E540064C390 /* SpaceTimeMutatorScheduler.cpp in Sources */,
0F0CD4C415F6B6BB0032F1C0 /* SparseArrayValueMap.cpp in Sources */,
0F5541B11613C1FB00CE3E25 /* SpecialPointer.cpp in Sources */,
+ FE1BD01F1E72002D00134BC9 /* CellList.cpp in Sources */,
0FD82E86141F3FF100179C94 /* SpeculatedType.cpp in Sources */,
0F6DB7EA1D6124B800CDBF8E /* StackFrame.cpp in Sources */,
A7C1EAF117987AB600299DB2 /* StackVisitor.cpp in Sources */,
@@ -10666,6 +10665,7 @@
0FA2C17B17D7CF84009D015F /* TestRunnerUtils.cpp in Sources */,
FE2E6A7B1D6EA62C0060F896 /* ThrowScope.cpp in Sources */,
A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */,
+ FE1BD0241E72053800134BC9 /* HeapVerifier.cpp in Sources */,
0F2D4DE819832DAC007D4B19 /* ToThisStatus.cpp in Sources */,
0F952ABC1B487A7700C367C5 /* TrackedReferences.cpp in Sources */,
0F2B670717B6B5AB00A7AE3F /* TypedArrayController.cpp in Sources */,
Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (213674 => 213675)
--- trunk/Source/_javascript_Core/heap/Heap.cpp 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp 2017-03-09 22:39:09 UTC (rev 213675)
@@ -1103,7 +1103,7 @@
m_verifier->verify(HeapVerifier::Phase::BeforeGC);
m_verifier->initializeGCCycle();
- m_verifier->gatherLiveObjects(HeapVerifier::Phase::BeforeMarking);
+ m_verifier->gatherLiveCells(HeapVerifier::Phase::BeforeMarking);
}
prepareForMarking();
@@ -1333,7 +1333,7 @@
endMarking();
if (m_verifier) {
- m_verifier->gatherLiveObjects(HeapVerifier::Phase::AfterMarking);
+ m_verifier->gatherLiveCells(HeapVerifier::Phase::AfterMarking);
m_verifier->verify(HeapVerifier::Phase::AfterMarking);
}
@@ -1360,7 +1360,7 @@
didFinishCollection();
if (m_verifier) {
- m_verifier->trimDeadObjects();
+ m_verifier->trimDeadCells();
m_verifier->verify(HeapVerifier::Phase::AfterGC);
}
Deleted: trunk/Source/_javascript_Core/heap/HeapVerifier.cpp (213674 => 213675)
--- trunk/Source/_javascript_Core/heap/HeapVerifier.cpp 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/heap/HeapVerifier.cpp 2017-03-09 22:39:09 UTC (rev 213675)
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "HeapVerifier.h"
-
-#include "ButterflyInlines.h"
-#include "HeapIterationScope.h"
-#include "JSCInlines.h"
-#include "JSObject.h"
-#include "MarkedSpaceInlines.h"
-
-namespace JSC {
-
-HeapVerifier::HeapVerifier(Heap* heap, unsigned numberOfGCCyclesToRecord)
- : m_heap(heap)
- , m_currentCycle(0)
- , m_numberOfCycles(numberOfGCCyclesToRecord)
-{
- RELEASE_ASSERT(m_numberOfCycles > 0);
- m_cycles = std::make_unique<GCCycle[]>(m_numberOfCycles);
-}
-
-const char* HeapVerifier::phaseName(HeapVerifier::Phase phase)
-{
- switch (phase) {
- case Phase::BeforeGC:
- return "BeforeGC";
- case Phase::BeforeMarking:
- return "BeforeMarking";
- case Phase::AfterMarking:
- return "AfterMarking";
- case Phase::AfterGC:
- return "AfterGC";
- }
- RELEASE_ASSERT_NOT_REACHED();
- return nullptr; // Silencing a compiler warning.
-}
-
-void HeapVerifier::initializeGCCycle()
-{
- Heap* heap = m_heap;
- incrementCycle();
- currentCycle().scope = *heap->collectionScope();
-}
-
-struct GatherLiveObjFunctor : MarkedBlock::CountFunctor {
- GatherLiveObjFunctor(LiveObjectList& list)
- : m_list(list)
- {
- ASSERT(!list.liveObjects.size());
- }
-
- inline void visit(JSCell* cell)
- {
- if (!cell->isObject())
- return;
- LiveObjectData data(asObject(cell));
- m_list.liveObjects.append(data);
- }
-
- IterationStatus operator()(HeapCell* cell, HeapCell::Kind kind) const
- {
- if (kind == HeapCell::JSCell) {
- // FIXME: This const_cast exists because this isn't a C++ lambda.
- // https://bugs.webkit.org/show_bug.cgi?id=159644
- const_cast<GatherLiveObjFunctor*>(this)->visit(static_cast<JSCell*>(cell));
- }
- return IterationStatus::Continue;
- }
-
- LiveObjectList& m_list;
-};
-
-void HeapVerifier::gatherLiveObjects(HeapVerifier::Phase phase)
-{
- Heap* heap = m_heap;
- LiveObjectList& list = *liveObjectListForGathering(phase);
-
- HeapIterationScope iterationScope(*heap);
- list.reset();
- GatherLiveObjFunctor functor(list);
- heap->m_objectSpace.forEachLiveCell(iterationScope, functor);
-}
-
-LiveObjectList* HeapVerifier::liveObjectListForGathering(HeapVerifier::Phase phase)
-{
- switch (phase) {
- case Phase::BeforeMarking:
- return ¤tCycle().before;
- case Phase::AfterMarking:
- return ¤tCycle().after;
- case Phase::BeforeGC:
- case Phase::AfterGC:
- // We should not be gathering live objects during these phases.
- break;
- }
- RELEASE_ASSERT_NOT_REACHED();
- return nullptr; // Silencing a compiler warning.
-}
-
-static void trimDeadObjectsFromList(HashSet<JSObject*>& knownLiveSet, LiveObjectList& list)
-{
- if (!list.hasLiveObjects)
- return;
-
- size_t liveObjectsFound = 0;
- for (auto& objData : list.liveObjects) {
- if (objData.isConfirmedDead)
- continue; // Don't "resurrect" known dead objects.
- if (!knownLiveSet.contains(objData.obj)) {
- objData.isConfirmedDead = true;
- continue;
- }
- liveObjectsFound++;
- }
- list.hasLiveObjects = !!liveObjectsFound;
-}
-
-void HeapVerifier::trimDeadObjects()
-{
- HashSet<JSObject*> knownLiveSet;
-
- LiveObjectList& after = currentCycle().after;
- for (auto& objData : after.liveObjects)
- knownLiveSet.add(objData.obj);
-
- trimDeadObjectsFromList(knownLiveSet, currentCycle().before);
-
- for (int i = -1; i > -m_numberOfCycles; i--) {
- trimDeadObjectsFromList(knownLiveSet, cycleForIndex(i).before);
- trimDeadObjectsFromList(knownLiveSet, cycleForIndex(i).after);
- }
-}
-
-bool HeapVerifier::verifyButterflyIsInStorageSpace(Phase, LiveObjectList&)
-{
- // FIXME: Make this work again. https://bugs.webkit.org/show_bug.cgi?id=161752
- return true;
-}
-
-void HeapVerifier::verify(HeapVerifier::Phase phase)
-{
- bool beforeVerified = verifyButterflyIsInStorageSpace(phase, currentCycle().before);
- bool afterVerified = verifyButterflyIsInStorageSpace(phase, currentCycle().after);
- RELEASE_ASSERT(beforeVerified && afterVerified);
-}
-
-void HeapVerifier::reportObject(LiveObjectData& objData, int cycleIndex, HeapVerifier::GCCycle& cycle, LiveObjectList& list)
-{
- JSObject* obj = objData.obj;
-
- if (objData.isConfirmedDead) {
- dataLogF("FOUND dead obj %p in GC[%d] %s list '%s'\n",
- obj, cycleIndex, collectionScopeName(cycle.scope), list.name);
- return;
- }
-
- Structure* structure = obj->structure();
- Butterfly* butterfly = obj->butterfly();
- void* butterflyBase = butterfly->base(structure);
-
- dataLogF("FOUND obj %p type '%s' butterfly %p (base %p) in GC[%d] %s list '%s'\n",
- obj, structure->classInfo()->className,
- butterfly, butterflyBase,
- cycleIndex, collectionScopeName(cycle.scope), list.name);
-}
-
-void HeapVerifier::checkIfRecorded(JSObject* obj)
-{
- bool found = false;
-
- for (int cycleIndex = 0; cycleIndex > -m_numberOfCycles; cycleIndex--) {
- GCCycle& cycle = cycleForIndex(cycleIndex);
- LiveObjectList& beforeList = cycle.before;
- LiveObjectList& afterList = cycle.after;
-
- LiveObjectData* objData;
- objData = beforeList.findObject(obj);
- if (objData) {
- reportObject(*objData, cycleIndex, cycle, beforeList);
- found = true;
- }
- objData = afterList.findObject(obj);
- if (objData) {
- reportObject(*objData, cycleIndex, cycle, afterList);
- found = true;
- }
- }
-
- if (!found)
- dataLogF("obj %p NOT FOUND\n", obj);
-}
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/heap/HeapVerifier.h (213674 => 213675)
--- trunk/Source/_javascript_Core/heap/HeapVerifier.h 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/heap/HeapVerifier.h 2017-03-09 22:39:09 UTC (rev 213675)
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "Heap.h"
-#include "LiveObjectList.h"
-
-namespace JSC {
-
-class JSObject;
-class MarkedBlock;
-
-class HeapVerifier {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- enum class Phase {
- BeforeGC,
- BeforeMarking,
- AfterMarking,
- AfterGC
- };
-
- HeapVerifier(Heap*, unsigned numberOfGCCyclesToRecord);
-
- void initializeGCCycle();
- void gatherLiveObjects(Phase);
- void trimDeadObjects();
- void verify(Phase);
-
- // Scans all previously recorded LiveObjectLists and checks if the specified
- // object was in any of those lists.
- JS_EXPORT_PRIVATE void checkIfRecorded(JSObject*);
-
- static const char* phaseName(Phase);
-
-private:
- struct GCCycle {
- GCCycle()
- : before("Before Marking")
- , after("After Marking")
- {
- }
-
- CollectionScope scope;
- LiveObjectList before;
- LiveObjectList after;
- };
-
- void incrementCycle() { m_currentCycle = (m_currentCycle + 1) % m_numberOfCycles; }
- GCCycle& currentCycle() { return m_cycles[m_currentCycle]; }
- GCCycle& cycleForIndex(int cycleIndex)
- {
- ASSERT(cycleIndex <= 0 && cycleIndex > -m_numberOfCycles);
- cycleIndex += m_currentCycle;
- if (cycleIndex < 0)
- cycleIndex += m_numberOfCycles;
- ASSERT(cycleIndex < m_numberOfCycles);
- return m_cycles[cycleIndex];
- }
-
- LiveObjectList* liveObjectListForGathering(Phase);
- bool verifyButterflyIsInStorageSpace(Phase, LiveObjectList&);
-
- static void reportObject(LiveObjectData&, int cycleIndex, HeapVerifier::GCCycle&, LiveObjectList&);
-
- Heap* m_heap;
- int m_currentCycle;
- int m_numberOfCycles;
- std::unique_ptr<GCCycle[]> m_cycles;
-};
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/heap/LiveObjectData.h (213674 => 213675)
--- trunk/Source/_javascript_Core/heap/LiveObjectData.h 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/heap/LiveObjectData.h 2017-03-09 22:39:09 UTC (rev 213675)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-namespace JSC {
-
-class JSObject;
-
-struct LiveObjectData {
- LiveObjectData(JSObject* obj, bool isConfirmedDead = false)
- : obj(obj)
- , isConfirmedDead(isConfirmedDead)
- {
- }
-
- JSObject* obj;
- bool isConfirmedDead;
-};
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/heap/LiveObjectList.cpp (213674 => 213675)
--- trunk/Source/_javascript_Core/heap/LiveObjectList.cpp 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/heap/LiveObjectList.cpp 2017-03-09 22:39:09 UTC (rev 213675)
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LiveObjectList.h"
-
-namespace JSC {
-
-LiveObjectData* LiveObjectList::findObject(JSObject* obj)
-{
- for (auto& data : liveObjects) {
- if (obj == data.obj)
- return &data;
- }
- return nullptr;
-}
-
-} // namespace JSC
Deleted: trunk/Source/_javascript_Core/heap/LiveObjectList.h (213674 => 213675)
--- trunk/Source/_javascript_Core/heap/LiveObjectList.h 2017-03-09 22:37:13 UTC (rev 213674)
+++ trunk/Source/_javascript_Core/heap/LiveObjectList.h 2017-03-09 22:39:09 UTC (rev 213675)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "LiveObjectData.h"
-#include <wtf/Vector.h>
-
-namespace JSC {
-
-struct LiveObjectList {
- LiveObjectList(const char* name)
- : name(name)
- , hasLiveObjects(true)
- {
- }
-
- void reset()
- {
- liveObjects.clear();
- hasLiveObjects = true; // Presume to have live objects until the list is trimmed.
- }
-
- LiveObjectData* findObject(JSObject*);
-
- const char* name;
- Vector<LiveObjectData> liveObjects;
- bool hasLiveObjects;
-};
-
-} // namespace JSC
Copied: trunk/Source/_javascript_Core/tools/CellList.cpp (from rev 213674, trunk/Source/_javascript_Core/heap/LiveObjectList.cpp) (0 => 213675)
--- trunk/Source/_javascript_Core/tools/CellList.cpp (rev 0)
+++ trunk/Source/_javascript_Core/tools/CellList.cpp 2017-03-09 22:39:09 UTC (rev 213675)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CellList.h"
+
+namespace JSC {
+
+CellProfile* CellList::findCell(JSCell* cell)
+{
+ for (auto& profile : liveCells) {
+ if (cell == profile.cell)
+ return &profile;
+ }
+ return nullptr;
+}
+
+} // namespace JSC
Copied: trunk/Source/_javascript_Core/tools/CellList.h (from rev 213674, trunk/Source/_javascript_Core/heap/LiveObjectList.h) (0 => 213675)
--- trunk/Source/_javascript_Core/tools/CellList.h (rev 0)
+++ trunk/Source/_javascript_Core/tools/CellList.h 2017-03-09 22:39:09 UTC (rev 213675)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CellProfile.h"
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+struct CellList {
+ CellList(const char* name)
+ : name(name)
+ , hasLiveCells(true)
+ {
+ }
+
+ void reset()
+ {
+ liveCells.clear();
+ hasLiveCells = true; // Presume to have live objects until the list is trimmed.
+ }
+
+ CellProfile* findCell(JSCell*);
+
+ const char* name;
+ Vector<CellProfile> liveCells;
+ bool hasLiveCells;
+};
+
+} // namespace JSC
Copied: trunk/Source/_javascript_Core/tools/CellProfile.h (from rev 213674, trunk/Source/_javascript_Core/heap/LiveObjectData.h) (0 => 213675)
--- trunk/Source/_javascript_Core/tools/CellProfile.h (rev 0)
+++ trunk/Source/_javascript_Core/tools/CellProfile.h 2017-03-09 22:39:09 UTC (rev 213675)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace JSC {
+
+class JSCell;
+
+struct CellProfile {
+ CellProfile(JSCell* cell, bool isConfirmedDead = false)
+ : cell(cell)
+ , isConfirmedDead(isConfirmedDead)
+ {
+ }
+
+ JSCell* cell;
+ bool isConfirmedDead;
+};
+
+} // namespace JSC
Copied: trunk/Source/_javascript_Core/tools/HeapVerifier.cpp (from rev 213674, trunk/Source/_javascript_Core/heap/HeapVerifier.cpp) (0 => 213675)
--- trunk/Source/_javascript_Core/tools/HeapVerifier.cpp (rev 0)
+++ trunk/Source/_javascript_Core/tools/HeapVerifier.cpp 2017-03-09 22:39:09 UTC (rev 213675)
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HeapVerifier.h"
+
+#include "ButterflyInlines.h"
+#include "HeapIterationScope.h"
+#include "JSCInlines.h"
+#include "JSObject.h"
+#include "MarkedSpaceInlines.h"
+
+namespace JSC {
+
+HeapVerifier::HeapVerifier(Heap* heap, unsigned numberOfGCCyclesToRecord)
+ : m_heap(heap)
+ , m_currentCycle(0)
+ , m_numberOfCycles(numberOfGCCyclesToRecord)
+{
+ RELEASE_ASSERT(m_numberOfCycles > 0);
+ m_cycles = std::make_unique<GCCycle[]>(m_numberOfCycles);
+}
+
+const char* HeapVerifier::phaseName(HeapVerifier::Phase phase)
+{
+ switch (phase) {
+ case Phase::BeforeGC:
+ return "BeforeGC";
+ case Phase::BeforeMarking:
+ return "BeforeMarking";
+ case Phase::AfterMarking:
+ return "AfterMarking";
+ case Phase::AfterGC:
+ return "AfterGC";
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return nullptr; // Silencing a compiler warning.
+}
+
+void HeapVerifier::initializeGCCycle()
+{
+ Heap* heap = m_heap;
+ incrementCycle();
+ currentCycle().scope = *heap->collectionScope();
+}
+
+struct GatherCellFunctor : MarkedBlock::CountFunctor {
+ GatherCellFunctor(CellList& list)
+ : m_list(list)
+ {
+ ASSERT(!list.liveCells.size());
+ }
+
+ inline void visit(JSCell* cell)
+ {
+ CellProfile profile(cell);
+ m_list.liveCells.append(profile);
+ }
+
+ IterationStatus operator()(HeapCell* cell, HeapCell::Kind kind) const
+ {
+ if (kind == HeapCell::JSCell) {
+ // FIXME: This const_cast exists because this isn't a C++ lambda.
+ // https://bugs.webkit.org/show_bug.cgi?id=159644
+ const_cast<GatherCellFunctor*>(this)->visit(static_cast<JSCell*>(cell));
+ }
+ return IterationStatus::Continue;
+ }
+
+ CellList& m_list;
+};
+
+void HeapVerifier::gatherLiveCells(HeapVerifier::Phase phase)
+{
+ Heap* heap = m_heap;
+ CellList& list = *cellListForGathering(phase);
+
+ HeapIterationScope iterationScope(*heap);
+ list.reset();
+ GatherCellFunctor functor(list);
+ heap->m_objectSpace.forEachLiveCell(iterationScope, functor);
+}
+
+CellList* HeapVerifier::cellListForGathering(HeapVerifier::Phase phase)
+{
+ switch (phase) {
+ case Phase::BeforeMarking:
+ return ¤tCycle().before;
+ case Phase::AfterMarking:
+ return ¤tCycle().after;
+ case Phase::BeforeGC:
+ case Phase::AfterGC:
+ // We should not be gathering live cells during these phases.
+ break;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return nullptr; // Silencing a compiler warning.
+}
+
+static void trimDeadCellsFromList(HashSet<JSCell*>& knownLiveSet, CellList& list)
+{
+ if (!list.hasLiveCells)
+ return;
+
+ size_t liveCellsFound = 0;
+ for (auto& cellProfile : list.liveCells) {
+ if (cellProfile.isConfirmedDead)
+ continue; // Don't "resurrect" known dead cells.
+ if (!knownLiveSet.contains(cellProfile.cell)) {
+ cellProfile.isConfirmedDead = true;
+ continue;
+ }
+ liveCellsFound++;
+ }
+ list.hasLiveCells = !!liveCellsFound;
+}
+
+void HeapVerifier::trimDeadCells()
+{
+ HashSet<JSCell*> knownLiveSet;
+
+ CellList& after = currentCycle().after;
+ for (auto& cellProfile : after.liveCells)
+ knownLiveSet.add(cellProfile.cell);
+
+ trimDeadCellsFromList(knownLiveSet, currentCycle().before);
+
+ for (int i = -1; i > -m_numberOfCycles; i--) {
+ trimDeadCellsFromList(knownLiveSet, cycleForIndex(i).before);
+ trimDeadCellsFromList(knownLiveSet, cycleForIndex(i).after);
+ }
+}
+
+bool HeapVerifier::verifyButterflyIsInStorageSpace(Phase, CellList&)
+{
+ // FIXME: Make this work again. https://bugs.webkit.org/show_bug.cgi?id=161752
+ return true;
+}
+
+void HeapVerifier::verify(HeapVerifier::Phase phase)
+{
+ bool beforeVerified = verifyButterflyIsInStorageSpace(phase, currentCycle().before);
+ bool afterVerified = verifyButterflyIsInStorageSpace(phase, currentCycle().after);
+ RELEASE_ASSERT(beforeVerified && afterVerified);
+}
+
+void HeapVerifier::reportCell(CellProfile& cellProfile, int cycleIndex, HeapVerifier::GCCycle& cycle, CellList& list)
+{
+ JSCell* cell = cellProfile.cell;
+
+ if (cellProfile.isConfirmedDead) {
+ dataLogF("FOUND dead cell %p in GC[%d] %s list '%s'\n",
+ cell, cycleIndex, collectionScopeName(cycle.scope), list.name);
+ return;
+ }
+
+ if (cell->isObject()) {
+ JSObject* object = static_cast<JSObject*>(cell);
+ Structure* structure = object->structure();
+ Butterfly* butterfly = object->butterfly();
+ void* butterflyBase = butterfly->base(structure);
+
+ dataLogF("FOUND object %p type '%s' butterfly %p (base %p) in GC[%d] %s list '%s'\n",
+ object, structure->classInfo()->className,
+ butterfly, butterflyBase,
+ cycleIndex, collectionScopeName(cycle.scope), list.name);
+ } else {
+ Structure* structure = cell->structure();
+ dataLogF("FOUND cell %p type '%s' in GC[%d] %s list '%s'\n",
+ cell, structure->classInfo()->className,
+ cycleIndex, collectionScopeName(cycle.scope), list.name);
+ }
+}
+
+void HeapVerifier::checkIfRecorded(JSCell* cell)
+{
+ bool found = false;
+
+ for (int cycleIndex = 0; cycleIndex > -m_numberOfCycles; cycleIndex--) {
+ GCCycle& cycle = cycleForIndex(cycleIndex);
+ CellList& beforeList = cycle.before;
+ CellList& afterList = cycle.after;
+
+ CellProfile* profile;
+ profile = ""
+ if (profile) {
+ reportCell(*profile, cycleIndex, cycle, beforeList);
+ found = true;
+ }
+ profile = ""
+ if (profile) {
+ reportCell(*profile, cycleIndex, cycle, afterList);
+ found = true;
+ }
+ }
+
+ if (!found)
+ dataLogF("cell %p NOT FOUND\n", cell);
+}
+
+} // namespace JSC
Copied: trunk/Source/_javascript_Core/tools/HeapVerifier.h (from rev 213674, trunk/Source/_javascript_Core/heap/HeapVerifier.h) (0 => 213675)
--- trunk/Source/_javascript_Core/tools/HeapVerifier.h (rev 0)
+++ trunk/Source/_javascript_Core/tools/HeapVerifier.h 2017-03-09 22:39:09 UTC (rev 213675)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CellList.h"
+#include "Heap.h"
+
+namespace JSC {
+
+class JSCell;
+class MarkedBlock;
+
+class HeapVerifier {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ enum class Phase {
+ BeforeGC,
+ BeforeMarking,
+ AfterMarking,
+ AfterGC
+ };
+
+ HeapVerifier(Heap*, unsigned numberOfGCCyclesToRecord);
+
+ void initializeGCCycle();
+ void gatherLiveCells(Phase);
+ void trimDeadCells();
+ void verify(Phase);
+
+ // Scans all previously recorded CellLists and checks if the specified
+ // cell was in any of those lists.
+ JS_EXPORT_PRIVATE void checkIfRecorded(JSCell*);
+
+ static const char* phaseName(Phase);
+
+private:
+ struct GCCycle {
+ GCCycle()
+ : before("Before Marking")
+ , after("After Marking")
+ {
+ }
+
+ CollectionScope scope;
+ CellList before;
+ CellList after;
+ };
+
+ void incrementCycle() { m_currentCycle = (m_currentCycle + 1) % m_numberOfCycles; }
+ GCCycle& currentCycle() { return m_cycles[m_currentCycle]; }
+ GCCycle& cycleForIndex(int cycleIndex)
+ {
+ ASSERT(cycleIndex <= 0 && cycleIndex > -m_numberOfCycles);
+ cycleIndex += m_currentCycle;
+ if (cycleIndex < 0)
+ cycleIndex += m_numberOfCycles;
+ ASSERT(cycleIndex < m_numberOfCycles);
+ return m_cycles[cycleIndex];
+ }
+
+ CellList* cellListForGathering(Phase);
+ bool verifyButterflyIsInStorageSpace(Phase, CellList&);
+
+ static void reportCell(CellProfile&, int cycleIndex, HeapVerifier::GCCycle&, CellList&);
+
+ Heap* m_heap;
+ int m_currentCycle;
+ int m_numberOfCycles;
+ std::unique_ptr<GCCycle[]> m_cycles;
+};
+
+} // namespace JSC