Changeset 98747 in webkit
- Timestamp:
- Oct 28, 2011, 12:08:24 PM (14 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackObject.cpp
r95936 r98747 40 40 template <> const ClassInfo JSCallbackObject<JSGlobalObject>::s_info = { "CallbackGlobalObject", &JSGlobalObject::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackObject) }; 41 41 42 template <> 43 Structure* JSCallbackObject<JSNonFinalObject>::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) 44 { 45 return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info); 46 } 47 48 template <> 49 Structure* JSCallbackObject<JSGlobalObject>::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) 50 { 51 return Structure::create(globalData, globalObject, proto, TypeInfo(GlobalObjectType, StructureFlags), &s_info); 52 } 53 42 54 void JSCallbackObjectData::finalize(Handle<Unknown> handle, void* context) 43 55 { -
trunk/Source/JavaScriptCore/API/JSCallbackObject.h
r98501 r98747 153 153 bool inherits(JSClassRef) const; 154 154 155 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) 156 { 157 return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), &s_info); 158 } 155 static Structure* createStructure(JSGlobalData&, JSGlobalObject*, JSValue); 159 156 160 157 JSValue getPrivateProperty(const Identifier& propertyName) const -
trunk/Source/JavaScriptCore/ChangeLog
r98724 r98747 1 2011-10-28 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize isGlobalObject, isVariableObject, isActivationObject, and isErrorInstance in JSObject 4 https://bugs.webkit.org/show_bug.cgi?id=70968 5 6 Reviewed by Geoffrey Garen. 7 8 * API/JSCallbackObject.cpp: Added two specializations for createStructure that use different JSTypes in their 9 TypeInfo. Had to also create a specialization for JSNonFinalObject, even JSGlobalObject was the only that 10 needed it because Windows wouldn't build without it. 11 (JSC::::createStructure): 12 * API/JSCallbackObject.h: 13 * JavaScriptCore.exp: 14 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 15 * runtime/ErrorInstance.h: Removed virtual function and changed JSType provided to TypeInfo in createStructure. 16 (JSC::ErrorInstance::createStructure): 17 * runtime/ErrorPrototype.h: Ditto 18 (JSC::ErrorPrototype::createStructure): 19 * runtime/JSActivation.h: Ditto 20 (JSC::JSActivation::createStructure): 21 * runtime/JSGlobalObject.h: Ditto 22 (JSC::JSGlobalObject::createStructure): 23 * runtime/JSObject.h: De-virtualized functions. They now check the JSType of the object for the corresponding type. 24 (JSC::JSObject::isGlobalObject): 25 (JSC::JSObject::isVariableObject): 26 (JSC::JSObject::isActivationObject): 27 (JSC::JSObject::isErrorInstance): 28 * runtime/JSType.h: Added new types for GlobalObject, VariableObject, ActivationObject, and ErrorInstance. 29 * runtime/JSVariableObject.cpp: Removed virtual function. 30 * runtime/JSVariableObject.h: Changed JSType provided to TypeInfo in createStructure. 31 (JSC::JSVariableObject::createStructure): 32 1 33 2011-10-28 Pavel Feldman <pfeldman@google.com> 2 34 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r98624 r98747 534 534 __ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE 535 535 __ZNK3JSC14JSGlobalObject14isDynamicScopeERb 536 __ZNK3JSC16JSVariableObject16isVariableObjectEv537 536 __ZNK3JSC17DebuggerCallFrame10thisObjectEv 538 537 __ZNK3JSC17DebuggerCallFrame12functionNameEv -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r98624 r98747 234 234 ?isValidAllocation@Heap@JSC@@AAE_NI@Z 235 235 ?isValidCallee@JSValue@JSC@@QAE_NXZ 236 ?isVariableObject@JSVariableObject@JSC@@UBE_NXZ237 236 ?jsOwnedString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z 238 237 ?jsString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.h
r94929 r98747 34 34 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) 35 35 { 36 return Structure::create(globalData, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), &s_info);36 return Structure::create(globalData, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), &s_info); 37 37 } 38 38 … … 57 57 void clearAppendSourceToMessage() { m_appendSourceToMessage = false; } 58 58 59 virtual bool isErrorInstance() const { return true; }60 61 59 protected: 62 60 explicit ErrorInstance(JSGlobalData&, Structure*); -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.h
r98501 r98747 43 43 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) 44 44 { 45 return Structure::create(globalData, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), &s_info);45 return Structure::create(globalData, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), &s_info); 46 46 } 47 47 -
trunk/Source/JavaScriptCore/runtime/JSActivation.h
r98593 r98747 60 60 virtual bool isDynamicScope(bool& requiresDynamicChecks) const; 61 61 62 virtual bool isActivationObject() const { return true; }63 64 62 static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); 65 63 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode); … … 76 74 static const ClassInfo s_info; 77 75 78 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo( ObjectType, StructureFlags), &s_info); }76 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(ActivationObjectType, StructureFlags), &s_info); } 79 77 80 78 protected: -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r98501 r98747 268 268 ScopeChainNode* globalScopeChain() { return m_globalScopeChain.get(); } 269 269 270 virtual bool isGlobalObject() const { return true; }271 272 270 ExecState* globalExec(); 273 271 … … 289 287 static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) 290 288 { 291 return Structure::create(globalData, 0, prototype, TypeInfo( ObjectType, StructureFlags), &s_info);289 return Structure::create(globalData, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), &s_info); 292 290 } 293 291 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r98593 r98747 192 192 virtual bool defineOwnProperty(ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); 193 193 194 virtual bool isGlobalObject() const { return false; }195 virtual bool isVariableObject() const { return false; }196 virtual bool isActivationObject() const { return false; }197 virtual bool isErrorInstance() const { return false; }194 bool isGlobalObject() const; 195 bool isVariableObject() const; 196 bool isActivationObject() const; 197 bool isErrorInstance() const; 198 198 199 199 void seal(JSGlobalData&); … … 403 403 { 404 404 return OBJECT_OFFSETOF(JSObject, m_inheritorID); 405 } 406 407 inline bool JSObject::isGlobalObject() const 408 { 409 return structure()->typeInfo().type() == GlobalObjectType; 410 } 411 412 inline bool JSObject::isVariableObject() const 413 { 414 return structure()->typeInfo().type() >= VariableObjectType; 415 } 416 417 inline bool JSObject::isActivationObject() const 418 { 419 return structure()->typeInfo().type() == ActivationObjectType; 420 } 421 422 inline bool JSObject::isErrorInstance() const 423 { 424 return structure()->typeInfo().type() == ErrorInstanceType; 405 425 } 406 426 -
trunk/Source/JavaScriptCore/runtime/JSType.h
r95893 r98747 43 43 JSFunctionType = 12, 44 44 NumberObjectType = 13, 45 ErrorInstanceType = 14, 46 47 // VariableObjectType must be less than all of the types of its subclasses and only its subclasses. 48 VariableObjectType = 15, 49 GlobalObjectType = 16, 50 ActivationObjectType = 17, 45 51 }; 46 52 -
trunk/Source/JavaScriptCore/runtime/JSVariableObject.cpp
r98422 r98747 55 55 } 56 56 57 bool JSVariableObject::isVariableObject() const58 {59 return true;60 }61 62 57 bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDescriptor& descriptor) 63 58 { -
trunk/Source/JavaScriptCore/runtime/JSVariableObject.h
r98422 r98747 54 54 virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); 55 55 56 virtual bool isVariableObject() const;57 56 virtual bool isDynamicScope(bool& requiresDynamicChecks) const = 0; 58 57 … … 64 63 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) 65 64 { 66 return Structure::create(globalData, globalObject, prototype, TypeInfo( ObjectType, StructureFlags), &s_info);65 return Structure::create(globalData, globalObject, prototype, TypeInfo(VariableObjectType, StructureFlags), &s_info); 67 66 } 68 67 -
trunk/Source/WebCore/ChangeLog
r98745 r98747 1 2011-10-28 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize isGlobalObject, isVariableObject, isActivationObject, and isErrorInstance in JSObject 4 https://bugs.webkit.org/show_bug.cgi?id=70968 5 6 Reviewed by Geoffrey Garen. 7 8 No new tests. 9 10 * bindings/js/JSDOMGlobalObject.h: Changed JSType provided to TypeInfo in createStructure since this 11 class inherits from JSGlobalObject. 12 (WebCore::JSDOMGlobalObject::createStructure): 13 * bindings/js/JSDOMWindowBase.h: Ditto 14 (WebCore::JSDOMWindowBase::createStructure): 15 * bindings/js/JSWorkerContextBase.h: Ditto 16 (WebCore::JSWorkerContextBase::createStructure): 17 * bindings/scripts/CodeGeneratorJS.pm: Added extra check to make sure subclasses of JSGlobalObject, 18 namely JSDOMWindow and JSWorkerContext, get their special JSType in their createStructure function. 19 (GenerateHeader): 20 1 21 2011-10-28 Sheriff Bot <webkit.review.bot@gmail.com> 2 22 -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.h
r96836 r98747 76 76 static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) 77 77 { 78 return JSC::Structure::create(globalData, 0, prototype, JSC::TypeInfo(JSC:: ObjectType, StructureFlags), &s_info);78 return JSC::Structure::create(globalData, 0, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), &s_info); 79 79 } 80 80 -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h
r98593 r98747 54 54 static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) 55 55 { 56 return JSC::Structure::create(globalData, 0, prototype, JSC::TypeInfo(JSC:: ObjectType, StructureFlags), &s_info);56 return JSC::Structure::create(globalData, 0, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), &s_info); 57 57 } 58 58 -
trunk/Source/WebCore/bindings/js/JSWorkerContextBase.h
r96836 r98747 51 51 static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) 52 52 { 53 return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC:: ObjectType, StructureFlags), &s_info);53 return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), &s_info); 54 54 } 55 55 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r98679 r98747 809 809 $structureFlags{"JSC::ImplementsHasInstance"} = 1; 810 810 } 811 push(@headerContent, 812 " static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)\n" . 813 " {\n" . 814 " return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);\n" . 815 " }\n\n"); 811 push(@headerContent, " static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)\n"); 812 push(@headerContent, " {\n"); 813 if ($interfaceName eq "DOMWindow" || $dataNode->extendedAttributes->{"IsWorkerContext"}) { 814 push(@headerContent, " return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), &s_info);\n"); 815 } else { 816 push(@headerContent, " return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);\n"); 817 } 818 push(@headerContent, " }\n\n"); 816 819 817 820 # Custom pushEventHandlerScope function
Note:
See TracChangeset
for help on using the changeset viewer.