Changeset 243279 in webkit
- Timestamp:
- Mar 21, 2019, 12:00:24 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 deleted
- 11 edited
-
JavaScriptCore/CMakeLists.txt (modified) (1 diff)
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (modified) (8 diffs)
-
JavaScriptCore/Sources.txt (modified) (1 diff)
-
JavaScriptCore/runtime/JSSegmentedVariableObject.cpp (modified) (5 diffs)
-
JavaScriptCore/runtime/JSSegmentedVariableObject.h (modified) (4 diffs)
-
JavaScriptCore/runtime/JSSegmentedVariableObjectHeapCellType.cpp (deleted)
-
JavaScriptCore/runtime/JSSegmentedVariableObjectHeapCellType.h (deleted)
-
JavaScriptCore/runtime/StringIteratorPrototype.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/VM.cpp (modified) (3 diffs)
-
JavaScriptCore/runtime/VM.h (modified) (3 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/bindings/js/WebCoreJSClientData.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r243011 r243279 872 872 runtime/JSScriptFetcher.h 873 873 runtime/JSSegmentedVariableObject.h 874 runtime/JSSegmentedVariableObjectHeapCellType.h875 874 runtime/JSSet.h 876 875 runtime/JSSetIterator.h -
trunk/Source/JavaScriptCore/ChangeLog
r243278 r243279 1 2019-03-20 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Use finalizer in JSGlobalLexicalEnvironment and JSGlobalObject 4 https://bugs.webkit.org/show_bug.cgi?id=195992 5 6 Reviewed by Keith Miller and Mark Lam. 7 8 JSGlobalLexicalEnvironment and JSGlobalObject have their own CompleteSubspace to call destructors while they are not inheriting JSDestructibleObject. 9 But it is too costly since (1) it requires CompleteSubspace in VM, (2) both objects allocate MarkedBlocks while # of them are really small. 10 11 Instead of using CompleteSubspace, we just set finalizers for them. Since these objects are rarely allocated, setting finalizers does not show 12 memory / performance problems (actually, previously we used finalizer for ArrayPrototype due to the same reason, and it does not show any problems). 13 14 And we also add following two changes to JSSegmentedVariableObject. 15 16 1. Remove one boolean used for debugging in Release build. It enlarges sizeof(JSSegmentedVariableObject) and allocates one more MarkedBlock. 17 2. Use cellLock() instead. 18 19 * CMakeLists.txt: 20 * JavaScriptCore.xcodeproj/project.pbxproj: 21 * Sources.txt: 22 * runtime/JSSegmentedVariableObject.cpp: 23 (JSC::JSSegmentedVariableObject::findVariableIndex): 24 (JSC::JSSegmentedVariableObject::addVariables): 25 (JSC::JSSegmentedVariableObject::visitChildren): 26 (JSC::JSSegmentedVariableObject::~JSSegmentedVariableObject): 27 (JSC::JSSegmentedVariableObject::finishCreation): 28 * runtime/JSSegmentedVariableObject.h: 29 (JSC::JSSegmentedVariableObject::subspaceFor): Deleted. 30 * runtime/JSSegmentedVariableObjectHeapCellType.cpp: Removed. 31 * runtime/JSSegmentedVariableObjectHeapCellType.h: Removed. 32 * runtime/StringIteratorPrototype.cpp: 33 * runtime/VM.cpp: 34 (JSC::VM::VM): 35 * runtime/VM.h: 36 1 37 2019-03-20 Saam Barati <sbarati@apple.com> 2 38 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r243278 r243279 350 350 0F4F11EB209D426600709654 /* DFGAbstractValueClobberEpoch.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F11EA209D426300709654 /* DFGAbstractValueClobberEpoch.h */; }; 351 351 0F4F29E018B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F29DE18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h */; }; 352 0F4F82881E2FFDE00075184C /* JSSegmentedVariableObjectHeapCellType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F82861E2FFDDB0075184C /* JSSegmentedVariableObjectHeapCellType.h */; settings = {ATTRIBUTES = (Private, ); }; };353 352 0F4F828C1E31B9760075184C /* StochasticSpaceTimeMutatorScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4F828A1E31B9710075184C /* StochasticSpaceTimeMutatorScheduler.h */; }; 354 353 0F50AF3C193E8B3900674EE8 /* DFGStructureClobberState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F50AF3B193E8B3900674EE8 /* DFGStructureClobberState.h */; }; … … 2442 2441 0F4F29DD18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGStaticExecutionCountEstimationPhase.cpp; path = dfg/DFGStaticExecutionCountEstimationPhase.cpp; sourceTree = "<group>"; }; 2443 2442 0F4F29DE18B6AD1C0057BC15 /* DFGStaticExecutionCountEstimationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGStaticExecutionCountEstimationPhase.h; path = dfg/DFGStaticExecutionCountEstimationPhase.h; sourceTree = "<group>"; }; 2444 0F4F82851E2FFDDB0075184C /* JSSegmentedVariableObjectHeapCellType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSegmentedVariableObjectHeapCellType.cpp; sourceTree = "<group>"; };2445 0F4F82861E2FFDDB0075184C /* JSSegmentedVariableObjectHeapCellType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSegmentedVariableObjectHeapCellType.h; sourceTree = "<group>"; };2446 2443 0F4F82891E31B9710075184C /* StochasticSpaceTimeMutatorScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StochasticSpaceTimeMutatorScheduler.cpp; sourceTree = "<group>"; }; 2447 2444 0F4F828A1E31B9710075184C /* StochasticSpaceTimeMutatorScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StochasticSpaceTimeMutatorScheduler.h; sourceTree = "<group>"; }; … … 6997 6994 0F919D0E157F3327004A4E7D /* JSSegmentedVariableObject.cpp */, 6998 6995 0F919D0F157F3327004A4E7D /* JSSegmentedVariableObject.h */, 6999 0F4F82851E2FFDDB0075184C /* JSSegmentedVariableObjectHeapCellType.cpp */,7000 0F4F82861E2FFDDB0075184C /* JSSegmentedVariableObjectHeapCellType.h */,7001 6996 A7299D9B17D12837005F5FF9 /* JSSet.cpp */, 7002 6997 A7299D9C17D12837005F5FF9 /* JSSet.h */, … … 8506 8501 0F6B1CB91861244C00845D97 /* ArityCheckMode.h in Headers */, 8507 8502 A1A009C11831A26E00CF8711 /* ARM64Assembler.h in Headers */, 8503 FE1E2C402240DD6200F6B729 /* ARM64EAssembler.h in Headers */, 8508 8504 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */, 8509 8505 0F8335B81639C1EA001443B5 /* ArrayAllocationProfile.h in Headers */, … … 8547 8543 0FEC85011BDACDAC0080FF74 /* B3BasicBlock.h in Headers */, 8548 8544 0FEC85021BDACDAC0080FF74 /* B3BasicBlockInlines.h in Headers */, 8549 FE1E2C3F2240DD5800F6B729 /* MacroAssemblerARM64E.h in Headers */,8550 8545 0FEC85031BDACDAC0080FF74 /* B3BasicBlockUtils.h in Headers */, 8551 8546 0F338E1C1BF286EA0013C88F /* B3BlockInsertionSet.h in Headers */, … … 8627 8622 0F4570411BE584CA0062A629 /* B3TimingScope.h in Headers */, 8628 8623 0FEC853C1BDACDAC0080FF74 /* B3Type.h in Headers */, 8629 FE1E2C402240DD6200F6B729 /* ARM64EAssembler.h in Headers */,8630 8624 DCFDFBDA1D1F5D9E00FE3D72 /* B3TypeMap.h in Headers */, 8631 8625 0FEC853E1BDACDAC0080FF74 /* B3UpsilonValue.h in Headers */, … … 9405 9399 14D01A7721FB351F00BC54E9 /* JSScriptSourceProvider.h in Headers */, 9406 9400 0F919D11157F332C004A4E7D /* JSSegmentedVariableObject.h in Headers */, 9407 0F4F82881E2FFDE00075184C /* JSSegmentedVariableObjectHeapCellType.h in Headers */,9408 9401 A7299D9E17D12837005F5FF9 /* JSSet.h in Headers */, 9409 9402 A790DD70182F499700588807 /* JSSetIterator.h in Headers */, … … 9496 9489 86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */, 9497 9490 A1A009C01831A22D00CF8711 /* MacroAssemblerARM64.h in Headers */, 9491 FE1E2C3F2240DD5800F6B729 /* MacroAssemblerARM64E.h in Headers */, 9498 9492 86ADD1460FDDEA980006EEC2 /* MacroAssemblerARMv7.h in Headers */, 9499 9493 863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r243254 r243279 847 847 runtime/JSScriptFetchParameters.cpp 848 848 runtime/JSSegmentedVariableObject.cpp 849 runtime/JSSegmentedVariableObjectHeapCellType.cpp850 849 runtime/JSSet.cpp 851 850 runtime/JSSetIterator.cpp -
trunk/Source/JavaScriptCore/runtime/JSSegmentedVariableObject.cpp
r229362 r243279 39 39 ScopeOffset JSSegmentedVariableObject::findVariableIndex(void* variableAddress) 40 40 { 41 ConcurrentJSLocker locker(m_lock);41 auto locker = holdLock(cellLock()); 42 42 43 43 for (unsigned i = m_variables.size(); i--;) { … … 52 52 ScopeOffset JSSegmentedVariableObject::addVariables(unsigned numberOfVariablesToAdd, JSValue initialValue) 53 53 { 54 ConcurrentJSLocker locker(m_lock);54 auto locker = holdLock(cellLock()); 55 55 56 56 size_t oldSize = m_variables.size(); … … 71 71 // FIXME: We could avoid locking here if SegmentedVector was lock-free. It could be made lock-free 72 72 // relatively easily. 73 auto locker = holdLock(thisObject-> m_lock);73 auto locker = holdLock(thisObject->cellLock()); 74 74 for (unsigned i = thisObject->m_variables.size(); i--;) 75 75 slotVisitor.appendHidden(thisObject->m_variables[i]); … … 109 109 JSSegmentedVariableObject::~JSSegmentedVariableObject() 110 110 { 111 RELEASE_ASSERT(!m_alreadyDestroyed); 111 #ifndef NDEBUG 112 ASSERT(!m_alreadyDestroyed); 112 113 m_alreadyDestroyed = true; 114 #endif 113 115 } 114 116 … … 117 119 Base::finishCreation(vm); 118 120 setSymbolTable(vm, SymbolTable::create(vm)); 121 vm.heap.addFinalizer(this, [] (JSCell* cell) { 122 static_cast<JSSegmentedVariableObject*>(cell)->classInfo()->methodTable.destroy(cell); 123 }); 119 124 } 120 125 -
trunk/Source/JavaScriptCore/runtime/JSSegmentedVariableObject.h
r242100 r243279 48 48 // exact dimensions of the variables array at all times. 49 49 50 // Except for JSGlobalObject, subclasses of this don't call the destructor and leak memory.51 52 50 class JSSegmentedVariableObject : public JSSymbolTableObject { 53 51 friend class JIT; … … 58 56 59 57 DECLARE_INFO; 58 59 static const bool needsDestruction = true; 60 61 template<typename CellType, SubspaceAccess> 62 static CompleteSubspace* subspaceFor(VM& vm) 63 { 64 return &vm.cellSpace; 65 } 60 66 61 67 bool isValidScopeOffset(ScopeOffset offset) … … 91 97 static void destroy(JSCell*); 92 98 93 template<typename, SubspaceAccess>94 static CompleteSubspace* subspaceFor(VM& vm)95 {96 return &vm.segmentedVariableObjectSpace;97 }98 99 99 const ClassInfo* classInfo() const { return m_classInfo; } 100 100 … … 109 109 SegmentedVector<WriteBarrier<Unknown>, 16> m_variables; 110 110 const ClassInfo* m_classInfo; 111 ConcurrentJSLock m_lock; 111 #ifndef NDEBUG 112 112 bool m_alreadyDestroyed { false }; // We use these assertions to check that we aren't doing ancient hacks that result in this being destroyed more than once. 113 #endif 113 114 }; 114 115 -
trunk/Source/JavaScriptCore/runtime/StringIteratorPrototype.cpp
r242742 r243279 28 28 #include "StringIteratorPrototype.h" 29 29 30 #include "JSCBuiltins.h" 30 31 #include "JSCInlines.h" 31 32 #include "JSGlobalObject.h" -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r242742 r243279 92 92 #include "JSPromiseDeferred.h" 93 93 #include "JSPropertyNameEnumerator.h" 94 #include "JSSegmentedVariableObjectHeapCellType.h"95 94 #include "JSScriptFetchParameters.h" 96 95 #include "JSScriptFetcher.h" … … 275 274 , stringHeapCellType(std::make_unique<JSStringHeapCellType>()) 276 275 , destructibleObjectHeapCellType(std::make_unique<JSDestructibleObjectHeapCellType>()) 277 , segmentedVariableObjectHeapCellType(std::make_unique<JSSegmentedVariableObjectHeapCellType>())278 276 #if ENABLE(WEBASSEMBLY) 279 277 , webAssemblyCodeBlockHeapCellType(std::make_unique<JSWebAssemblyCodeBlockHeapCellType>()) … … 288 286 , destructibleObjectSpace("JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) 289 287 , eagerlySweptDestructibleObjectSpace("Eagerly Swept JSDestructibleObject", heap, destructibleObjectHeapCellType.get(), fastMallocAllocator.get()) 290 , segmentedVariableObjectSpace("JSSegmentedVariableObjectSpace", heap, segmentedVariableObjectHeapCellType.get(), fastMallocAllocator.get())291 288 , executableToCodeBlockEdgeSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), ExecutableToCodeBlockEdge) 292 289 , functionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSFunction) -
trunk/Source/JavaScriptCore/runtime/VM.h
r242742 r243279 124 124 class JSObject; 125 125 class JSRunLoopTimer; 126 class JSSegmentedVariableObjectHeapCellType;127 126 class JSStringHeapCellType; 128 127 class JSWebAssemblyCodeBlockHeapCellType; … … 330 329 std::unique_ptr<JSStringHeapCellType> stringHeapCellType; 331 330 std::unique_ptr<JSDestructibleObjectHeapCellType> destructibleObjectHeapCellType; 332 std::unique_ptr<JSSegmentedVariableObjectHeapCellType> segmentedVariableObjectHeapCellType;333 331 #if ENABLE(WEBASSEMBLY) 334 332 std::unique_ptr<JSWebAssemblyCodeBlockHeapCellType> webAssemblyCodeBlockHeapCellType; … … 366 364 CompleteSubspace destructibleObjectSpace; 367 365 CompleteSubspace eagerlySweptDestructibleObjectSpace; 368 CompleteSubspace segmentedVariableObjectSpace;369 366 370 367 IsoSubspace executableToCodeBlockEdgeSpace; -
trunk/Source/WebCore/ChangeLog
r243276 r243279 1 2019-03-20 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Use finalizer in JSGlobalLexicalEnvironment and JSGlobalObject 4 https://bugs.webkit.org/show_bug.cgi?id=195992 5 6 Reviewed by Keith Miller and Mark Lam. 7 8 Use cellHeapCellType since JSSegmentedVariableObject already set finalizer. 9 10 * bindings/js/WebCoreJSClientData.cpp: 11 (WebCore::JSVMClientData::JSVMClientData): 12 1 13 2019-03-20 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/Source/WebCore/bindings/js/WebCoreJSClientData.cpp
r230813 r243279 32 32 #include <JavaScriptCore/HeapInlines.h> 33 33 #include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> 34 #include <JavaScriptCore/JSSegmentedVariableObjectHeapCellType.h>35 34 #include <JavaScriptCore/MarkingConstraint.h> 36 35 #include <JavaScriptCore/SubspaceInlines.h> … … 47 46 , m_runtimeMethodSpace ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), RuntimeMethod) 48 47 , m_outputConstraintSpace("WebCore Wrapper w/ Output Constraint", vm.heap, vm.destructibleObjectHeapCellType.get(), vm.fastMallocAllocator.get()) 49 , m_globalObjectOutputConstraintSpace("WebCore Global Object w/ Output Constraint", vm.heap, vm. segmentedVariableObjectHeapCellType.get(), vm.fastMallocAllocator.get())48 , m_globalObjectOutputConstraintSpace("WebCore Global Object w/ Output Constraint", vm.heap, vm.cellHeapCellType.get(), vm.fastMallocAllocator.get()) 50 49 { 51 50 }
Note:
See TracChangeset
for help on using the changeset viewer.