Changeset 99768 in webkit
- Timestamp:
- Nov 9, 2011, 3:21:56 PM (14 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r99767 r99768 1 2011-11-09 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 De-virtualize JSVariableObject::isDynamicScope 4 https://bugs.webkit.org/show_bug.cgi?id=71933 5 6 Reviewed by Geoffrey Garen. 7 8 * runtime/JSActivation.cpp: 9 * runtime/JSActivation.h: Inlined and de-virtualized isDynamicScope 10 (JSC::JSActivation::isDynamicScope): 11 * runtime/JSGlobalObject.cpp: 12 * runtime/JSGlobalObject.h: Inlined and de-virtualized isDynamicScope 13 (JSC::JSGlobalObject::isDynamicScope): 14 * runtime/JSStaticScopeObject.cpp: 15 * runtime/JSStaticScopeObject.h: Inlined and de-virtualized isDynamicScope 16 (JSC::JSStaticScopeObject::createStructure): Changed createStructure to use new JSType 17 (JSC::JSStaticScopeObject::isDynamicScope): 18 * runtime/JSType.h: Added new type for JSStaticScopeObject 19 * runtime/JSVariableObject.cpp: De-virtualized and added an implementation that checks the 20 object's type and calls the corresponding implementation. 21 (JSC::JSVariableObject::isDynamicScope): 22 * runtime/JSVariableObject.h: 23 1 24 2011-11-09 Mark Hahnenberg <mhahnenberg@apple.com> 2 25 -
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r99497 r99768 210 210 } 211 211 212 bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const213 {214 requiresDynamicChecks = m_requiresDynamicChecks;215 return false;216 }217 218 212 JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&) 219 213 { -
trunk/Source/JavaScriptCore/runtime/JSActivation.h
r99497 r99768 109 109 } 110 110 111 inline bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const 112 { 113 requiresDynamicChecks = m_requiresDynamicChecks; 114 return false; 115 } 116 111 117 } // namespace JSC 112 118 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r99754 r99768 396 396 } 397 397 398 bool JSGlobalObject::isDynamicScope(bool&) const399 {400 return true;401 }402 403 398 void JSGlobalObject::resizeRegisters(size_t newSize) 404 399 { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r99767 r99768 274 274 virtual bool allowsAccessFrom(const JSGlobalObject*) const { return true; } 275 275 276 virtualbool isDynamicScope(bool& requiresDynamicChecks) const;276 bool isDynamicScope(bool& requiresDynamicChecks) const; 277 277 278 278 void setEvalEnabled(bool enabled) { m_evalEnabled = enabled; } … … 474 474 }; 475 475 476 inline bool JSGlobalObject::isDynamicScope(bool&) const 477 { 478 return true; 479 } 480 476 481 } // namespace JSC 477 482 -
trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp
r99497 r99768 83 83 } 84 84 85 bool JSStaticScopeObject::isDynamicScope(bool&) const86 {87 return false;88 }89 90 85 bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, const Identifier& propertyName, PropertySlot& slot) 91 86 { -
trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
r99497 r99768 50 50 static void putWithAttributes(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes); 51 51 52 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo( ObjectType, StructureFlags), &s_info); }52 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(StaticScopeObjectType, StructureFlags), &s_info); } 53 53 54 54 static const ClassInfo s_info; … … 73 73 }; 74 74 75 inline bool JSStaticScopeObject::isDynamicScope(bool&) const 76 { 77 return false; 78 } 79 75 80 } 76 81 -
trunk/Source/JavaScriptCore/runtime/JSType.h
r98909 r99768 50 50 GlobalObjectType = 17, 51 51 ActivationObjectType = 18, 52 StaticScopeObjectType = 19, 52 53 }; 53 54 -
trunk/Source/JavaScriptCore/runtime/JSVariableObject.cpp
r99497 r99768 30 30 #include "JSVariableObject.h" 31 31 32 #include "JSActivation.h" 33 #include "JSGlobalObject.h" 34 #include "JSStaticScopeObject.h" 32 35 #include "PropertyNameArray.h" 33 36 #include "PropertyDescriptor.h" … … 75 78 } 76 79 80 bool JSVariableObject::isDynamicScope(bool& requiresDynamicChecks) const 81 { 82 switch (structure()->typeInfo().type()) { 83 case GlobalObjectType: 84 return static_cast<const JSGlobalObject*>(this)->isDynamicScope(requiresDynamicChecks); 85 case ActivationObjectType: 86 return static_cast<const JSActivation*>(this)->isDynamicScope(requiresDynamicChecks); 87 case StaticScopeObjectType: 88 return static_cast<const JSStaticScopeObject*>(this)->isDynamicScope(requiresDynamicChecks); 89 default: 90 ASSERT_NOT_REACHED(); 91 break; 92 } 93 94 return false; 95 } 96 77 97 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSVariableObject.h
r99497 r99768 56 56 static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); 57 57 58 virtual bool isDynamicScope(bool& requiresDynamicChecks) const = 0;58 bool isDynamicScope(bool& requiresDynamicChecks) const; 59 59 60 60 WriteBarrier<Unknown>& registerAt(int index) const { return m_registers[index]; }
Note:
See TracChangeset
for help on using the changeset viewer.