Log Message
[JSC] Make Reflect lazily-allocated by dropping @Reflect references from builtin JS https://bugs.webkit.org/show_bug.cgi?id=195250
Reviewed by Saam Barati. By removing @Reflect from builtin JS, we can make Reflect object allocation lazy. We move @ownKeys function from @Reflect to @Object to remove @Reflect reference. We also remove m_intlObject field from JSGlobalObject since we no longer use it. * builtins/BuiltinNames.h: * builtins/GlobalOperations.js: (globalPrivate.copyDataProperties): (globalPrivate.copyDataPropertiesNoExclusions): * runtime/JSGlobalObject.cpp: (JSC::createReflectProperty): (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: * runtime/ObjectConstructor.cpp: (JSC::ObjectConstructor::finishCreation): (JSC::objectConstructorOwnKeys): * runtime/ReflectObject.cpp: (JSC::ReflectObject::finishCreation):
Modified Paths
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/builtins/BuiltinNames.h
- trunk/Source/_javascript_Core/builtins/GlobalOperations.js
- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp
- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h
- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp
- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h
- trunk/Source/_javascript_Core/runtime/ReflectObject.cpp
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (242381 => 242382)
--- trunk/Source/_javascript_Core/ChangeLog 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-03-04 21:20:14 UTC (rev 242382)
@@ -1,5 +1,32 @@
2019-03-04 Yusuke Suzuki <ysuz...@apple.com>
+ [JSC] Make Reflect lazily-allocated by dropping @Reflect references from builtin JS
+ https://bugs.webkit.org/show_bug.cgi?id=195250
+
+ Reviewed by Saam Barati.
+
+ By removing @Reflect from builtin JS, we can make Reflect object allocation lazy.
+ We move @ownKeys function from @Reflect to @Object to remove @Reflect reference.
+
+ We also remove m_intlObject field from JSGlobalObject since we no longer use it.
+
+ * builtins/BuiltinNames.h:
+ * builtins/GlobalOperations.js:
+ (globalPrivate.copyDataProperties):
+ (globalPrivate.copyDataPropertiesNoExclusions):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::createReflectProperty):
+ (JSC::JSGlobalObject::init):
+ (JSC::JSGlobalObject::visitChildren):
+ * runtime/JSGlobalObject.h:
+ * runtime/ObjectConstructor.cpp:
+ (JSC::ObjectConstructor::finishCreation):
+ (JSC::objectConstructorOwnKeys):
+ * runtime/ReflectObject.cpp:
+ (JSC::ReflectObject::finishCreation):
+
+2019-03-04 Yusuke Suzuki <ysuz...@apple.com>
+
[JSC] Offer @makeTypeError instead of exposing @TypeError
https://bugs.webkit.org/show_bug.cgi?id=193858
Modified: trunk/Source/_javascript_Core/builtins/BuiltinNames.h (242381 => 242382)
--- trunk/Source/_javascript_Core/builtins/BuiltinNames.h 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/builtins/BuiltinNames.h 2019-03-04 21:20:14 UTC (rev 242382)
@@ -64,13 +64,11 @@
macro(ArrayBuffer) \
macro(RegExp) \
macro(Promise) \
- macro(Reflect) \
macro(InternalPromise) \
macro(trunc) \
macro(create) \
macro(defineProperty) \
macro(getPrototypeOf) \
- macro(getOwnPropertyDescriptor) \
macro(getOwnPropertyNames) \
macro(ownKeys) \
macro(Set) \
@@ -81,7 +79,6 @@
macro(BuiltinLog) \
macro(BuiltinDescribe) \
macro(homeObject) \
- macro(templateRegistryKey) \
macro(enqueueJob) \
macro(hostPromiseRejectionTracker) \
macro(promiseIsHandled) \
Modified: trunk/Source/_javascript_Core/builtins/GlobalOperations.js (242381 => 242382)
--- trunk/Source/_javascript_Core/builtins/GlobalOperations.js 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/builtins/GlobalOperations.js 2019-03-04 21:20:14 UTC (rev 242382)
@@ -96,7 +96,7 @@
return target;
let from = @toObject(source);
- let keys = @Reflect.@ownKeys(from);
+ let keys = @ownKeys(from);
let keysLength = keys.length;
for (let i = 0; i < keysLength; i++) {
let nextKey = keys[i];
@@ -123,7 +123,7 @@
return target;
let from = @toObject(source);
- let keys = @Reflect.@ownKeys(from);
+ let keys = @ownKeys(from);
let keysLength = keys.length;
for (let i = 0; i < keysLength; i++) {
let nextKey = keys[i];
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (242381 => 242382)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-04 21:20:14 UTC (rev 242382)
@@ -222,6 +222,12 @@
return MathObject::create(vm, global, MathObject::createStructure(vm, global, global->objectPrototype()));
}
+static JSValue createReflectProperty(VM& vm, JSObject* object)
+{
+ JSGlobalObject* global = jsCast<JSGlobalObject*>(object);
+ return ReflectObject::create(vm, global, ReflectObject::createStructure(vm, global, global->objectPrototype()));
+}
+
static JSValue createConsoleProperty(VM& vm, JSObject* object)
{
JSGlobalObject* global = jsCast<JSGlobalObject*>(object);
@@ -321,6 +327,7 @@
TypeError JSGlobalObject::m_typeErrorStructure DontEnum|ClassStructure
URIError JSGlobalObject::m_URIErrorStructure DontEnum|ClassStructure
Proxy createProxyProperty DontEnum|PropertyCallback
+ Reflect createReflectProperty DontEnum|PropertyCallback
JSON createJSONProperty DontEnum|PropertyCallback
Math createMathProperty DontEnum|PropertyCallback
console createConsoleProperty DontEnum|PropertyCallback
@@ -833,10 +840,7 @@
IntlObject* intl = IntlObject::create(vm, IntlObject::createStructure(vm, this, m_objectPrototype.get()));
putDirectWithoutTransition(vm, vm.propertyNames->Intl, intl, static_cast<unsigned>(PropertyAttribute::DontEnum));
- m_intlObject.set(vm, this, intl);
#endif // ENABLE(INTL)
- ReflectObject* reflectObject = ReflectObject::create(vm, this, ReflectObject::createStructure(vm, this, m_objectPrototype.get()));
- putDirectWithoutTransition(vm, vm.propertyNames->Reflect, reflectObject, static_cast<unsigned>(PropertyAttribute::DontEnum));
m_moduleLoader.initLater(
[] (const Initializer<JSModuleLoader>& init) {
@@ -853,6 +857,7 @@
JSFunction* privateFuncTrunc = JSFunction::create(vm, this, 0, String(), mathProtoFuncTrunc, TruncIntrinsic);
JSFunction* privateFuncPropertyIsEnumerable = JSFunction::create(vm, this, 0, String(), globalFuncPropertyIsEnumerable);
+ JSFunction* privateFuncOwnKeys = JSFunction::create(vm, this, 0, String(), globalFuncOwnKeys);
JSFunction* privateFuncImportModule = JSFunction::create(vm, this, 0, String(), globalFuncImportModule);
JSFunction* privateFuncMakeTypeError = JSFunction::create(vm, this, 0, String(), globalFuncMakeTypeError);
JSFunction* privateFuncTypedArrayLength = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncLength);
@@ -924,6 +929,7 @@
GlobalPropertyInfo(vm.propertyNames->Infinity, jsNumber(std::numeric_limits<double>::infinity()), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->undefinedKeyword, jsUndefined(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().propertyIsEnumerablePrivateName(), privateFuncPropertyIsEnumerable, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
+ GlobalPropertyInfo(vm.propertyNames->builtinNames().ownKeysPrivateName(), privateFuncOwnKeys, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().importModulePrivateName(), privateFuncImportModule, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().enqueueJobPrivateName(), JSFunction::create(vm, this, 0, String(), enqueueJob), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().makeTypeErrorPrivateName(), privateFuncMakeTypeError, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
@@ -940,7 +946,6 @@
GlobalPropertyInfo(vm.propertyNames->builtinNames().RegExpPrivateName(), regExpConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().truncPrivateName(), privateFuncTrunc, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().PromisePrivateName(), promiseConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
- GlobalPropertyInfo(vm.propertyNames->builtinNames().ReflectPrivateName(), reflectObject, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().InternalPromisePrivateName(), internalPromiseConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().repeatCharacterPrivateName(), JSFunction::create(vm, this, 2, String(), stringProtoFuncRepeatCharacter), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
@@ -1596,7 +1601,6 @@
visitor.append(thisObject->m_promiseConstructor);
#if ENABLE(INTL)
- visitor.append(thisObject->m_intlObject);
visitor.append(thisObject->m_defaultCollator);
thisObject->m_collatorStructure.visit(visitor);
thisObject->m_numberFormatStructure.visit(visitor);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (242381 => 242382)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2019-03-04 21:20:14 UTC (rev 242382)
@@ -274,7 +274,6 @@
WriteBarrier<JSInternalPromiseConstructor> m_internalPromiseConstructor;
#if ENABLE(INTL)
- WriteBarrier<IntlObject> m_intlObject;
WriteBarrier<IntlCollator> m_defaultCollator;
LazyProperty<JSGlobalObject, Structure> m_collatorStructure;
LazyProperty<JSGlobalObject, Structure> m_numberFormatStructure;
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (242381 => 242382)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2019-03-04 21:20:14 UTC (rev 242382)
@@ -839,6 +839,15 @@
return JSValue::encode(jsBoolean(enumerable));
}
+EncodedJSValue JSC_HOST_CALL globalFuncOwnKeys(ExecState* exec)
+{
+ VM& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+ JSObject* object = exec->argument(0).toObject(exec);
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ RELEASE_AND_RETURN(scope, JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Include)));
+}
+
#if ENABLE(INTL)
EncodedJSValue JSC_HOST_CALL globalFuncDateTimeFormat(ExecState* exec)
{
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h (242381 => 242382)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h 2019-03-04 21:20:14 UTC (rev 242382)
@@ -56,6 +56,7 @@
EncodedJSValue JSC_HOST_CALL globalFuncBuiltinDescribe(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncImportModule(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncPropertyIsEnumerable(ExecState*);
+EncodedJSValue JSC_HOST_CALL globalFuncOwnKeys(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncDateTimeFormat(ExecState*);
double jsToNumber(StringView);
Modified: trunk/Source/_javascript_Core/runtime/ReflectObject.cpp (242381 => 242382)
--- trunk/Source/_javascript_Core/runtime/ReflectObject.cpp 2019-03-04 21:17:36 UTC (rev 242381)
+++ trunk/Source/_javascript_Core/runtime/ReflectObject.cpp 2019-03-04 21:20:14 UTC (rev 242382)
@@ -78,13 +78,10 @@
{
}
-void ReflectObject::finishCreation(VM& vm, JSGlobalObject* globalObject)
+void ReflectObject::finishCreation(VM& vm, JSGlobalObject*)
{
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
-
- JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().ownKeysPrivateName(), reflectObjectOwnKeys, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly, 1);
- JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().getOwnPropertyDescriptorPrivateName(), reflectObjectGetOwnPropertyDescriptor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly, 2);
}
// ------------------------------ Functions --------------------------------
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes