Diff
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (242741 => 242742)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2019-03-11 21:55:00 UTC (rev 242742)
@@ -59,7 +59,6 @@
set(_javascript_Core_OBJECT_LUT_SOURCES
runtime/ArrayConstructor.cpp
- runtime/ArrayIteratorPrototype.cpp
runtime/AsyncFromSyncIteratorPrototype.cpp
runtime/AsyncGeneratorPrototype.cpp
runtime/BigIntConstructor.cpp
@@ -95,7 +94,6 @@
runtime/RegExpPrototype.cpp
runtime/SetPrototype.cpp
runtime/StringConstructor.cpp
- runtime/StringIteratorPrototype.cpp
runtime/StringPrototype.cpp
runtime/SymbolConstructor.cpp
runtime/SymbolPrototype.cpp
Modified: trunk/Source/_javascript_Core/ChangeLog (242741 => 242742)
--- trunk/Source/_javascript_Core/ChangeLog 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-03-11 21:55:00 UTC (rev 242742)
@@ -1,3 +1,56 @@
+2019-03-11 Yusuke Suzuki <[email protected]>
+
+ [JSC] Reduce # of structures in JSGlobalObject initialization
+ https://bugs.webkit.org/show_bug.cgi?id=195498
+
+ Reviewed by Darin Adler.
+
+ This patch reduces # of structure allocations in JSGlobalObject initialization. Now it becomes 141, it fits in one
+ MarkedBlock and this patch drops one MarkedBlock used for Structure previously.
+
+ * CMakeLists.txt:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * runtime/ArrayIteratorPrototype.cpp:
+ (JSC::ArrayIteratorPrototype::finishCreation): ArrayIteratorPrototype, MapIteratorPrototype, and StringIteratorPrototype's
+ "next" properties are referenced by JSGlobalObject::init, and it causes reification of the lazy "next" property and structure
+ transition anyway. So we should put it eagerly "without-transition" configuration to avoid one structure transition.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::ArrayPrototype::finishCreation): @@unscopable object's structure should be dictionary because (1) it is used as a dictionary
+ in with-scope-resolution and (2) since with-scope-resolution is C++ runtime function anyway, non-dictionary structure does not add
+ any performance benefit. This change saves several structures that are not useful.
+
+ * runtime/ClonedArguments.cpp:
+ (JSC::ClonedArguments::createStructure): Bake CloneArguments's structure with 'without-transition' manner.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init): Previously we are always call resetProtoype at the end of JSGlobalObject::init. But it is not necessary
+ since we do not change [[Prototype]] of JSGlobalObject. All we want is (1) fixupPrototypeChainWithObjectPrototype's operation and (2) setGlobalThis
+ operation. Since setGlobalThis part is done in JSGlobalObject::finishCreation, fixupPrototypeChainWithObjectPrototype is only the thing
+ we should do here.
+
+ (JSC::JSGlobalObject::fixupPrototypeChainWithObjectPrototype):
+ (JSC::JSGlobalObject::resetPrototype): If the [[Prototype]] is the same to the current [[Prototype]], we can skip the operation.
+
+ * runtime/JSGlobalObject.h:
+ * runtime/MapIteratorPrototype.cpp:
+ (JSC::MapIteratorPrototype::finishCreation):
+ * runtime/NullGetterFunction.h:
+ * runtime/NullSetterFunction.h: Since structures of them are allocated per JSGlobalObject and they are per-JSGlobalObject,
+ we can use without-transition property addition.
+
+ * runtime/StringIteratorPrototype.cpp:
+ (JSC::StringIteratorPrototype::finishCreation):
+ * runtime/VM.cpp:
+ (JSC::VM::VM):
+ (JSC::VM::setIteratorStructureSlow):
+ (JSC::VM::mapIteratorStructureSlow): These structures are only used in WebCore's main thread.
+ * runtime/VM.h:
+ (JSC::VM::setIteratorStructure):
+ (JSC::VM::mapIteratorStructure):
+
2019-03-08 Yusuke Suzuki <[email protected]>
[JSC] BuiltinExecutables should behave like a WeakSet instead of generic WeakHandleOwner for memory footprint
Modified: trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist (242741 => 242742)
--- trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist 2019-03-11 21:55:00 UTC (rev 242742)
@@ -3,7 +3,6 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/AirOpcodeGenerated.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/AirOpcodeUtils.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/ArrayConstructor.lut.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/ArrayIteratorPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/AsyncFromSyncIteratorPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/AsyncGeneratorPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/BigIntConstructor.lut.h
@@ -52,7 +51,6 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/RegExpJitTables.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/SetPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/StringConstructor.lut.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/StringIteratorPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/StringPrototype.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/SymbolConstructor.lut.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/SymbolPrototype.lut.h
Modified: trunk/Source/_javascript_Core/DerivedSources.make (242741 => 242742)
--- trunk/Source/_javascript_Core/DerivedSources.make 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/DerivedSources.make 2019-03-11 21:55:00 UTC (rev 242742)
@@ -135,7 +135,6 @@
OBJECT_LUT_HEADERS = \
AsyncFromSyncIteratorPrototype.lut.h \
ArrayConstructor.lut.h \
- ArrayIteratorPrototype.lut.h \
AsyncGeneratorPrototype.lut.h \
BigIntConstructor.lut.h \
BigIntPrototype.lut.h \
@@ -169,7 +168,6 @@
RegExpConstructor.lut.h \
SetPrototype.lut.h \
StringConstructor.lut.h \
- StringIteratorPrototype.lut.h \
StringPrototype.lut.h \
SymbolConstructor.lut.h \
SymbolPrototype.lut.h \
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (242741 => 242742)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2019-03-11 21:55:00 UTC (rev 242742)
@@ -1286,7 +1286,6 @@
9959E9321BD18279001AA413 /* inline-and-minify-stylesheets-and-scripts.py in Headers */ = {isa = PBXBuildFile; fileRef = 9959E9301BD181F6001AA413 /* inline-and-minify-stylesheets-and-scripts.py */; settings = {ATTRIBUTES = (Private, ); }; };
996231E918D1804200C03FDA /* InspectorBackendCommands.js in Headers */ = {isa = PBXBuildFile; fileRef = A53243961856A475002ED692 /* InspectorBackendCommands.js */; settings = {ATTRIBUTES = (Private, ); }; };
996B73171BDA067F00331B84 /* ArrayConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73151BDA05AA00331B84 /* ArrayConstructor.lut.h */; };
- 996B73181BDA068000331B84 /* ArrayIteratorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73161BDA05AA00331B84 /* ArrayIteratorPrototype.lut.h */; };
996B73191BDA068000331B84 /* BooleanPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73071BD9FA2C00331B84 /* BooleanPrototype.lut.h */; };
996B731A1BDA08D100331B84 /* DateConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73081BD9FA2C00331B84 /* DateConstructor.lut.h */; };
996B731B1BDA08D100331B84 /* ErrorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73091BD9FA2C00331B84 /* ErrorPrototype.lut.h */; };
@@ -1299,7 +1298,6 @@
996B73221BDA08EF00331B84 /* ObjectConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */; };
996B73231BDA08EF00331B84 /* ReflectObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */; };
996B73251BDA08EF00331B84 /* StringConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73111BD9FA2C00331B84 /* StringConstructor.lut.h */; };
- 996B73261BDA08EF00331B84 /* StringIteratorPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73121BD9FA2C00331B84 /* StringIteratorPrototype.lut.h */; };
996B73271BDA08EF00331B84 /* SymbolConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73131BD9FA2C00331B84 /* SymbolConstructor.lut.h */; };
996B73281BDA08EF00331B84 /* SymbolPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */; };
998ED6751BED768C00DD8017 /* RemoteControllableTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 998ED6731BED659A00DD8017 /* RemoteControllableTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4030,11 +4028,9 @@
996B730E1BD9FA2C00331B84 /* ObjectConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectConstructor.lut.h; sourceTree = "<group>"; };
996B730F1BD9FA2C00331B84 /* ReflectObject.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReflectObject.lut.h; sourceTree = "<group>"; };
996B73111BD9FA2C00331B84 /* StringConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringConstructor.lut.h; sourceTree = "<group>"; };
- 996B73121BD9FA2C00331B84 /* StringIteratorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringIteratorPrototype.lut.h; sourceTree = "<group>"; };
996B73131BD9FA2C00331B84 /* SymbolConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolConstructor.lut.h; sourceTree = "<group>"; };
996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolPrototype.lut.h; sourceTree = "<group>"; };
996B73151BDA05AA00331B84 /* ArrayConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayConstructor.lut.h; sourceTree = "<group>"; };
- 996B73161BDA05AA00331B84 /* ArrayIteratorPrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayIteratorPrototype.lut.h; sourceTree = "<group>"; };
998ED6721BED659A00DD8017 /* RemoteControllableTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteControllableTarget.cpp; sourceTree = "<group>"; };
998ED6731BED659A00DD8017 /* RemoteControllableTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteControllableTarget.h; sourceTree = "<group>"; };
99DA00991BD5992700F4575C /* __init__.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = "<group>"; };
@@ -6364,7 +6360,6 @@
0F6183341C45F3B60072450B /* AirOpcodeGenerated.h */,
0F6183351C45F3B60072450B /* AirOpcodeUtils.h */,
996B73151BDA05AA00331B84 /* ArrayConstructor.lut.h */,
- 996B73161BDA05AA00331B84 /* ArrayIteratorPrototype.lut.h */,
E3893A1C2203A7C600E79A74 /* AsyncFromSyncIteratorPrototype.lut.h */,
8B3BF5E31E3D365A0076A87A /* AsyncGeneratorPrototype.lut.h */,
996B73071BD9FA2C00331B84 /* BooleanPrototype.lut.h */,
@@ -6406,7 +6401,6 @@
A718F61A11754A21002465A7 /* RegExpJitTables.h */,
7035587F1C418458004BD7BF /* SetPrototype.lut.h */,
996B73111BD9FA2C00331B84 /* StringConstructor.lut.h */,
- 996B73121BD9FA2C00331B84 /* StringIteratorPrototype.lut.h */,
996B73131BD9FA2C00331B84 /* SymbolConstructor.lut.h */,
996B73141BD9FA2C00331B84 /* SymbolPrototype.lut.h */,
533B15DE1DC7F463004D500A /* WasmOps.h */,
@@ -8489,7 +8483,6 @@
996B73171BDA067F00331B84 /* ArrayConstructor.lut.h in Headers */,
0FB7F39515ED8E4600F167B2 /* ArrayConventions.h in Headers */,
A7BDAEC917F4EA1400F6140C /* ArrayIteratorPrototype.h in Headers */,
- 996B73181BDA068000331B84 /* ArrayIteratorPrototype.lut.h in Headers */,
0F63945515D07057006A597C /* ArrayProfile.h in Headers */,
BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */,
0FB7F39615ED8E4600F167B2 /* ArrayStorage.h in Headers */,
@@ -9702,7 +9695,6 @@
BC18C4660E16F5CD00B34460 /* StringConstructor.h in Headers */,
996B73251BDA08EF00331B84 /* StringConstructor.lut.h in Headers */,
70EC0EC71AA0D7DA00B6AAFA /* StringIteratorPrototype.h in Headers */,
- 996B73261BDA08EF00331B84 /* StringIteratorPrototype.lut.h in Headers */,
BC18C4680E16F5CD00B34460 /* StringObject.h in Headers */,
BC18C46A0E16F5CD00B34460 /* StringPrototype.h in Headers */,
E325A36022211590007349A1 /* StringPrototypeInlines.h in Headers */,
Modified: trunk/Source/_javascript_Core/runtime/ArrayIteratorPrototype.cpp (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/ArrayIteratorPrototype.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/ArrayIteratorPrototype.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -26,7 +26,6 @@
#include "config.h"
#include "ArrayIteratorPrototype.h"
-#include "ArrayIteratorPrototype.lut.h"
#include "IteratorOperations.h"
#include "JSCInlines.h"
#include "JSCJSValueInlines.h"
@@ -37,19 +36,14 @@
namespace JSC {
-const ClassInfo ArrayIteratorPrototype::s_info = { "Array Iterator", &Base::s_info, &arrayIteratorPrototypeTable, nullptr, CREATE_METHOD_TABLE(ArrayIteratorPrototype) };
+const ClassInfo ArrayIteratorPrototype::s_info = { "Array Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ArrayIteratorPrototype) };
-/* Source for ArrayIteratorPrototype.lut.h
-@begin arrayIteratorPrototypeTable
- next JSBuiltin DontEnum|Function 0
-@end
-*/
-
-void ArrayIteratorPrototype::finishCreation(VM& vm, JSGlobalObject*)
+void ArrayIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
putDirectWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "Array Iterator"), PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, arrayIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
didBecomePrototype();
}
Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -89,8 +89,8 @@
putDirectWithoutTransition(vm, vm.propertyNames->iteratorSymbol, globalObject->arrayProtoValuesFunction(), static_cast<unsigned>(PropertyAttribute::DontEnum));
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->toLocaleString, arrayProtoFuncToLocaleString, static_cast<unsigned>(PropertyAttribute::DontEnum), 0);
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("concat", arrayPrototypeConcatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("fill", arrayPrototypeFillCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().concatPublicName(), arrayPrototypeConcatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().fillPublicName(), arrayPrototypeFillCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->join, arrayProtoFuncJoin, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION("pop", arrayProtoFuncPop, static_cast<unsigned>(PropertyAttribute::DontEnum), 0, ArrayPopIntrinsic);
JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().pushPublicName(), arrayProtoFuncPush, static_cast<unsigned>(PropertyAttribute::DontEnum), 1, ArrayPushIntrinsic);
@@ -99,26 +99,26 @@
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().shiftPublicName(), arrayProtoFuncShift, static_cast<unsigned>(PropertyAttribute::DontEnum), 0);
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().shiftPrivateName(), arrayProtoFuncShift, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly, 0);
JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->slice, arrayProtoFuncSlice, static_cast<unsigned>(PropertyAttribute::DontEnum), 2, ArraySliceIntrinsic);
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("sort", arrayPrototypeSortCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().sortPublicName(), arrayPrototypeSortCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("splice", arrayProtoFuncSplice, static_cast<unsigned>(PropertyAttribute::DontEnum), 2);
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("unshift", arrayProtoFuncUnShift, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("every", arrayPrototypeEveryCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("forEach", arrayPrototypeForEachCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("some", arrayPrototypeSomeCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().everyPublicName(), arrayPrototypeEveryCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().forEachPublicName(), arrayPrototypeForEachCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().somePublicName(), arrayPrototypeSomeCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION("indexOf", arrayProtoFuncIndexOf, static_cast<unsigned>(PropertyAttribute::DontEnum), 1, ArrayIndexOfIntrinsic);
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("lastIndexOf", arrayProtoFuncLastIndexOf, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("filter", arrayPrototypeFilterCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("flat", arrayPrototypeFlatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("flatMap", arrayPrototypeFlatMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("reduce", arrayPrototypeReduceCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("reduceRight", arrayPrototypeReduceRightCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("map", arrayPrototypeMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().filterPublicName(), arrayPrototypeFilterCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().flatPublicName(), arrayPrototypeFlatCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().flatMapPublicName(), arrayPrototypeFlatMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().reducePublicName(), arrayPrototypeReduceCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().reduceRightPublicName(), arrayPrototypeReduceRightCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().mapPublicName(), arrayPrototypeMapCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().entriesPublicName(), arrayPrototypeEntriesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().keysPublicName(), arrayPrototypeKeysCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("find", arrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("findIndex", arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("includes", arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("copyWithin", arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findPublicName(), arrayPrototypeFindCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findIndexPublicName(), arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().includesPublicName(), arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().copyWithinPublicName(), arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().entriesPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().forEachPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().forEachPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
@@ -126,18 +126,19 @@
putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().valuesPrivateName(), globalObject->arrayProtoValuesFunction(), static_cast<unsigned>(PropertyAttribute::ReadOnly));
JSObject* unscopables = constructEmptyObject(globalObject->globalExec(), globalObject->nullPrototypeObjectStructure());
- const char* unscopableNames[] = {
- "copyWithin",
- "entries",
- "fill",
- "find",
- "findIndex",
- "includes",
- "keys",
- "values"
+ unscopables->convertToDictionary(vm);
+ const Identifier* const unscopableNames[] = {
+ &vm.propertyNames->builtinNames().copyWithinPublicName(),
+ &vm.propertyNames->builtinNames().entriesPublicName(),
+ &vm.propertyNames->builtinNames().fillPublicName(),
+ &vm.propertyNames->builtinNames().findPublicName(),
+ &vm.propertyNames->builtinNames().findIndexPublicName(),
+ &vm.propertyNames->builtinNames().includesPublicName(),
+ &vm.propertyNames->builtinNames().keysPublicName(),
+ &vm.propertyNames->builtinNames().valuesPublicName()
};
- for (const char* unscopableName : unscopableNames)
- unscopables->putDirect(vm, Identifier::fromString(&vm, unscopableName), jsBoolean(true));
+ for (const auto* unscopableName : unscopableNames)
+ unscopables->putDirect(vm, *unscopableName, jsBoolean(true));
putDirectWithoutTransition(vm, vm.propertyNames->unscopablesSymbol, unscopables, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);
}
Modified: trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -151,9 +151,12 @@
Structure* ClonedArguments::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype, IndexingType indexingType)
{
Structure* structure = Structure::create(vm, globalObject, prototype, TypeInfo(ClonedArgumentsType, StructureFlags), info(), indexingType);
- PropertyOffset offset;
- structure = structure->addPropertyTransition(vm, structure, vm.propertyNames->length, static_cast<unsigned>(PropertyAttribute::DontEnum), offset);
- ASSERT(offset == clonedArgumentsLengthPropertyOffset);
+ structure->addPropertyWithoutTransition(
+ vm, vm.propertyNames->length, static_cast<unsigned>(PropertyAttribute::DontEnum),
+ [&] (const GCSafeConcurrentJSLocker&, PropertyOffset offset, PropertyOffset newLastOffset) {
+ RELEASE_ASSERT(offset == clonedArgumentsLengthPropertyOffset);
+ structure->setLastOffset(newLastOffset);
+ });
return structure;
}
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -1160,7 +1160,7 @@
m_numberProtoToStringFunction.set(vm, this, jsCast<JSFunction*>(numberPrototype->getDirect(vm, vm.propertyNames->toString)));
}
- resetPrototype(vm, getPrototypeDirect(vm));
+ fixupPrototypeChainWithObjectPrototype(vm);
}
bool JSGlobalObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
@@ -1585,16 +1585,21 @@
}
}
-// Set prototype, and also insert the object prototype at the end of the chain.
-void JSGlobalObject::resetPrototype(VM& vm, JSValue prototype)
+void JSGlobalObject::fixupPrototypeChainWithObjectPrototype(VM& vm)
{
- setPrototypeDirect(vm, prototype);
-
JSObject* oldLastInPrototypeChain = lastInPrototypeChain(vm, this);
JSObject* objectPrototype = m_objectPrototype.get();
if (oldLastInPrototypeChain != objectPrototype)
oldLastInPrototypeChain->setPrototypeDirect(vm, objectPrototype);
+}
+// Set prototype, and also insert the object prototype at the end of the chain.
+void JSGlobalObject::resetPrototype(VM& vm, JSValue prototype)
+{
+ if (getPrototypeDirect(vm) == prototype)
+ return;
+ setPrototypeDirect(vm, prototype);
+ fixupPrototypeChainWithObjectPrototype(vm);
// Whenever we change the prototype of the global object, we need to create a new JSProxy with the correct prototype.
setGlobalThis(vm, JSNonDestructibleProxy::create(vm, JSNonDestructibleProxy::createStructure(vm, this, prototype, PureForwardingProxyType), this));
}
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2019-03-11 21:55:00 UTC (rev 242742)
@@ -1035,6 +1035,7 @@
void initializeErrorConstructor(LazyClassStructure::Initializer&);
JS_EXPORT_PRIVATE void init(VM&);
+ void fixupPrototypeChainWithObjectPrototype(VM&);
JS_EXPORT_PRIVATE static void clearRareData(JSCell*);
Modified: trunk/Source/_javascript_Core/runtime/MapIteratorPrototype.cpp (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/MapIteratorPrototype.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/MapIteratorPrototype.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -39,8 +39,8 @@
ASSERT(inherits(vm, info()));
didBecomePrototype();
- JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("next", mapIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
putDirectWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "Map Iterator"), PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, mapIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
}
}
Modified: trunk/Source/_javascript_Core/runtime/NullGetterFunction.h (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/NullGetterFunction.h 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/NullGetterFunction.h 2019-03-11 21:55:00 UTC (rev 242742)
@@ -37,7 +37,7 @@
{
// Since NullGetterFunction is per JSGlobalObject, we use put-without-transition in InternalFunction::finishCreation.
NullGetterFunction* function = new (NotNull, allocateCell< NullGetterFunction>(vm.heap)) NullGetterFunction(vm, structure);
- function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::WithStructureTransition);
+ function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
return function;
}
Modified: trunk/Source/_javascript_Core/runtime/NullSetterFunction.h (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/NullSetterFunction.h 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/NullSetterFunction.h 2019-03-11 21:55:00 UTC (rev 242742)
@@ -37,7 +37,7 @@
{
// Since NullSetterFunction is per JSGlobalObject, we use put-without-transition in InternalFunction::finishCreation.
NullSetterFunction* function = new (NotNull, allocateCell< NullSetterFunction>(vm.heap)) NullSetterFunction(vm, structure);
- function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::WithStructureTransition);
+ function->finishCreation(vm, String(), NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition);
return function;
}
Modified: trunk/Source/_javascript_Core/runtime/StringIteratorPrototype.cpp (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/StringIteratorPrototype.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/StringIteratorPrototype.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -32,23 +32,16 @@
#include "JSStringIterator.h"
#include "ObjectConstructor.h"
-#include "StringIteratorPrototype.lut.h"
-
namespace JSC {
-const ClassInfo StringIteratorPrototype::s_info = { "String Iterator", &Base::s_info, &stringIteratorPrototypeTable, nullptr, CREATE_METHOD_TABLE(StringIteratorPrototype) };
+const ClassInfo StringIteratorPrototype::s_info = { "String Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(StringIteratorPrototype) };
-/* Source for StringIteratorPrototype.lut.h
-@begin stringIteratorPrototypeTable
- next JSBuiltin DontEnum|Function 0
-@end
-*/
-
-void StringIteratorPrototype::finishCreation(VM& vm, JSGlobalObject*)
+void StringIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
putDirectWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "String Iterator"), PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);
+ JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, stringIteratorPrototypeNextCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
didBecomePrototype();
}
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -400,8 +400,6 @@
functionCodeBlockStructure.set(*this, FunctionCodeBlock::createStructure(*this, 0, jsNull()));
hashMapBucketSetStructure.set(*this, HashMapBucket<HashMapBucketDataKey>::createStructure(*this, 0, jsNull()));
hashMapBucketMapStructure.set(*this, HashMapBucket<HashMapBucketDataKeyValue>::createStructure(*this, 0, jsNull()));
- setIteratorStructure.set(*this, JSSetIterator::createStructure(*this, 0, jsNull()));
- mapIteratorStructure.set(*this, JSMapIterator::createStructure(*this, 0, jsNull()));
bigIntStructure.set(*this, JSBigInt::createStructure(*this, 0, jsNull()));
executableToCodeBlockEdgeStructure.set(*this, ExecutableToCodeBlockEdge::createStructure(*this, nullptr, jsNull()));
@@ -1291,7 +1289,20 @@
#undef DYNAMIC_SPACE_AND_SET_DEFINE_MEMBER_SLOW
+Structure* VM::setIteratorStructureSlow()
+{
+ ASSERT(!m_setIteratorStructure);
+ m_setIteratorStructure.set(*this, JSSetIterator::createStructure(*this, 0, jsNull()));
+ return m_setIteratorStructure.get();
+}
+Structure* VM::mapIteratorStructureSlow()
+{
+ ASSERT(!m_mapIteratorStructure);
+ m_mapIteratorStructure.set(*this, JSMapIterator::createStructure(*this, 0, jsNull()));
+ return m_mapIteratorStructure.get();
+}
+
JSCell* VM::sentinelSetBucketSlow()
{
ASSERT(!m_sentinelSetBucket);
Modified: trunk/Source/_javascript_Core/runtime/VM.h (242741 => 242742)
--- trunk/Source/_javascript_Core/runtime/VM.h 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2019-03-11 21:55:00 UTC (rev 242742)
@@ -533,11 +533,12 @@
Strong<Structure> functionCodeBlockStructure;
Strong<Structure> hashMapBucketSetStructure;
Strong<Structure> hashMapBucketMapStructure;
- Strong<Structure> setIteratorStructure;
- Strong<Structure> mapIteratorStructure;
Strong<Structure> bigIntStructure;
Strong<Structure> executableToCodeBlockEdgeStructure;
+ Strong<Structure> m_setIteratorStructure;
+ Strong<Structure> m_mapIteratorStructure;
+
Strong<JSCell> emptyPropertyNameEnumerator;
Strong<JSCell> m_sentinelSetBucket;
@@ -563,6 +564,20 @@
AtomicStringTable* atomicStringTable() const { return m_atomicStringTable; }
WTF::SymbolRegistry& symbolRegistry() { return m_symbolRegistry; }
+ Structure* setIteratorStructure()
+ {
+ if (LIKELY(m_setIteratorStructure))
+ return m_setIteratorStructure.get();
+ return setIteratorStructureSlow();
+ }
+
+ Structure* mapIteratorStructure()
+ {
+ if (LIKELY(m_mapIteratorStructure))
+ return m_mapIteratorStructure.get();
+ return mapIteratorStructureSlow();
+ }
+
JSCell* sentinelSetBucket()
{
if (LIKELY(m_sentinelSetBucket))
@@ -907,6 +922,8 @@
static VM*& sharedInstanceInternal();
void createNativeThunk();
+ JS_EXPORT_PRIVATE Structure* setIteratorStructureSlow();
+ JS_EXPORT_PRIVATE Structure* mapIteratorStructureSlow();
JSCell* sentinelSetBucketSlow();
JSCell* sentinelMapBucketSlow();
Modified: trunk/Source/WebCore/ChangeLog (242741 => 242742)
--- trunk/Source/WebCore/ChangeLog 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/WebCore/ChangeLog 2019-03-11 21:55:00 UTC (rev 242742)
@@ -1,3 +1,13 @@
+2019-03-11 Yusuke Suzuki <[email protected]>
+
+ [JSC] Reduce # of structures in JSGlobalObject initialization
+ https://bugs.webkit.org/show_bug.cgi?id=195498
+
+ Reviewed by Darin Adler.
+
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneSerializer::serialize):
+
2019-03-11 Brent Fulgham <[email protected]>
Remove obsolete runtime flag for StorageAccess API Prompt
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (242741 => 242742)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2019-03-11 21:26:54 UTC (rev 242741)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2019-03-11 21:55:00 UTC (rev 242742)
@@ -1623,7 +1623,7 @@
JSMap* inMap = jsCast<JSMap*>(inValue);
if (!startMap(inMap))
break;
- JSMapIterator* iterator = JSMapIterator::create(vm, vm.mapIteratorStructure.get(), inMap, IterateKeyValue);
+ JSMapIterator* iterator = JSMapIterator::create(vm, vm.mapIteratorStructure(), inMap, IterateKeyValue);
m_gcBuffer.appendWithCrashOnOverflow(inMap);
m_gcBuffer.appendWithCrashOnOverflow(iterator);
mapIteratorStack.append(iterator);
@@ -1667,7 +1667,7 @@
JSSet* inSet = jsCast<JSSet*>(inValue);
if (!startSet(inSet))
break;
- JSSetIterator* iterator = JSSetIterator::create(vm, vm.setIteratorStructure.get(), inSet, IterateKey);
+ JSSetIterator* iterator = JSSetIterator::create(vm, vm.setIteratorStructure(), inSet, IterateKey);
m_gcBuffer.appendWithCrashOnOverflow(inSet);
m_gcBuffer.appendWithCrashOnOverflow(iterator);
setIteratorStack.append(iterator);