Changeset 242382 in webkit
- Timestamp:
- Mar 4, 2019, 1:20:14 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
builtins/BuiltinNames.h (modified) (3 diffs)
-
builtins/GlobalOperations.js (modified) (2 diffs)
-
runtime/JSGlobalObject.cpp (modified) (7 diffs)
-
runtime/JSGlobalObject.h (modified) (1 diff)
-
runtime/JSGlobalObjectFunctions.cpp (modified) (1 diff)
-
runtime/JSGlobalObjectFunctions.h (modified) (1 diff)
-
runtime/ReflectObject.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r242365 r242382 1 2019-03-04 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Make Reflect lazily-allocated by dropping @Reflect references from builtin JS 4 https://bugs.webkit.org/show_bug.cgi?id=195250 5 6 Reviewed by Saam Barati. 7 8 By removing @Reflect from builtin JS, we can make Reflect object allocation lazy. 9 We move @ownKeys function from @Reflect to @Object to remove @Reflect reference. 10 11 We also remove m_intlObject field from JSGlobalObject since we no longer use it. 12 13 * builtins/BuiltinNames.h: 14 * builtins/GlobalOperations.js: 15 (globalPrivate.copyDataProperties): 16 (globalPrivate.copyDataPropertiesNoExclusions): 17 * runtime/JSGlobalObject.cpp: 18 (JSC::createReflectProperty): 19 (JSC::JSGlobalObject::init): 20 (JSC::JSGlobalObject::visitChildren): 21 * runtime/JSGlobalObject.h: 22 * runtime/ObjectConstructor.cpp: 23 (JSC::ObjectConstructor::finishCreation): 24 (JSC::objectConstructorOwnKeys): 25 * runtime/ReflectObject.cpp: 26 (JSC::ReflectObject::finishCreation): 27 1 28 2019-03-04 Yusuke Suzuki <ysuzuki@apple.com> 2 29 -
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r242365 r242382 65 65 macro(RegExp) \ 66 66 macro(Promise) \ 67 macro(Reflect) \68 67 macro(InternalPromise) \ 69 68 macro(trunc) \ … … 71 70 macro(defineProperty) \ 72 71 macro(getPrototypeOf) \ 73 macro(getOwnPropertyDescriptor) \74 72 macro(getOwnPropertyNames) \ 75 73 macro(ownKeys) \ … … 82 80 macro(BuiltinDescribe) \ 83 81 macro(homeObject) \ 84 macro(templateRegistryKey) \85 82 macro(enqueueJob) \ 86 83 macro(hostPromiseRejectionTracker) \ -
trunk/Source/JavaScriptCore/builtins/GlobalOperations.js
r239761 r242382 97 97 98 98 let from = @toObject(source); 99 let keys = @ Reflect.@ownKeys(from);99 let keys = @ownKeys(from); 100 100 let keysLength = keys.length; 101 101 for (let i = 0; i < keysLength; i++) { … … 124 124 125 125 let from = @toObject(source); 126 let keys = @ Reflect.@ownKeys(from);126 let keys = @ownKeys(from); 127 127 let keysLength = keys.length; 128 128 for (let i = 0; i < keysLength; i++) { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r242365 r242382 223 223 } 224 224 225 static JSValue createReflectProperty(VM& vm, JSObject* object) 226 { 227 JSGlobalObject* global = jsCast<JSGlobalObject*>(object); 228 return ReflectObject::create(vm, global, ReflectObject::createStructure(vm, global, global->objectPrototype())); 229 } 230 225 231 static JSValue createConsoleProperty(VM& vm, JSObject* object) 226 232 { … … 322 328 URIError JSGlobalObject::m_URIErrorStructure DontEnum|ClassStructure 323 329 Proxy createProxyProperty DontEnum|PropertyCallback 330 Reflect createReflectProperty DontEnum|PropertyCallback 324 331 JSON createJSONProperty DontEnum|PropertyCallback 325 332 Math createMathProperty DontEnum|PropertyCallback … … 834 841 IntlObject* intl = IntlObject::create(vm, IntlObject::createStructure(vm, this, m_objectPrototype.get())); 835 842 putDirectWithoutTransition(vm, vm.propertyNames->Intl, intl, static_cast<unsigned>(PropertyAttribute::DontEnum)); 836 m_intlObject.set(vm, this, intl);837 843 #endif // ENABLE(INTL) 838 ReflectObject* reflectObject = ReflectObject::create(vm, this, ReflectObject::createStructure(vm, this, m_objectPrototype.get()));839 putDirectWithoutTransition(vm, vm.propertyNames->Reflect, reflectObject, static_cast<unsigned>(PropertyAttribute::DontEnum));840 844 841 845 m_moduleLoader.initLater( … … 854 858 855 859 JSFunction* privateFuncPropertyIsEnumerable = JSFunction::create(vm, this, 0, String(), globalFuncPropertyIsEnumerable); 860 JSFunction* privateFuncOwnKeys = JSFunction::create(vm, this, 0, String(), globalFuncOwnKeys); 856 861 JSFunction* privateFuncImportModule = JSFunction::create(vm, this, 0, String(), globalFuncImportModule); 857 862 JSFunction* privateFuncMakeTypeError = JSFunction::create(vm, this, 0, String(), globalFuncMakeTypeError); … … 925 930 GlobalPropertyInfo(vm.propertyNames->undefinedKeyword, jsUndefined(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 926 931 GlobalPropertyInfo(vm.propertyNames->builtinNames().propertyIsEnumerablePrivateName(), privateFuncPropertyIsEnumerable, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 932 GlobalPropertyInfo(vm.propertyNames->builtinNames().ownKeysPrivateName(), privateFuncOwnKeys, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 927 933 GlobalPropertyInfo(vm.propertyNames->builtinNames().importModulePrivateName(), privateFuncImportModule, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 928 934 GlobalPropertyInfo(vm.propertyNames->builtinNames().enqueueJobPrivateName(), JSFunction::create(vm, this, 0, String(), enqueueJob), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), … … 941 947 GlobalPropertyInfo(vm.propertyNames->builtinNames().truncPrivateName(), privateFuncTrunc, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 942 948 GlobalPropertyInfo(vm.propertyNames->builtinNames().PromisePrivateName(), promiseConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 943 GlobalPropertyInfo(vm.propertyNames->builtinNames().ReflectPrivateName(), reflectObject, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),944 949 GlobalPropertyInfo(vm.propertyNames->builtinNames().InternalPromisePrivateName(), internalPromiseConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 945 950 … … 1597 1602 1598 1603 #if ENABLE(INTL) 1599 visitor.append(thisObject->m_intlObject);1600 1604 visitor.append(thisObject->m_defaultCollator); 1601 1605 thisObject->m_collatorStructure.visit(visitor); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r242365 r242382 275 275 276 276 #if ENABLE(INTL) 277 WriteBarrier<IntlObject> m_intlObject;278 277 WriteBarrier<IntlCollator> m_defaultCollator; 279 278 LazyProperty<JSGlobalObject, Structure> m_collatorStructure; -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r242365 r242382 840 840 } 841 841 842 EncodedJSValue JSC_HOST_CALL globalFuncOwnKeys(ExecState* exec) 843 { 844 VM& vm = exec->vm(); 845 auto scope = DECLARE_THROW_SCOPE(vm); 846 JSObject* object = exec->argument(0).toObject(exec); 847 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 848 RELEASE_AND_RETURN(scope, JSValue::encode(ownPropertyKeys(exec, object, PropertyNameMode::StringsAndSymbols, DontEnumPropertiesMode::Include))); 849 } 850 842 851 #if ENABLE(INTL) 843 852 EncodedJSValue JSC_HOST_CALL globalFuncDateTimeFormat(ExecState* exec) -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
r242365 r242382 57 57 EncodedJSValue JSC_HOST_CALL globalFuncImportModule(ExecState*); 58 58 EncodedJSValue JSC_HOST_CALL globalFuncPropertyIsEnumerable(ExecState*); 59 EncodedJSValue JSC_HOST_CALL globalFuncOwnKeys(ExecState*); 59 60 EncodedJSValue JSC_HOST_CALL globalFuncDateTimeFormat(ExecState*); 60 61 -
trunk/Source/JavaScriptCore/runtime/ReflectObject.cpp
r236697 r242382 79 79 } 80 80 81 void ReflectObject::finishCreation(VM& vm, JSGlobalObject* globalObject)81 void ReflectObject::finishCreation(VM& vm, JSGlobalObject*) 82 82 { 83 83 Base::finishCreation(vm); 84 84 ASSERT(inherits(vm, info())); 85 86 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().ownKeysPrivateName(), reflectObjectOwnKeys, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly, 1);87 JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().getOwnPropertyDescriptorPrivateName(), reflectObjectGetOwnPropertyDescriptor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly, 2);88 85 } 89 86
Note:
See TracChangeset
for help on using the changeset viewer.