Changeset 242742 in webkit
- Timestamp:
- Mar 11, 2019, 2:55:00 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
-
JavaScriptCore/CMakeLists.txt (modified) (2 diffs)
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/DerivedSources-output.xcfilelist (modified) (2 diffs)
-
JavaScriptCore/DerivedSources.make (modified) (2 diffs)
-
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (modified) (7 diffs)
-
JavaScriptCore/runtime/ArrayIteratorPrototype.cpp (modified) (2 diffs)
-
JavaScriptCore/runtime/ArrayPrototype.cpp (modified) (3 diffs)
-
JavaScriptCore/runtime/ClonedArguments.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/JSGlobalObject.cpp (modified) (2 diffs)
-
JavaScriptCore/runtime/JSGlobalObject.h (modified) (1 diff)
-
JavaScriptCore/runtime/MapIteratorPrototype.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/NullGetterFunction.h (modified) (1 diff)
-
JavaScriptCore/runtime/NullSetterFunction.h (modified) (1 diff)
-
JavaScriptCore/runtime/StringIteratorPrototype.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/VM.cpp (modified) (2 diffs)
-
JavaScriptCore/runtime/VM.h (modified) (3 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/bindings/js/SerializedScriptValue.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r242699 r242742 60 60 set(JavaScriptCore_OBJECT_LUT_SOURCES 61 61 runtime/ArrayConstructor.cpp 62 runtime/ArrayIteratorPrototype.cpp63 62 runtime/AsyncFromSyncIteratorPrototype.cpp 64 63 runtime/AsyncGeneratorPrototype.cpp … … 96 95 runtime/SetPrototype.cpp 97 96 runtime/StringConstructor.cpp 98 runtime/StringIteratorPrototype.cpp99 97 runtime/StringPrototype.cpp 100 98 runtime/SymbolConstructor.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r242722 r242742 1 2019-03-11 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Reduce # of structures in JSGlobalObject initialization 4 https://bugs.webkit.org/show_bug.cgi?id=195498 5 6 Reviewed by Darin Adler. 7 8 This patch reduces # of structure allocations in JSGlobalObject initialization. Now it becomes 141, it fits in one 9 MarkedBlock and this patch drops one MarkedBlock used for Structure previously. 10 11 * CMakeLists.txt: 12 * DerivedSources-output.xcfilelist: 13 * DerivedSources.make: 14 * JavaScriptCore.xcodeproj/project.pbxproj: 15 * runtime/ArrayIteratorPrototype.cpp: 16 (JSC::ArrayIteratorPrototype::finishCreation): ArrayIteratorPrototype, MapIteratorPrototype, and StringIteratorPrototype's 17 "next" properties are referenced by JSGlobalObject::init, and it causes reification of the lazy "next" property and structure 18 transition anyway. So we should put it eagerly "without-transition" configuration to avoid one structure transition. 19 20 * runtime/ArrayPrototype.cpp: 21 (JSC::ArrayPrototype::finishCreation): @@unscopable object's structure should be dictionary because (1) it is used as a dictionary 22 in with-scope-resolution and (2) since with-scope-resolution is C++ runtime function anyway, non-dictionary structure does not add 23 any performance benefit. This change saves several structures that are not useful. 24 25 * runtime/ClonedArguments.cpp: 26 (JSC::ClonedArguments::createStructure): Bake CloneArguments's structure with 'without-transition' manner. 27 28 * runtime/JSGlobalObject.cpp: 29 (JSC::JSGlobalObject::init): Previously we are always call resetProtoype at the end of JSGlobalObject::init. But it is not necessary 30 since we do not change [[Prototype]] of JSGlobalObject. All we want is (1) fixupPrototypeChainWithObjectPrototype's operation and (2) setGlobalThis 31 operation. Since setGlobalThis part is done in JSGlobalObject::finishCreation, fixupPrototypeChainWithObjectPrototype is only the thing 32 we should do here. 33 34 (JSC::JSGlobalObject::fixupPrototypeChainWithObjectPrototype): 35 (JSC::JSGlobalObject::resetPrototype): If the [[Prototype]] is the same to the current [[Prototype]], we can skip the operation. 36 37 * runtime/JSGlobalObject.h: 38 * runtime/MapIteratorPrototype.cpp: 39 (JSC::MapIteratorPrototype::finishCreation): 40 * runtime/NullGetterFunction.h: 41 * runtime/NullSetterFunction.h: Since structures of them are allocated per JSGlobalObject and they are per-JSGlobalObject, 42 we can use without-transition property addition. 43 44 * runtime/StringIteratorPrototype.cpp: 45 (JSC::StringIteratorPrototype::finishCreation): 46 * runtime/VM.cpp: 47 (JSC::VM::VM): 48 (JSC::VM::setIteratorStructureSlow): 49 (JSC::VM::mapIteratorStructureSlow): These structures are only used in WebCore's main thread. 50 * runtime/VM.h: 51 (JSC::VM::setIteratorStructure): 52 (JSC::VM::mapIteratorStructure): 53 1 54 2019-03-08 Yusuke Suzuki <ysuzuki@apple.com> 2 55 -
trunk/Source/JavaScriptCore/DerivedSources-output.xcfilelist
r241660 r242742 4 4 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/AirOpcodeUtils.h 5 5 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/ArrayConstructor.lut.h 6 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/ArrayIteratorPrototype.lut.h7 6 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/AsyncFromSyncIteratorPrototype.lut.h 8 7 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/AsyncGeneratorPrototype.lut.h … … 53 52 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/SetPrototype.lut.h 54 53 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/StringConstructor.lut.h 55 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/StringIteratorPrototype.lut.h56 54 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/StringPrototype.lut.h 57 55 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/SymbolConstructor.lut.h -
trunk/Source/JavaScriptCore/DerivedSources.make
r242047 r242742 136 136 AsyncFromSyncIteratorPrototype.lut.h \ 137 137 ArrayConstructor.lut.h \ 138 ArrayIteratorPrototype.lut.h \139 138 AsyncGeneratorPrototype.lut.h \ 140 139 BigIntConstructor.lut.h \ … … 170 169 SetPrototype.lut.h \ 171 170 StringConstructor.lut.h \ 172 StringIteratorPrototype.lut.h \173 171 StringPrototype.lut.h \ 174 172 SymbolConstructor.lut.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r242699 r242742 1287 1287 996231E918D1804200C03FDA /* InspectorBackendCommands.js in Headers */ = {isa = PBXBuildFile; fileRef = A53243961856A475002ED692 /* InspectorBackendCommands.js */; settings = {ATTRIBUTES = (Private, ); }; }; 1288 1288 996B73171BDA067F00331B84 /* ArrayConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73151BDA05AA00331B84 /* ArrayConstructor.lut.h */; }; 1289 996B73181BDA068000331B84 /* ArrayIteratorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73161BDA05AA00331B84 /* ArrayIteratorPrototype.lut.h */; };1290 1289 996B73191BDA068000331B84 /* BooleanPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73071BD9FA2C00331B84 /* BooleanPrototype.lut.h */; }; 1291 1290 996B731A1BDA08D100331B84 /* DateConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73081BD9FA2C00331B84 /* DateConstructor.lut.h */; }; … … 1300 1299 996B73231BDA08EF00331B84 /* ReflectObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */; }; 1301 1300 996B73251BDA08EF00331B84 /* StringConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73111BD9FA2C00331B84 /* StringConstructor.lut.h */; }; 1302 996B73261BDA08EF00331B84 /* StringIteratorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73121BD9FA2C00331B84 /* StringIteratorPrototype.lut.h */; };1303 1301 996B73271BDA08EF00331B84 /* SymbolConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73131BD9FA2C00331B84 /* SymbolConstructor.lut.h */; }; 1304 1302 996B73281BDA08EF00331B84 /* SymbolPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */; }; … … 4031 4029 996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReflectObject.lut.h; sourceTree = "<group>"; }; 4032 4030 996B73111BD9FA2C00331B84 /* StringConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringConstructor.lut.h; sourceTree = "<group>"; }; 4033 996B73121BD9FA2C00331B84 /* StringIteratorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringIteratorPrototype.lut.h; sourceTree = "<group>"; };4034 4031 996B73131BD9FA2C00331B84 /* SymbolConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolConstructor.lut.h; sourceTree = "<group>"; }; 4035 4032 996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolPrototype.lut.h; sourceTree = "<group>"; }; 4036 4033 996B73151BDA05AA00331B84 /* ArrayConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayConstructor.lut.h; sourceTree = "<group>"; }; 4037 996B73161BDA05AA00331B84 /* ArrayIteratorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayIteratorPrototype.lut.h; sourceTree = "<group>"; };4038 4034 998ED6721BED659A00DD8017 /* RemoteControllableTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteControllableTarget.cpp; sourceTree = "<group>"; }; 4039 4035 998ED6731BED659A00DD8017 /* RemoteControllableTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteControllableTarget.h; sourceTree = "<group>"; }; … … 6365 6361 0F6183351C45F3B60072450B /* AirOpcodeUtils.h */, 6366 6362 996B73151BDA05AA00331B84 /* ArrayConstructor.lut.h */, 6367 996B73161BDA05AA00331B84 /* ArrayIteratorPrototype.lut.h */,6368 6363 E3893A1C2203A7C600E79A74 /* AsyncFromSyncIteratorPrototype.lut.h */, 6369 6364 8B3BF5E31E3D365A0076A87A /* AsyncGeneratorPrototype.lut.h */, … … 6407 6402 7035587F1C418458004BD7BF /* SetPrototype.lut.h */, 6408 6403 996B73111BD9FA2C00331B84 /* StringConstructor.lut.h */, 6409 996B73121BD9FA2C00331B84 /* StringIteratorPrototype.lut.h */,6410 6404 996B73131BD9FA2C00331B84 /* SymbolConstructor.lut.h */, 6411 6405 996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */, … … 8490 8484 0FB7F39515ED8E4600F167B2 /* ArrayConventions.h in Headers */, 8491 8485 A7BDAEC917F4EA1400F6140C /* ArrayIteratorPrototype.h in Headers */, 8492 996B73181BDA068000331B84 /* ArrayIteratorPrototype.lut.h in Headers */,8493 8486 0F63945515D07057006A597C /* ArrayProfile.h in Headers */, 8494 8487 BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */, … … 9703 9696 996B73251BDA08EF00331B84 /* StringConstructor.lut.h in Headers */, 9704 9697 70EC0EC71AA0D7DA00B6AAFA /* StringIteratorPrototype.h in Headers */, 9705 996B73261BDA08EF00331B84 /* StringIteratorPrototype.lut.h in Headers */,9706 9698 BC18C4680E16F5CD00B34460 /* StringObject.h in Headers */, 9707 9699 BC18C46A0E16F5CD00B34460 /* StringPrototype.h in Headers */, -
trunk/Source/JavaScriptCore/runtime/ArrayIteratorPrototype.cpp
r223027 r242742 27 27 #include "ArrayIteratorPrototype.h" 28 28 29 #include "ArrayIteratorPrototype.lut.h"30 29 #include "IteratorOperations.h" 31 30 #include "JSCInlines.h" … … 38 37 namespace JSC { 39 38 40 const ClassInfo ArrayIteratorPrototype::s_info = { "Array Iterator", &Base::s_info, &arrayIteratorPrototypeTable, nullptr, CREATE_METHOD_TABLE(ArrayIteratorPrototype) };39 const ClassInfo ArrayIteratorPrototype::s_info = { "Array Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ArrayIteratorPrototype) }; 41 40 42 /* Source for ArrayIteratorPrototype.lut.h 43 @begin arrayIteratorPrototypeTable 44 next JSBuiltin DontEnum|Function 0 45 @end 46 */ 47 48 void ArrayIteratorPrototype::finishCreation(VM& vm, JSGlobalObject*) 41 void ArrayIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) 49 42 { 50 43 Base::finishCreation(vm); 51 44 ASSERT(inherits(vm, info())); 52 45 putDirectWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "Array Iterator"), PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly); 46 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, arrayIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 53 47 didBecomePrototype(); 54 48 } -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r242081 r242742 90 90 91 91 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->toLocaleString, arrayProtoFuncToLocaleString, static_cast<unsigned>(PropertyAttribute::DontEnum), 0); 92 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "concat", arrayPrototypeConcatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));93 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "fill", arrayPrototypeFillCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));92 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().concatPublicName(), arrayPrototypeConcatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 93 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().fillPublicName(), arrayPrototypeFillCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 94 94 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->join, arrayProtoFuncJoin, static_cast<unsigned>(PropertyAttribute::DontEnum), 1); 95 95 JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION("pop", arrayProtoFuncPop, static_cast<unsigned>(PropertyAttribute::DontEnum), 0, ArrayPopIntrinsic); … … 100 100 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().shiftPrivateName(), arrayProtoFuncShift, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly, 0); 101 101 JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->slice, arrayProtoFuncSlice, static_cast<unsigned>(PropertyAttribute::DontEnum), 2, ArraySliceIntrinsic); 102 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "sort", arrayPrototypeSortCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));102 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().sortPublicName(), arrayPrototypeSortCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 103 103 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("splice", arrayProtoFuncSplice, static_cast<unsigned>(PropertyAttribute::DontEnum), 2); 104 104 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("unshift", arrayProtoFuncUnShift, static_cast<unsigned>(PropertyAttribute::DontEnum), 1); 105 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "every", arrayPrototypeEveryCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));106 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "forEach", arrayPrototypeForEachCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));107 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "some", arrayPrototypeSomeCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));105 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().everyPublicName(), arrayPrototypeEveryCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 106 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().forEachPublicName(), arrayPrototypeForEachCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 107 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().somePublicName(), arrayPrototypeSomeCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 108 108 JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION("indexOf", arrayProtoFuncIndexOf, static_cast<unsigned>(PropertyAttribute::DontEnum), 1, ArrayIndexOfIntrinsic); 109 109 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("lastIndexOf", arrayProtoFuncLastIndexOf, static_cast<unsigned>(PropertyAttribute::DontEnum), 1); 110 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "filter", arrayPrototypeFilterCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));111 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "flat", arrayPrototypeFlatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));112 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "flatMap", arrayPrototypeFlatMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));113 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "reduce", arrayPrototypeReduceCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));114 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "reduceRight", arrayPrototypeReduceRightCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));115 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "map", arrayPrototypeMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));110 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().filterPublicName(), arrayPrototypeFilterCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 111 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().flatPublicName(), arrayPrototypeFlatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 112 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().flatMapPublicName(), arrayPrototypeFlatMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 113 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().reducePublicName(), arrayPrototypeReduceCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 114 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().reduceRightPublicName(), arrayPrototypeReduceRightCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 115 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().mapPublicName(), arrayPrototypeMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 116 116 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().entriesPublicName(), arrayPrototypeEntriesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 117 117 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().keysPublicName(), arrayPrototypeKeysCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 118 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "find", arrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));119 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "findIndex", arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));120 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "includes", arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));121 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION( "copyWithin", arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));118 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findPublicName(), arrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 119 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findIndexPublicName(), arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 120 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().includesPublicName(), arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 121 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().copyWithinPublicName(), arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 122 122 123 123 putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().entriesPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly)); … … 127 127 128 128 JSObject* unscopables = constructEmptyObject(globalObject->globalExec(), globalObject->nullPrototypeObjectStructure()); 129 const char* unscopableNames[] = { 130 "copyWithin", 131 "entries", 132 "fill", 133 "find", 134 "findIndex", 135 "includes", 136 "keys", 137 "values" 129 unscopables->convertToDictionary(vm); 130 const Identifier* const unscopableNames[] = { 131 &vm.propertyNames->builtinNames().copyWithinPublicName(), 132 &vm.propertyNames->builtinNames().entriesPublicName(), 133 &vm.propertyNames->builtinNames().fillPublicName(), 134 &vm.propertyNames->builtinNames().findPublicName(), 135 &vm.propertyNames->builtinNames().findIndexPublicName(), 136 &vm.propertyNames->builtinNames().includesPublicName(), 137 &vm.propertyNames->builtinNames().keysPublicName(), 138 &vm.propertyNames->builtinNames().valuesPublicName() 138 139 }; 139 for (const char* unscopableName : unscopableNames)140 unscopables->putDirect(vm, Identifier::fromString(&vm, unscopableName), jsBoolean(true));140 for (const auto* unscopableName : unscopableNames) 141 unscopables->putDirect(vm, *unscopableName, jsBoolean(true)); 141 142 putDirectWithoutTransition(vm, vm.propertyNames->unscopablesSymbol, unscopables, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly); 142 143 } -
trunk/Source/JavaScriptCore/runtime/ClonedArguments.cpp
r232337 r242742 152 152 { 153 153 Structure* structure = Structure::create(vm, globalObject, prototype, TypeInfo(ClonedArgumentsType, StructureFlags), info(), indexingType); 154 PropertyOffset offset; 155 structure = structure->addPropertyTransition(vm, structure, vm.propertyNames->length, static_cast<unsigned>(PropertyAttribute::DontEnum), offset); 156 ASSERT(offset == clonedArgumentsLengthPropertyOffset); 154 structure->addPropertyWithoutTransition( 155 vm, vm.propertyNames->length, static_cast<unsigned>(PropertyAttribute::DontEnum), 156 [&] (const GCSafeConcurrentJSLocker&, PropertyOffset offset, PropertyOffset newLastOffset) { 157 RELEASE_ASSERT(offset == clonedArgumentsLengthPropertyOffset); 158 structure->setLastOffset(newLastOffset); 159 }); 157 160 return structure; 158 161 } -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r242650 r242742 1161 1161 } 1162 1162 1163 resetPrototype(vm, getPrototypeDirect(vm));1163 fixupPrototypeChainWithObjectPrototype(vm); 1164 1164 } 1165 1165 … … 1586 1586 } 1587 1587 1588 // Set prototype, and also insert the object prototype at the end of the chain. 1589 void JSGlobalObject::resetPrototype(VM& vm, JSValue prototype) 1590 { 1591 setPrototypeDirect(vm, prototype); 1592 1588 void JSGlobalObject::fixupPrototypeChainWithObjectPrototype(VM& vm) 1589 { 1593 1590 JSObject* oldLastInPrototypeChain = lastInPrototypeChain(vm, this); 1594 1591 JSObject* objectPrototype = m_objectPrototype.get(); 1595 1592 if (oldLastInPrototypeChain != objectPrototype) 1596 1593 oldLastInPrototypeChain->setPrototypeDirect(vm, objectPrototype); 1597 1594 } 1595 1596 // Set prototype, and also insert the object prototype at the end of the chain. 1597 void JSGlobalObject::resetPrototype(VM& vm, JSValue prototype) 1598 { 1599 if (getPrototypeDirect(vm) == prototype) 1600 return; 1601 setPrototypeDirect(vm, prototype); 1602 fixupPrototypeChainWithObjectPrototype(vm); 1598 1603 // Whenever we change the prototype of the global object, we need to create a new JSProxy with the correct prototype. 1599 1604 setGlobalThis(vm, JSNonDestructibleProxy::create(vm, JSNonDestructibleProxy::createStructure(vm, this, prototype, PureForwardingProxyType), this)); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r242636 r242742 1036 1036 1037 1037 JS_EXPORT_PRIVATE void init(VM&); 1038 void fixupPrototypeChainWithObjectPrototype(VM&); 1038 1039 1039 1040 JS_EXPORT_PRIVATE static void clearRareData(JSCell*); -
trunk/Source/JavaScriptCore/runtime/MapIteratorPrototype.cpp
r223027 r242742 40 40 didBecomePrototype(); 41 41 42 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("next", mapIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));43 42 putDirectWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "Map Iterator"), PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly); 43 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, mapIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 44 44 } 45 45 -
trunk/Source/JavaScriptCore/runtime/NullGetterFunction.h
r242650 r242742 38 38 // Since NullGetterFunction is per JSGlobalObject, we use put-without-transition in InternalFunction::finishCreation. 39 39 NullGetterFunction* function = new (NotNull, allocateCell< NullGetterFunction>(vm.heap)) NullGetterFunction(vm, structure); 40 function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::With StructureTransition);40 function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 41 41 return function; 42 42 } -
trunk/Source/JavaScriptCore/runtime/NullSetterFunction.h
r242650 r242742 38 38 // Since NullSetterFunction is per JSGlobalObject, we use put-without-transition in InternalFunction::finishCreation. 39 39 NullSetterFunction* function = new (NotNull, allocateCell< NullSetterFunction>(vm.heap)) NullSetterFunction(vm, structure); 40 function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::With StructureTransition);40 function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 41 41 return function; 42 42 } -
trunk/Source/JavaScriptCore/runtime/StringIteratorPrototype.cpp
r223027 r242742 33 33 #include "ObjectConstructor.h" 34 34 35 #include "StringIteratorPrototype.lut.h"36 37 35 namespace JSC { 38 36 39 const ClassInfo StringIteratorPrototype::s_info = { "String Iterator", &Base::s_info, &stringIteratorPrototypeTable, nullptr, CREATE_METHOD_TABLE(StringIteratorPrototype) };37 const ClassInfo StringIteratorPrototype::s_info = { "String Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(StringIteratorPrototype) }; 40 38 41 /* Source for StringIteratorPrototype.lut.h 42 @begin stringIteratorPrototypeTable 43 next JSBuiltin DontEnum|Function 0 44 @end 45 */ 46 47 void StringIteratorPrototype::finishCreation(VM& vm, JSGlobalObject*) 39 void StringIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) 48 40 { 49 41 Base::finishCreation(vm); 50 42 ASSERT(inherits(vm, info())); 51 43 putDirectWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "String Iterator"), PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly); 44 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, stringIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 52 45 didBecomePrototype(); 53 46 } -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r242596 r242742 401 401 hashMapBucketSetStructure.set(*this, HashMapBucket<HashMapBucketDataKey>::createStructure(*this, 0, jsNull())); 402 402 hashMapBucketMapStructure.set(*this, HashMapBucket<HashMapBucketDataKeyValue>::createStructure(*this, 0, jsNull())); 403 setIteratorStructure.set(*this, JSSetIterator::createStructure(*this, 0, jsNull()));404 mapIteratorStructure.set(*this, JSMapIterator::createStructure(*this, 0, jsNull()));405 403 bigIntStructure.set(*this, JSBigInt::createStructure(*this, 0, jsNull())); 406 404 executableToCodeBlockEdgeStructure.set(*this, ExecutableToCodeBlockEdge::createStructure(*this, nullptr, jsNull())); … … 1292 1290 #undef DYNAMIC_SPACE_AND_SET_DEFINE_MEMBER_SLOW 1293 1291 1292 Structure* VM::setIteratorStructureSlow() 1293 { 1294 ASSERT(!m_setIteratorStructure); 1295 m_setIteratorStructure.set(*this, JSSetIterator::createStructure(*this, 0, jsNull())); 1296 return m_setIteratorStructure.get(); 1297 } 1298 1299 Structure* VM::mapIteratorStructureSlow() 1300 { 1301 ASSERT(!m_mapIteratorStructure); 1302 m_mapIteratorStructure.set(*this, JSMapIterator::createStructure(*this, 0, jsNull())); 1303 return m_mapIteratorStructure.get(); 1304 } 1294 1305 1295 1306 JSCell* VM::sentinelSetBucketSlow() -
trunk/Source/JavaScriptCore/runtime/VM.h
r242596 r242742 534 534 Strong<Structure> hashMapBucketSetStructure; 535 535 Strong<Structure> hashMapBucketMapStructure; 536 Strong<Structure> setIteratorStructure;537 Strong<Structure> mapIteratorStructure;538 536 Strong<Structure> bigIntStructure; 539 537 Strong<Structure> executableToCodeBlockEdgeStructure; 538 539 Strong<Structure> m_setIteratorStructure; 540 Strong<Structure> m_mapIteratorStructure; 540 541 541 542 Strong<JSCell> emptyPropertyNameEnumerator; … … 564 565 WTF::SymbolRegistry& symbolRegistry() { return m_symbolRegistry; } 565 566 567 Structure* setIteratorStructure() 568 { 569 if (LIKELY(m_setIteratorStructure)) 570 return m_setIteratorStructure.get(); 571 return setIteratorStructureSlow(); 572 } 573 574 Structure* mapIteratorStructure() 575 { 576 if (LIKELY(m_mapIteratorStructure)) 577 return m_mapIteratorStructure.get(); 578 return mapIteratorStructureSlow(); 579 } 580 566 581 JSCell* sentinelSetBucket() 567 582 { … … 908 923 void createNativeThunk(); 909 924 925 JS_EXPORT_PRIVATE Structure* setIteratorStructureSlow(); 926 JS_EXPORT_PRIVATE Structure* mapIteratorStructureSlow(); 910 927 JSCell* sentinelSetBucketSlow(); 911 928 JSCell* sentinelMapBucketSlow(); -
trunk/Source/WebCore/ChangeLog
r242738 r242742 1 2019-03-11 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Reduce # of structures in JSGlobalObject initialization 4 https://bugs.webkit.org/show_bug.cgi?id=195498 5 6 Reviewed by Darin Adler. 7 8 * bindings/js/SerializedScriptValue.cpp: 9 (WebCore::CloneSerializer::serialize): 10 1 11 2019-03-11 Brent Fulgham <bfulgham@apple.com> 2 12 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r242699 r242742 1624 1624 if (!startMap(inMap)) 1625 1625 break; 1626 JSMapIterator* iterator = JSMapIterator::create(vm, vm.mapIteratorStructure .get(), inMap, IterateKeyValue);1626 JSMapIterator* iterator = JSMapIterator::create(vm, vm.mapIteratorStructure(), inMap, IterateKeyValue); 1627 1627 m_gcBuffer.appendWithCrashOnOverflow(inMap); 1628 1628 m_gcBuffer.appendWithCrashOnOverflow(iterator); … … 1668 1668 if (!startSet(inSet)) 1669 1669 break; 1670 JSSetIterator* iterator = JSSetIterator::create(vm, vm.setIteratorStructure .get(), inSet, IterateKey);1670 JSSetIterator* iterator = JSSetIterator::create(vm, vm.setIteratorStructure(), inSet, IterateKey); 1671 1671 m_gcBuffer.appendWithCrashOnOverflow(inSet); 1672 1672 m_gcBuffer.appendWithCrashOnOverflow(iterator);
Note:
See TracChangeset
for help on using the changeset viewer.