Refactoring some HeapVerifier code.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2017 22:39:09 +0000 (22:39 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Mar 2017 22:39:09 +0000 (22:39 +0000)
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:
* JavaScriptCore.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/JavaScriptCore/heap/LiveObjectList.cpp.
(JSC::CellList::findCell):
(JSC::LiveObjectList::findObject): Deleted.
* tools/CellList.h: Copied from Source/JavaScriptCore/heap/LiveObjectList.h.
(JSC::CellList::CellList):
(JSC::CellList::reset):
(JSC::LiveObjectList::LiveObjectList): Deleted.
(JSC::LiveObjectList::reset): Deleted.
* tools/CellProfile.h: Copied from Source/JavaScriptCore/heap/LiveObjectData.h.
(JSC::CellProfile::CellProfile):
(JSC::LiveObjectData::LiveObjectData): Deleted.
* tools/HeapVerifier.cpp: Copied from Source/JavaScriptCore/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/JavaScriptCore/heap/HeapVerifier.h.

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

Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/tools/CellList.cpp [moved from Source/JavaScriptCore/heap/LiveObjectList.cpp with 85% similarity]
Source/JavaScriptCore/tools/CellList.h [moved from Source/JavaScriptCore/heap/LiveObjectList.h with 78% similarity]
Source/JavaScriptCore/tools/CellProfile.h [moved from Source/JavaScriptCore/heap/LiveObjectData.h with 87% similarity]
Source/JavaScriptCore/tools/HeapVerifier.cpp [moved from Source/JavaScriptCore/heap/HeapVerifier.cpp with 56% similarity]
Source/JavaScriptCore/tools/HeapVerifier.h [moved from Source/JavaScriptCore/heap/HeapVerifier.h with 81% similarity]

index af50c57..603dee9 100644 (file)
@@ -499,11 +499,9 @@ set(JavaScriptCore_SOURCES
     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 @@ set(JavaScriptCore_SOURCES
     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
index 209a95a..5e27fcc 100644 (file)
@@ -1,3 +1,59 @@
+2017-03-09  Mark Lam  <mark.lam@apple.com>
+
+        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:
+        * JavaScriptCore.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/JavaScriptCore/heap/LiveObjectList.cpp.
+        (JSC::CellList::findCell):
+        (JSC::LiveObjectList::findObject): Deleted.
+        * tools/CellList.h: Copied from Source/JavaScriptCore/heap/LiveObjectList.h.
+        (JSC::CellList::CellList):
+        (JSC::CellList::reset):
+        (JSC::LiveObjectList::LiveObjectList): Deleted.
+        (JSC::LiveObjectList::reset): Deleted.
+        * tools/CellProfile.h: Copied from Source/JavaScriptCore/heap/LiveObjectData.h.
+        (JSC::CellProfile::CellProfile):
+        (JSC::LiveObjectData::LiveObjectData): Deleted.
+        * tools/HeapVerifier.cpp: Copied from Source/JavaScriptCore/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/JavaScriptCore/heap/HeapVerifier.h.
+
 2017-03-09  Anders Carlsson  <andersca@apple.com>
 
         Add delegate support to WebCore
index 71173e2..b533001 100644 (file)
                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 */; };
                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 */; };
                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 */; };
                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>"; };
                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>"; };
                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>"; };
                                C2E526BB1590EF000054E48D /* HeapTimer.cpp */,
                                C2E526BC1590EF000054E48D /* HeapTimer.h */,
                                0FADE6721D4D23BC00768457 /* HeapUtil.h */,
-                               FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */,
-                               FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */,
                                C25F8BCB157544A900245B71 /* IncrementalSweeper.cpp */,
                                C25F8BCC157544A900245B71 /* IncrementalSweeper.h */,
                                0F766D2915A8CC34008F363E /* JITStubRoutineSet.cpp */,
                                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 */,
                8603CEF014C753EF00AE59E3 /* tools */ = {
                        isa = PBXGroup;
                        children = (
+                               FE1BD01B1E72002100134BC9 /* CellList.cpp */,
+                               FE1BD01C1E72002100134BC9 /* CellList.h */,
+                               FE1BD0201E72027000134BC9 /* CellProfile.h */,
                                86B5822E14D2373B00A9C306 /* CodeProfile.cpp */,
                                86B5822F14D2373B00A9C306 /* CodeProfile.h */,
                                8603CEF214C7546400AE59E3 /* CodeProfiling.cpp */,
                                FE4BFF2A1AD476E700088F87 /* FunctionOverrides.h */,
                                FEA0C4001CDD7D0E00481991 /* FunctionWhitelist.cpp */,
                                FEA0C4011CDD7D0E00481991 /* FunctionWhitelist.h */,
+                               FE1BD0221E72052F00134BC9 /* HeapVerifier.cpp */,
+                               FE1BD0231E72052F00134BC9 /* HeapVerifier.h */,
                                FE384EE11ADDB7AD0055DE2C /* JSDollarVM.cpp */,
                                FE384EE21ADDB7AD0055DE2C /* JSDollarVM.h */,
                                FE384EE31ADDB7AD0055DE2C /* JSDollarVMPrototype.cpp */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
index e0d69e9..7483f11 100644 (file)
@@ -1103,7 +1103,7 @@ NEVER_INLINE bool Heap::runBeginPhase(GCConductor conn)
         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 @@ NEVER_INLINE bool Heap::runEndPhase(GCConductor conn)
     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 @@ NEVER_INLINE bool Heap::runEndPhase(GCConductor conn)
     didFinishCollection();
     
     if (m_verifier) {
-        m_verifier->trimDeadObjects();
+        m_verifier->trimDeadCells();
         m_verifier->verify(HeapVerifier::Phase::AfterGC);
     }
 
similarity index 85%
rename from Source/JavaScriptCore/heap/LiveObjectList.cpp
rename to Source/JavaScriptCore/tools/CellList.cpp
index 5eb7cb9..c49f7da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * 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
  */
 
 #include "config.h"
-#include "LiveObjectList.h"
+#include "CellList.h"
 
 namespace JSC {
 
-LiveObjectData* LiveObjectList::findObject(JSObject* obj)
+CellProfile* CellList::findCell(JSCell* cell)
 {
-    for (auto& data : liveObjects) {
-        if (obj == data.obj)
-            return &data;
+    for (auto& profile : liveCells) {
+        if (cell == profile.cell)
+            return &profile;
     }
     return nullptr;
 }
similarity index 78%
rename from Source/JavaScriptCore/heap/LiveObjectList.h
rename to Source/JavaScriptCore/tools/CellList.h
index c40fd3a..0e36762 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * 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
 
 #pragma once
 
-#include "LiveObjectData.h"
+#include "CellProfile.h"
 #include <wtf/Vector.h>
 
 namespace JSC {
 
-struct LiveObjectList {
-    LiveObjectList(const char* name)
+struct CellList {
+    CellList(const char* name)
         : name(name)
-        , hasLiveObjects(true)
+        , hasLiveCells(true)
     {
     }
     
     void reset()
     {
-        liveObjects.clear();
-        hasLiveObjects = true; // Presume to have live objects until the list is trimmed.
+        liveCells.clear();
+        hasLiveCells = true; // Presume to have live objects until the list is trimmed.
     }
     
-    LiveObjectData* findObject(JSObject*);
+    CellProfile* findCell(JSCell*);
     
     const char* name;
-    Vector<LiveObjectData> liveObjects;
-    bool hasLiveObjects;
+    Vector<CellProfile> liveCells;
+    bool hasLiveCells;
 };
     
 } // namespace JSC
similarity index 87%
rename from Source/JavaScriptCore/heap/LiveObjectData.h
rename to Source/JavaScriptCore/tools/CellProfile.h
index 6fb7197..48720ed 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * 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
 
 namespace JSC {
 
-class JSObject;
+class JSCell;
 
-struct LiveObjectData {
-    LiveObjectData(JSObject* obj, bool isConfirmedDead = false)
-        : obj(obj)
+struct CellProfile {
+    CellProfile(JSCell* cell, bool isConfirmedDead = false)
+        : cell(cell)
         , isConfirmedDead(isConfirmedDead)
     {
     }
     
-    JSObject* obj;
+    JSCell* cell;
     bool isConfirmedDead;
 };
 
similarity index 56%
rename from Source/JavaScriptCore/heap/HeapVerifier.cpp
rename to Source/JavaScriptCore/tools/HeapVerifier.cpp
index fada794..3959e95 100644 (file)
@@ -66,19 +66,17 @@ void HeapVerifier::initializeGCCycle()
     currentCycle().scope = *heap->collectionScope();
 }
 
-struct GatherLiveObjFunctor : MarkedBlock::CountFunctor {
-    GatherLiveObjFunctor(LiveObjectList& list)
+struct GatherCellFunctor : MarkedBlock::CountFunctor {
+    GatherCellFunctor(CellList& list)
         : m_list(list)
     {
-        ASSERT(!list.liveObjects.size());
+        ASSERT(!list.liveCells.size());
     }
 
     inline void visit(JSCell* cell)
     {
-        if (!cell->isObject())
-            return;        
-        LiveObjectData data(asObject(cell));
-        m_list.liveObjects.append(data);
+        CellProfile profile(cell);
+        m_list.liveCells.append(profile);
     }
 
     IterationStatus operator()(HeapCell* cell, HeapCell::Kind kind) const
@@ -86,26 +84,26 @@ struct GatherLiveObjFunctor : MarkedBlock::CountFunctor {
         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));
+            const_cast<GatherCellFunctor*>(this)->visit(static_cast<JSCell*>(cell));
         }
         return IterationStatus::Continue;
     }
 
-    LiveObjectList& m_list;
+    CellList& m_list;
 };
 
-void HeapVerifier::gatherLiveObjects(HeapVerifier::Phase phase)
+void HeapVerifier::gatherLiveCells(HeapVerifier::Phase phase)
 {
     Heap* heap = m_heap;
-    LiveObjectList& list = *liveObjectListForGathering(phase);
+    CellList& list = *cellListForGathering(phase);
 
     HeapIterationScope iterationScope(*heap);
     list.reset();
-    GatherLiveObjFunctor functor(list);
+    GatherCellFunctor functor(list);
     heap->m_objectSpace.forEachLiveCell(iterationScope, functor);
 }
 
-LiveObjectList* HeapVerifier::liveObjectListForGathering(HeapVerifier::Phase phase)
+CellList* HeapVerifier::cellListForGathering(HeapVerifier::Phase phase)
 {
     switch (phase) {
     case Phase::BeforeMarking:
@@ -114,48 +112,48 @@ LiveObjectList* HeapVerifier::liveObjectListForGathering(HeapVerifier::Phase pha
         return &currentCycle().after;
     case Phase::BeforeGC:
     case Phase::AfterGC:
-        // We should not be gathering live objects during these phases.
+        // We should not be gathering live cells during these phases.
         break;
     }
     RELEASE_ASSERT_NOT_REACHED();
     return nullptr; // Silencing a compiler warning.
 }
 
-static void trimDeadObjectsFromList(HashSet<JSObject*>& knownLiveSet, LiveObjectList& list)
+static void trimDeadCellsFromList(HashSet<JSCell*>& knownLiveSet, CellList& list)
 {
-    if (!list.hasLiveObjects)
+    if (!list.hasLiveCells)
         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;
+    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;
         }
-        liveObjectsFound++;
+        liveCellsFound++;
     }
-    list.hasLiveObjects = !!liveObjectsFound;
+    list.hasLiveCells = !!liveCellsFound;
 }
 
-void HeapVerifier::trimDeadObjects()
+void HeapVerifier::trimDeadCells()
 {
-    HashSet<JSObject*> knownLiveSet;
+    HashSet<JSCell*> knownLiveSet;
 
-    LiveObjectList& after = currentCycle().after;
-    for (auto& objData : after.liveObjects)
-        knownLiveSet.add(objData.obj);
+    CellList& after = currentCycle().after;
+    for (auto& cellProfile : after.liveCells)
+        knownLiveSet.add(cellProfile.cell);
 
-    trimDeadObjectsFromList(knownLiveSet, currentCycle().before);
+    trimDeadCellsFromList(knownLiveSet, currentCycle().before);
 
     for (int i = -1; i > -m_numberOfCycles; i--) {
-        trimDeadObjectsFromList(knownLiveSet, cycleForIndex(i).before);
-        trimDeadObjectsFromList(knownLiveSet, cycleForIndex(i).after);
+        trimDeadCellsFromList(knownLiveSet, cycleForIndex(i).before);
+        trimDeadCellsFromList(knownLiveSet, cycleForIndex(i).after);
     }
 }
 
-bool HeapVerifier::verifyButterflyIsInStorageSpace(Phase, LiveObjectList&)
+bool HeapVerifier::verifyButterflyIsInStorageSpace(Phase, CellList&)
 {
     // FIXME: Make this work again. https://bugs.webkit.org/show_bug.cgi?id=161752
     return true;
@@ -168,50 +166,58 @@ void HeapVerifier::verify(HeapVerifier::Phase phase)
     RELEASE_ASSERT(beforeVerified && afterVerified);
 }
 
-void HeapVerifier::reportObject(LiveObjectData& objData, int cycleIndex, HeapVerifier::GCCycle& cycle, LiveObjectList& list)
+void HeapVerifier::reportCell(CellProfile& cellProfile, int cycleIndex, HeapVerifier::GCCycle& cycle, CellList& list)
 {
-    JSObject* obj = objData.obj;
+    JSCell* cell = cellProfile.cell;
 
-    if (objData.isConfirmedDead) {
-        dataLogF("FOUND dead obj %p in GC[%d] %s list '%s'\n",
-            obj, cycleIndex, collectionScopeName(cycle.scope), list.name);
+    if (cellProfile.isConfirmedDead) {
+        dataLogF("FOUND dead cell %p in GC[%d] %s list '%s'\n",
+            cell, 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);
+    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(JSObject* obj)
+void HeapVerifier::checkIfRecorded(JSCell* cell)
 {
     bool found = false;
 
     for (int cycleIndex = 0; cycleIndex > -m_numberOfCycles; cycleIndex--) {
         GCCycle& cycle = cycleForIndex(cycleIndex);
-        LiveObjectList& beforeList = cycle.before; 
-        LiveObjectList& afterList = cycle.after; 
+        CellList& beforeList = cycle.before;
+        CellList& afterList = cycle.after;
 
-        LiveObjectData* objData;
-        objData = beforeList.findObject(obj);
-        if (objData) {
-            reportObject(*objData, cycleIndex, cycle, beforeList);
+        CellProfile* profile;
+        profile = beforeList.findCell(cell);
+        if (profile) {
+            reportCell(*profile, cycleIndex, cycle, beforeList);
             found = true;
         }
-        objData = afterList.findObject(obj);
-        if (objData) {
-            reportObject(*objData, cycleIndex, cycle, afterList);
+        profile = afterList.findCell(cell);
+        if (profile) {
+            reportCell(*profile, cycleIndex, cycle, afterList);
             found = true;
         }
     }
 
     if (!found)
-        dataLogF("obj %p NOT FOUND\n", obj);
+        dataLogF("cell %p NOT FOUND\n", cell);
 }
 
 } // namespace JSC
similarity index 81%
rename from Source/JavaScriptCore/heap/HeapVerifier.h
rename to Source/JavaScriptCore/tools/HeapVerifier.h
index d736b47..35f243e 100644 (file)
 
 #pragma once
 
+#include "CellList.h"
 #include "Heap.h"
-#include "LiveObjectList.h"
 
 namespace JSC {
 
-class JSObject;
+class JSCell;
 class MarkedBlock;
 
 class HeapVerifier {
@@ -46,13 +46,13 @@ public:
     HeapVerifier(Heap*, unsigned numberOfGCCyclesToRecord);
 
     void initializeGCCycle();
-    void gatherLiveObjects(Phase);
-    void trimDeadObjects();
+    void gatherLiveCells(Phase);
+    void trimDeadCells();
     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*);
+    // 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);
 
@@ -65,8 +65,8 @@ private:
         }
 
         CollectionScope scope;
-        LiveObjectList before;
-        LiveObjectList after;
+        CellList before;
+        CellList after;
     };
 
     void incrementCycle() { m_currentCycle = (m_currentCycle + 1) % m_numberOfCycles; }
@@ -81,10 +81,10 @@ private:
         return m_cycles[cycleIndex];
     }
 
-    LiveObjectList* liveObjectListForGathering(Phase);
-    bool verifyButterflyIsInStorageSpace(Phase, LiveObjectList&);
+    CellList* cellListForGathering(Phase);
+    bool verifyButterflyIsInStorageSpace(Phase, CellList&);
 
-    static void reportObject(LiveObjectData&, int cycleIndex, HeapVerifier::GCCycle&, LiveObjectList&);
+    static void reportCell(CellProfile&, int cycleIndex, HeapVerifier::GCCycle&, CellList&);
 
     Heap* m_heap;
     int m_currentCycle;