Changeset 201448 in webkit
- Timestamp:
- May 27, 2016, 12:09:35 AM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 68 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r201445 r201448 1 2016-05-26 Gavin & Ellie Barraclough <barraclough@apple.com> 2 3 Static table property lookup should not require getOwnPropertySlot override. 4 https://bugs.webkit.org/show_bug.cgi?id=158059 5 6 Reviewed by Darin Adler. 7 8 Currently JSObject does not handle property lookup of entries in the static 9 table. Each subclass with static properties mut override getOwnPropertySlot, 10 and explicitly call the lookup functions. This has the following drawbacks: 11 12 - Performance: for any class with static properties, property acces becomes 13 virtual (via method table). 14 - Poor encapsulation: implementation detail of static property access is 15 spread throughout & cross projects, rather than being contained in JSObject. 16 - Code size: this results in a great many additional functions. 17 - Inconsistency: static table presence has to be be taken into account in many 18 other operations, e.g. presence of read-only properties for put. 19 - Memory: in order to avoid the virtual lookup, DOM prototypes eagerly reify 20 all properties. This is likely suboptimal. 21 22 Instead, JSObject::getPropertySlot / JSObject::getOwnPropertySlot should be 23 able to handle static properties. 24 25 This is actually a fairly small & simple change. 26 27 The common pattern is for subclasses of JObject to override getOwnPropertySlot 28 to first defer to JSObject for property storage lookup, and only if this fails 29 consult the static table. They just want the static tables to be consulted after 30 regular property storgae lookup. So just add a fast flag in TypeInfo for JSObject 31 to check, and where it is set, do so. Then it's just a question of switching 32 classes over to start setting this flag, and drop the override. 33 34 The new mechanism does change static table lookup order from oldest-ancestor 35 first to most-derived first. The new ordering makes more sense (means derived 36 class static tables can now override entries from parents), and shoudn't affect 37 any existing code (since overriding didn't previously work, there likely aren't 38 shadowing properties in more derived types). 39 40 This patch changes all classes in JavaScriptCore over to using the new mechanism, 41 except JSGlobalObject. I'll move classes in WebCore over as a separate patch 42 (this is also why I've not moved JSGlobalObject in this patch - doing so would 43 move JSDOMWindow, and I'd rather handle that separately). 44 45 * runtime/JSTypeInfo.h: 46 (JSC::TypeInfo::hasStaticPropertyTable): 47 - Add HasStaticPropertyTable flag. 48 * runtime/Lookup.cpp: 49 (JSC::setUpStaticFunctionSlot): 50 - Change setUpStaticFunctionSlot to take a VM&. 51 * runtime/Lookup.h: 52 (JSC::getStaticPropertySlotFromTable): 53 - Added helper function to perform static lookup alone. 54 (JSC::getStaticPropertySlot): 55 (JSC::getStaticFunctionSlot): 56 - setUpStaticFunctionSlot changed to take a VM&. 57 * runtime/JSObject.cpp: 58 (JSC::JSObject::getOwnStaticPropertySlot): 59 - Added, walks ClassInfo chain looking for static properties. 60 * runtime/JSObject.h: 61 (JSC::JSObject::getOwnNonIndexPropertySlot): 62 - getOwnNonIndexPropertySlot is used internally by getPropertySlot 63 & getOwnPropertySlot. If property is not present in storage array 64 then check the static table. 65 * runtime/ArrayConstructor.cpp: 66 (JSC::ArrayConstructor::finishCreation): 67 (JSC::constructArrayWithSizeQuirk): 68 (JSC::ArrayConstructor::getOwnPropertySlot): Deleted. 69 * runtime/ArrayConstructor.h: 70 (JSC::ArrayConstructor::create): 71 * runtime/ArrayIteratorPrototype.cpp: 72 (JSC::ArrayIteratorPrototype::finishCreation): 73 (JSC::ArrayIteratorPrototype::getOwnPropertySlot): Deleted. 74 * runtime/ArrayIteratorPrototype.h: 75 (JSC::ArrayIteratorPrototype::create): 76 (JSC::ArrayIteratorPrototype::ArrayIteratorPrototype): 77 * runtime/BooleanPrototype.cpp: 78 (JSC::BooleanPrototype::finishCreation): 79 (JSC::booleanProtoFuncToString): 80 (JSC::BooleanPrototype::getOwnPropertySlot): Deleted. 81 * runtime/BooleanPrototype.h: 82 (JSC::BooleanPrototype::create): 83 * runtime/DateConstructor.cpp: 84 (JSC::DateConstructor::finishCreation): 85 (JSC::millisecondsFromComponents): 86 (JSC::DateConstructor::getOwnPropertySlot): Deleted. 87 * runtime/DateConstructor.h: 88 (JSC::DateConstructor::create): 89 * runtime/DatePrototype.cpp: 90 (JSC::DatePrototype::finishCreation): 91 (JSC::dateProtoFuncToString): 92 (JSC::DatePrototype::getOwnPropertySlot): Deleted. 93 * runtime/DatePrototype.h: 94 (JSC::DatePrototype::create): 95 * runtime/ErrorPrototype.cpp: 96 (JSC::ErrorPrototype::finishCreation): 97 (JSC::ErrorPrototype::getOwnPropertySlot): Deleted. 98 * runtime/ErrorPrototype.h: 99 (JSC::ErrorPrototype::create): 100 * runtime/GeneratorPrototype.cpp: 101 (JSC::GeneratorPrototype::finishCreation): 102 (JSC::GeneratorPrototype::getOwnPropertySlot): Deleted. 103 * runtime/GeneratorPrototype.h: 104 (JSC::GeneratorPrototype::create): 105 (JSC::GeneratorPrototype::createStructure): 106 (JSC::GeneratorPrototype::GeneratorPrototype): 107 * runtime/InspectorInstrumentationObject.cpp: 108 (JSC::InspectorInstrumentationObject::finishCreation): 109 (JSC::InspectorInstrumentationObject::isEnabled): 110 (JSC::InspectorInstrumentationObject::getOwnPropertySlot): Deleted. 111 * runtime/InspectorInstrumentationObject.h: 112 (JSC::InspectorInstrumentationObject::create): 113 (JSC::InspectorInstrumentationObject::createStructure): 114 * runtime/IntlCollatorConstructor.cpp: 115 (JSC::IntlCollatorConstructor::getCallData): 116 (JSC::IntlCollatorConstructorFuncSupportedLocalesOf): 117 (JSC::IntlCollatorConstructor::getOwnPropertySlot): Deleted. 118 * runtime/IntlCollatorConstructor.h: 119 * runtime/IntlCollatorPrototype.cpp: 120 (JSC::IntlCollatorPrototype::finishCreation): 121 (JSC::IntlCollatorFuncCompare): 122 (JSC::IntlCollatorPrototype::getOwnPropertySlot): Deleted. 123 * runtime/IntlCollatorPrototype.h: 124 * runtime/IntlDateTimeFormatConstructor.cpp: 125 (JSC::IntlDateTimeFormatConstructor::getCallData): 126 (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf): 127 (JSC::IntlDateTimeFormatConstructor::getOwnPropertySlot): Deleted. 128 * runtime/IntlDateTimeFormatConstructor.h: 129 * runtime/IntlDateTimeFormatPrototype.cpp: 130 (JSC::IntlDateTimeFormatPrototype::finishCreation): 131 (JSC::IntlDateTimeFormatFuncFormatDateTime): 132 (JSC::IntlDateTimeFormatPrototype::getOwnPropertySlot): Deleted. 133 * runtime/IntlDateTimeFormatPrototype.h: 134 * runtime/IntlNumberFormatConstructor.cpp: 135 (JSC::IntlNumberFormatConstructor::getCallData): 136 (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf): 137 (JSC::IntlNumberFormatConstructor::getOwnPropertySlot): Deleted. 138 * runtime/IntlNumberFormatConstructor.h: 139 * runtime/IntlNumberFormatPrototype.cpp: 140 (JSC::IntlNumberFormatPrototype::finishCreation): 141 (JSC::IntlNumberFormatFuncFormatNumber): 142 (JSC::IntlNumberFormatPrototype::getOwnPropertySlot): Deleted. 143 * runtime/IntlNumberFormatPrototype.h: 144 * runtime/JSDataViewPrototype.cpp: 145 (JSC::JSDataViewPrototype::createStructure): 146 (JSC::getData): 147 (JSC::JSDataViewPrototype::getOwnPropertySlot): Deleted. 148 * runtime/JSDataViewPrototype.h: 149 * runtime/JSInternalPromiseConstructor.cpp: 150 (JSC::JSInternalPromiseConstructor::getCallData): 151 (JSC::JSInternalPromiseConstructor::getOwnPropertySlot): Deleted. 152 * runtime/JSInternalPromiseConstructor.h: 153 * runtime/JSONObject.cpp: 154 (JSC::Walker::Walker): 155 (JSC::JSONObject::getOwnPropertySlot): Deleted. 156 * runtime/JSONObject.h: 157 (JSC::JSONObject::create): 158 * runtime/JSPromiseConstructor.cpp: 159 (JSC::JSPromiseConstructor::getCallData): 160 (JSC::JSPromiseConstructor::getOwnPropertySlot): Deleted. 161 * runtime/JSPromiseConstructor.h: 162 * runtime/JSPromisePrototype.cpp: 163 (JSC::JSPromisePrototype::addOwnInternalSlots): 164 (JSC::JSPromisePrototype::getOwnPropertySlot): Deleted. 165 * runtime/JSPromisePrototype.h: 166 * runtime/MapPrototype.cpp: 167 (JSC::MapPrototype::finishCreation): 168 (JSC::getMap): 169 (JSC::MapPrototype::getOwnPropertySlot): Deleted. 170 * runtime/MapPrototype.h: 171 (JSC::MapPrototype::create): 172 (JSC::MapPrototype::MapPrototype): 173 * runtime/ModuleLoaderObject.cpp: 174 (JSC::ModuleLoaderObject::finishCreation): 175 (JSC::printableModuleKey): 176 (JSC::ModuleLoaderObject::getOwnPropertySlot): Deleted. 177 * runtime/ModuleLoaderObject.h: 178 * runtime/NumberPrototype.cpp: 179 (JSC::NumberPrototype::finishCreation): 180 (JSC::toThisNumber): 181 (JSC::NumberPrototype::getOwnPropertySlot): Deleted. 182 * runtime/NumberPrototype.h: 183 (JSC::NumberPrototype::create): 184 * runtime/ObjectConstructor.cpp: 185 (JSC::ObjectConstructor::addDefineProperty): 186 (JSC::constructObject): 187 (JSC::ObjectConstructor::getOwnPropertySlot): Deleted. 188 * runtime/ObjectConstructor.h: 189 (JSC::ObjectConstructor::create): 190 (JSC::ObjectConstructor::createStructure): 191 * runtime/ReflectObject.cpp: 192 (JSC::ReflectObject::finishCreation): 193 (JSC::ReflectObject::getOwnPropertySlot): Deleted. 194 * runtime/ReflectObject.h: 195 (JSC::ReflectObject::create): 196 (JSC::ReflectObject::createStructure): 197 * runtime/RegExpConstructor.cpp: 198 (JSC::RegExpConstructor::getRightContext): 199 (JSC::regExpConstructorDollar): 200 (JSC::RegExpConstructor::getOwnPropertySlot): Deleted. 201 * runtime/RegExpConstructor.h: 202 (JSC::RegExpConstructor::create): 203 (JSC::RegExpConstructor::createStructure): 204 * runtime/SetPrototype.cpp: 205 (JSC::SetPrototype::finishCreation): 206 (JSC::getSet): 207 (JSC::SetPrototype::getOwnPropertySlot): Deleted. 208 * runtime/SetPrototype.h: 209 (JSC::SetPrototype::create): 210 (JSC::SetPrototype::SetPrototype): 211 * runtime/StringConstructor.cpp: 212 (JSC::StringConstructor::finishCreation): 213 (JSC::stringFromCharCodeSlowCase): 214 (JSC::StringConstructor::getOwnPropertySlot): Deleted. 215 * runtime/StringConstructor.h: 216 (JSC::StringConstructor::create): 217 * runtime/StringIteratorPrototype.cpp: 218 (JSC::StringIteratorPrototype::finishCreation): 219 (JSC::StringIteratorPrototype::getOwnPropertySlot): Deleted. 220 * runtime/StringIteratorPrototype.h: 221 (JSC::StringIteratorPrototype::create): 222 (JSC::StringIteratorPrototype::StringIteratorPrototype): 223 * runtime/StringPrototype.cpp: 224 (JSC::StringPrototype::create): 225 (JSC::substituteBackreferencesSlow): 226 (JSC::StringPrototype::getOwnPropertySlot): Deleted. 227 * runtime/StringPrototype.h: 228 * runtime/SymbolConstructor.cpp: 229 (JSC::SymbolConstructor::finishCreation): 230 (JSC::callSymbol): 231 (JSC::SymbolConstructor::getOwnPropertySlot): Deleted. 232 * runtime/SymbolConstructor.h: 233 (JSC::SymbolConstructor::create): 234 * runtime/SymbolPrototype.cpp: 235 (JSC::SymbolPrototype::finishCreation): 236 (JSC::SymbolPrototype::getOwnPropertySlot): Deleted. 237 * runtime/SymbolPrototype.h: 238 (JSC::SymbolPrototype::create): 239 - remove getOwnPropertySlot, replace OverridesGetOwnPropertySlot flag with HasStaticPropertyTable. 240 1 241 2016-05-26 Commit Queue <commit-queue@webkit.org> 2 242 -
trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
r201049 r201448 72 72 } 73 73 74 bool ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)75 {76 return getStaticFunctionSlot<InternalFunction>(exec, arrayConstructorTable, jsCast<ArrayConstructor*>(object), propertyName, slot);77 }78 79 74 // ------------------------------ Functions --------------------------- 80 75 -
trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h
r201049 r201448 35 35 public: 36 36 typedef InternalFunction Base; 37 static const unsigned StructureFlags = OverridesGetOwnPropertySlot| InternalFunction::StructureFlags;37 static const unsigned StructureFlags = HasStaticPropertyTable | InternalFunction::StructureFlags; 38 38 39 39 static ArrayConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype, GetterSetter* speciesSymbol) … … 56 56 private: 57 57 ArrayConstructor(VM&, Structure*); 58 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);59 58 60 59 static ConstructType getConstructData(JSCell*, ConstructData&); -
trunk/Source/JavaScriptCore/runtime/ArrayIteratorPrototype.cpp
r200499 r201448 56 56 } 57 57 58 bool ArrayIteratorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)59 {60 return getStaticFunctionSlot<Base>(exec, arrayIteratorPrototypeTable, jsCast<ArrayIteratorPrototype*>(object), propertyName, slot);61 }62 63 58 // ------------------------------ Array Functions ---------------------------- 64 59 -
trunk/Source/JavaScriptCore/runtime/ArrayIteratorPrototype.h
r182747 r201448 34 34 public: 35 35 typedef JSNonFinalObject Base; 36 static const unsigned StructureFlags = OverridesGetOwnPropertySlot| Base::StructureFlags;36 static const unsigned StructureFlags = HasStaticPropertyTable | Base::StructureFlags; 37 37 38 38 static ArrayIteratorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 57 57 58 58 void finishCreation(VM&, JSGlobalObject*); 59 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);60 59 }; 61 60 -
trunk/Source/JavaScriptCore/runtime/BooleanPrototype.cpp
r171824 r201448 64 64 } 65 65 66 bool BooleanPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)67 {68 return getStaticFunctionSlot<BooleanObject>(exec, booleanPrototypeTable, jsCast<BooleanPrototype*>(object), propertyName, slot);69 }70 71 66 // ------------------------------ Functions --------------------------- 72 67 -
trunk/Source/JavaScriptCore/runtime/BooleanPrototype.h
r182747 r201448 29 29 public: 30 30 typedef BooleanObject Base; 31 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;31 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 32 32 33 33 static BooleanPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 50 50 private: 51 51 BooleanPrototype(VM&, Structure*); 52 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);53 52 }; 54 53 -
trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp
r197614 r201448 106 106 putDirectWithoutTransition(vm, vm.propertyNames->prototype, datePrototype, DontEnum | DontDelete | ReadOnly); 107 107 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(7), ReadOnly | DontEnum | DontDelete); 108 }109 110 bool DateConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)111 {112 return getStaticFunctionSlot<InternalFunction>(exec, dateConstructorTable, jsCast<DateConstructor*>(object), propertyName, slot);113 108 } 114 109 -
trunk/Source/JavaScriptCore/runtime/DateConstructor.h
r195460 r201448 32 32 public: 33 33 typedef InternalFunction Base; 34 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;34 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 35 35 36 36 static DateConstructor* create(VM& vm, Structure* structure, DatePrototype* datePrototype, GetterSetter*) … … 55 55 static ConstructType getConstructData(JSCell*, ConstructData&); 56 56 static CallType getCallData(JSCell*, CallData&); 57 58 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);59 57 }; 60 58 -
trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp
r197614 r201448 505 505 } 506 506 507 bool DatePrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)508 {509 return getStaticFunctionSlot<JSObject>(exec, dateTable, jsCast<DatePrototype*>(object), propertyName, slot);510 }511 512 507 // Functions 513 508 -
trunk/Source/JavaScriptCore/runtime/DatePrototype.h
r195138 r201448 34 34 public: 35 35 typedef JSNonFinalObject Base; 36 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;36 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 37 37 38 38 static DatePrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 42 42 return prototype; 43 43 } 44 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);45 44 46 45 DECLARE_INFO; -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
r198469 r201448 61 61 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("Error"))), DontEnum); 62 62 putDirect(vm, vm.propertyNames->message, jsEmptyString(&vm), DontEnum); 63 }64 65 bool ErrorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)66 {67 return getStaticFunctionSlot<ErrorInstance>(exec, errorPrototypeTable, jsCast<ErrorPrototype*>(object), propertyName, slot);68 63 } 69 64 -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.h
r198469 r201448 31 31 public: 32 32 typedef JSNonFinalObject Base; 33 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;33 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 34 34 35 35 static ErrorPrototype* create(VM& vm, JSGlobalObject*, Structure* structure) … … 50 50 ErrorPrototype(VM&, Structure*); 51 51 void finishCreation(VM&); 52 53 private:54 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);55 52 }; 56 53 -
trunk/Source/JavaScriptCore/runtime/GeneratorPrototype.cpp
r192937 r201448 55 55 } 56 56 57 bool GeneratorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)58 {59 return getStaticFunctionSlot<Base>(exec, generatorPrototypeTable, jsCast<GeneratorPrototype*>(object), propertyName, slot);60 }61 62 57 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/GeneratorPrototype.h
r192937 r201448 34 34 public: 35 35 typedef JSNonFinalObject Base; 36 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;36 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 37 37 38 38 static GeneratorPrototype* create(VM& vm, JSGlobalObject*, Structure* structure) … … 50 50 } 51 51 52 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);53 54 52 private: 55 53 GeneratorPrototype(VM& vm, Structure* structure) -
trunk/Source/JavaScriptCore/runtime/InspectorInstrumentationObject.cpp
r192204 r201448 65 65 } 66 66 67 bool InspectorInstrumentationObject::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)68 {69 return getStaticFunctionSlot<Base>(exec, inspectorInstrumentationObjectTable, jsCast<InspectorInstrumentationObject*>(object), propertyName, slot);70 }71 72 67 bool InspectorInstrumentationObject::isEnabled(VM& vm) const 73 68 { -
trunk/Source/JavaScriptCore/runtime/InspectorInstrumentationObject.h
r188497 r201448 37 37 public: 38 38 typedef JSNonFinalObject Base; 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;39 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 40 40 41 41 static InspectorInstrumentationObject* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 53 53 } 54 54 55 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);56 57 55 void enable(VM&); 58 56 void disable(VM&); -
trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.cpp
r200928 r201448 136 136 } 137 137 138 bool IntlCollatorConstructor::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)139 {140 return getStaticFunctionSlot<InternalFunction>(state, collatorConstructorTable, jsCast<IntlCollatorConstructor*>(object), propertyName, slot);141 }142 143 138 EncodedJSValue JSC_HOST_CALL IntlCollatorConstructorFuncSupportedLocalesOf(ExecState* state) 144 139 { -
trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.h
r191286 r201448 39 39 public: 40 40 typedef InternalFunction Base; 41 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;41 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 42 42 43 43 static IntlCollatorConstructor* create(VM&, Structure*, IntlCollatorPrototype*, Structure*); … … 55 55 static ConstructType getConstructData(JSCell*, ConstructData&); 56 56 static CallType getCallData(JSCell*, CallData&); 57 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);58 57 static void visitChildren(JSCell*, SlotVisitor&); 59 58 -
trunk/Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp
r199946 r201448 80 80 } 81 81 82 bool IntlCollatorPrototype::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)83 {84 return getStaticFunctionSlot<JSObject>(state, collatorPrototypeTable, jsCast<IntlCollatorPrototype*>(object), propertyName, slot);85 }86 87 82 static EncodedJSValue JSC_HOST_CALL IntlCollatorFuncCompare(ExecState* state) 88 83 { -
trunk/Source/JavaScriptCore/runtime/IntlCollatorPrototype.h
r187575 r201448 37 37 public: 38 38 typedef IntlCollator Base; 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;39 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 40 40 41 41 static IntlCollatorPrototype* create(VM&, JSGlobalObject*, Structure*); … … 49 49 private: 50 50 IntlCollatorPrototype(VM&, Structure*); 51 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);52 51 }; 53 52 -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.cpp
r200928 r201448 136 136 } 137 137 138 bool IntlDateTimeFormatConstructor::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)139 {140 return getStaticFunctionSlot<InternalFunction>(state, dateTimeFormatConstructorTable, jsCast<IntlDateTimeFormatConstructor*>(object), propertyName, slot);141 }142 143 138 EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatConstructorFuncSupportedLocalesOf(ExecState* state) 144 139 { -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.h
r191286 r201448 39 39 public: 40 40 typedef InternalFunction Base; 41 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;41 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 42 42 43 43 static IntlDateTimeFormatConstructor* create(VM&, Structure*, IntlDateTimeFormatPrototype*, Structure*); … … 55 55 static ConstructType getConstructData(JSCell*, ConstructData&); 56 56 static CallType getCallData(JSCell*, CallData&); 57 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);58 57 static void visitChildren(JSCell*, SlotVisitor&); 59 58 -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp
r200928 r201448 79 79 { 80 80 Base::finishCreation(vm); 81 }82 83 bool IntlDateTimeFormatPrototype::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)84 {85 return getStaticFunctionSlot<JSObject>(state, dateTimeFormatPrototypeTable, jsCast<IntlDateTimeFormatPrototype*>(object), propertyName, slot);86 81 } 87 82 -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.h
r187575 r201448 37 37 public: 38 38 typedef IntlDateTimeFormat Base; 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;39 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 40 40 41 41 static IntlDateTimeFormatPrototype* create(VM&, JSGlobalObject*, Structure*); … … 49 49 private: 50 50 IntlDateTimeFormatPrototype(VM&, Structure*); 51 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);52 51 }; 53 52 -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp
r200928 r201448 136 136 } 137 137 138 bool IntlNumberFormatConstructor::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)139 {140 return getStaticFunctionSlot<InternalFunction>(state, numberFormatConstructorTable, jsCast<IntlNumberFormatConstructor*>(object), propertyName, slot);141 }142 143 138 EncodedJSValue JSC_HOST_CALL IntlNumberFormatConstructorFuncSupportedLocalesOf(ExecState* state) 144 139 { -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.h
r191286 r201448 39 39 public: 40 40 typedef InternalFunction Base; 41 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;41 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 42 42 43 43 static IntlNumberFormatConstructor* create(VM&, Structure*, IntlNumberFormatPrototype*, Structure*); … … 55 55 static ConstructType getConstructData(JSCell*, ConstructData&); 56 56 static CallType getCallData(JSCell*, CallData&); 57 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);58 57 static void visitChildren(JSCell*, SlotVisitor&); 59 58 -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp
r200928 r201448 79 79 } 80 80 81 bool IntlNumberFormatPrototype::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)82 {83 return getStaticFunctionSlot<JSObject>(state, numberFormatPrototypeTable, jsCast<IntlNumberFormatPrototype*>(object), propertyName, slot);84 }85 86 81 static EncodedJSValue JSC_HOST_CALL IntlNumberFormatFuncFormatNumber(ExecState* state) 87 82 { -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.h
r187575 r201448 37 37 public: 38 38 typedef IntlNumberFormat Base; 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;39 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 40 40 41 41 static IntlNumberFormatPrototype* create(VM&, JSGlobalObject*, Structure*); … … 49 49 private: 50 50 IntlNumberFormatPrototype(VM&, Structure*); 51 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);52 51 }; 53 52 -
trunk/Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp
r198435 r201448 120 120 } 121 121 122 bool JSDataViewPrototype::getOwnPropertySlot(123 JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)124 {125 return getStaticFunctionSlot<JSObject>(126 exec, dataViewTable, jsCast<JSDataViewPrototype*>(object),127 propertyName, slot);128 }129 130 122 template<typename Adaptor> 131 123 EncodedJSValue getData(ExecState* exec) -
trunk/Source/JavaScriptCore/runtime/JSDataViewPrototype.h
r191864 r201448 34 34 public: 35 35 typedef JSNonFinalObject Base; 36 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;36 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 37 37 38 38 protected: … … 47 47 48 48 static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype); 49 50 protected:51 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);52 49 }; 53 50 -
trunk/Source/JavaScriptCore/runtime/JSInternalPromiseConstructor.cpp
r197614 r201448 86 86 } 87 87 88 bool JSInternalPromiseConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)89 {90 return getStaticFunctionSlot<Base>(exec, internalPromiseConstructorTable, jsCast<JSInternalPromiseConstructor*>(object), propertyName, slot);91 }92 93 88 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSInternalPromiseConstructor.h
r195460 r201448 37 37 public: 38 38 typedef JSPromiseConstructor Base; 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;39 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 40 40 41 41 static JSInternalPromiseConstructor* create(VM&, Structure*, JSInternalPromisePrototype*, GetterSetter*); … … 48 48 static ConstructType getConstructData(JSCell*, ConstructData&); 49 49 static CallType getCallData(JSCell*, CallData&); 50 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);51 50 }; 52 51 -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r198150 r201448 552 552 553 553 // ECMA 15.8 554 555 bool JSONObject::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)556 {557 return getStaticFunctionSlot<JSObject>(exec, jsonTable, jsCast<JSONObject*>(object), propertyName, slot);558 }559 554 560 555 class Walker { -
trunk/Source/JavaScriptCore/runtime/JSONObject.h
r190888 r201448 34 34 public: 35 35 typedef JSNonFinalObject Base; 36 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;36 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 37 37 38 38 static JSONObject* create(VM& vm, Structure* structure) … … 55 55 private: 56 56 JSONObject(VM&, Structure*); 57 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);58 57 }; 59 58 -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r201315 r201448 1673 1673 number = result.toNumber(exec); 1674 1674 return !result.isString(); 1675 } 1676 1677 bool JSObject::getOwnStaticPropertySlot(VM& vm, PropertyName propertyName, PropertySlot& slot) 1678 { 1679 for (auto* info = classInfo(); info; info = info->parentClass) { 1680 if (auto* table = info->staticPropHashTable) { 1681 if (getStaticPropertySlotFromTable(vm, *table, this, propertyName, slot)) 1682 return true; 1683 } 1684 } 1685 return false; 1675 1686 } 1676 1687 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r199075 r201448 88 88 friend class JSFinalObject; 89 89 friend class MarkedBlock; 90 JS_EXPORT_PRIVATE friend bool setUpStaticFunctionSlot( ExecState*, const HashTableValue*, JSObject*, PropertyName, PropertySlot&);90 JS_EXPORT_PRIVATE friend bool setUpStaticFunctionSlot(VM&, const HashTableValue*, JSObject*, PropertyName, PropertySlot&); 91 91 92 92 enum PutMode { … … 923 923 void fillCustomGetterPropertySlot(PropertySlot&, JSValue, unsigned, Structure&); 924 924 925 JS_EXPORT_PRIVATE bool getOwnStaticPropertySlot(VM&, PropertyName, PropertySlot&); 925 926 JS_EXPORT_PRIVATE const HashTableValue* findPropertyHashEntry(PropertyName) const; 926 927 … … 1193 1194 unsigned attributes; 1194 1195 PropertyOffset offset = structure.get(vm, propertyName, attributes); 1195 if (!isValidOffset(offset)) 1196 return false; 1196 if (!isValidOffset(offset)) { 1197 if (!TypeInfo::hasStaticPropertyTable(inlineTypeFlags())) 1198 return false; 1199 return getOwnStaticPropertySlot(vm, propertyName, slot); 1200 } 1197 1201 1198 1202 // getPropertySlot relies on this method never returning index properties! -
trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
r197614 r201448 134 134 } 135 135 136 bool JSPromiseConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)137 {138 return getStaticFunctionSlot<Base>(exec, promiseConstructorTable, jsCast<JSPromiseConstructor*>(object), propertyName, slot);139 }140 141 136 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.h
r195460 r201448 38 38 public: 39 39 typedef InternalFunction Base; 40 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 42 static JSPromiseConstructor* create(VM&, Structure*, JSPromisePrototype*, GetterSetter* speciesSymbol); … … 44 44 45 45 DECLARE_INFO; 46 47 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);48 46 49 47 protected: -
trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.cpp
r195528 r201448 86 86 } 87 87 88 bool JSPromisePrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)89 {90 return getStaticFunctionSlot<Base>(exec, promisePrototypeTable, jsCast<JSPromisePrototype*>(object), propertyName, slot);91 }92 93 88 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSPromisePrototype.h
r192157 r201448 34 34 public: 35 35 typedef JSNonFinalObject Base; 36 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;36 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 37 37 38 38 static JSPromisePrototype* create(VM&, JSGlobalObject*, Structure*); … … 40 40 41 41 DECLARE_INFO; 42 43 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);44 42 45 43 protected: -
trunk/Source/JavaScriptCore/runtime/JSTypeInfo.h
r199686 r201448 44 44 static const unsigned StructureIsImmortal = 1 << 5; 45 45 static const unsigned OverridesToThis = 1 << 6; // If this is false then this returns something other than 'this'. Non-object cells that are visible to JS have this set as do some exotic objects. 46 // There is one free bit at the end of the InlineTypeFlags. 46 static const unsigned HasStaticPropertyTable = 1 << 7; 47 47 48 48 static const unsigned ImplementsHasInstance = 1 << 8; … … 84 84 bool overridesGetOwnPropertySlot() const { return overridesGetOwnPropertySlot(inlineTypeFlags()); } 85 85 static bool overridesGetOwnPropertySlot(InlineTypeFlags flags) { return flags & OverridesGetOwnPropertySlot; } 86 static bool hasStaticPropertyTable(InlineTypeFlags flags) { return flags & HasStaticPropertyTable; } 86 87 bool interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero() const { return isSetOnFlags1(InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero); } 87 88 bool structureIsImmortal() const { return isSetOnFlags1(StructureIsImmortal); } -
trunk/Source/JavaScriptCore/runtime/Lookup.cpp
r201340 r201448 28 28 namespace JSC { 29 29 30 void reifyStaticAccessor(VM& vm, const HashTableValue& value, JSObject& thisObj , PropertyName propertyName)30 void reifyStaticAccessor(VM& vm, const HashTableValue& value, JSObject& thisObject, PropertyName propertyName) 31 31 { 32 JSGlobalObject* globalObject = thisObj .globalObject();32 JSGlobalObject* globalObject = thisObject.globalObject(); 33 33 GetterSetter* accessor = GetterSetter::create(vm, globalObject); 34 34 if (value.accessorGetter()) { … … 40 40 : JSFunction::create(vm, globalObject, 0, getterName, value.accessorGetter())); 41 41 } 42 thisObj .putDirectNonIndexAccessor(vm, propertyName, accessor, attributesForStructure(value.attributes()));42 thisObject.putDirectNonIndexAccessor(vm, propertyName, accessor, attributesForStructure(value.attributes())); 43 43 } 44 44 45 bool setUpStaticFunctionSlot( ExecState* exec, const HashTableValue* entry, JSObject* thisObj, PropertyName propertyName, PropertySlot& slot)45 bool setUpStaticFunctionSlot(VM& vm, const HashTableValue* entry, JSObject* thisObject, PropertyName propertyName, PropertySlot& slot) 46 46 { 47 ASSERT(thisObj ->globalObject());47 ASSERT(thisObject->globalObject()); 48 48 ASSERT(entry->attributes() & BuiltinOrFunctionOrAccessorOrLazyProperty); 49 VM& vm = exec->vm();50 49 unsigned attributes; 51 50 bool isAccessor = entry->attributes() & Accessor; 52 PropertyOffset offset = thisObj ->getDirectOffset(vm, propertyName, attributes);51 PropertyOffset offset = thisObject->getDirectOffset(vm, propertyName, attributes); 53 52 54 53 if (!isValidOffset(offset)) { 55 54 // If a property is ever deleted from an object with a static table, then we reify 56 55 // all static functions at that time - after this we shouldn't be re-adding anything. 57 if (thisObj ->staticFunctionsReified())56 if (thisObject->staticFunctionsReified()) 58 57 return false; 59 58 60 59 if (entry->attributes() & Builtin) 61 thisObj ->putDirectBuiltinFunction(vm, thisObj->globalObject(), propertyName, entry->builtinGenerator()(vm), attributesForStructure(entry->attributes()));60 thisObject->putDirectBuiltinFunction(vm, thisObject->globalObject(), propertyName, entry->builtinGenerator()(vm), attributesForStructure(entry->attributes())); 62 61 else if (entry->attributes() & Function) { 63 thisObj ->putDirectNativeFunction(64 vm, thisObj ->globalObject(), propertyName, entry->functionLength(),62 thisObject->putDirectNativeFunction( 63 vm, thisObject->globalObject(), propertyName, entry->functionLength(), 65 64 entry->function(), entry->intrinsic(), attributesForStructure(entry->attributes())); 66 65 } else if (isAccessor) 67 reifyStaticAccessor(vm, *entry, *thisObj , propertyName);66 reifyStaticAccessor(vm, *entry, *thisObject, propertyName); 68 67 else if (entry->attributes() & CellProperty) { 69 68 LazyCellProperty* property = bitwise_cast<LazyCellProperty*>( 70 bitwise_cast<char*>(thisObj ) + entry->lazyCellPropertyOffset());71 JSCell* result = property->get(thisObj );72 thisObj ->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes()));69 bitwise_cast<char*>(thisObject) + entry->lazyCellPropertyOffset()); 70 JSCell* result = property->get(thisObject); 71 thisObject->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes())); 73 72 } else if (entry->attributes() & ClassStructure) { 74 73 LazyClassStructure* structure = bitwise_cast<LazyClassStructure*>( 75 bitwise_cast<char*>(thisObj ) + entry->lazyClassStructureOffset());76 structure->get(jsCast<JSGlobalObject*>(thisObj ));74 bitwise_cast<char*>(thisObject) + entry->lazyClassStructureOffset()); 75 structure->get(jsCast<JSGlobalObject*>(thisObject)); 77 76 } else if (entry->attributes() & PropertyCallback) { 78 JSValue result = entry->lazyPropertyCallback()(vm, thisObj );79 thisObj ->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes()));77 JSValue result = entry->lazyPropertyCallback()(vm, thisObject); 78 thisObject->putDirect(vm, propertyName, result, attributesForStructure(entry->attributes())); 80 79 } else { 81 80 dataLog("Static hashtable entry for ", propertyName, " has weird attributes: ", entry->attributes(), "\n"); … … 83 82 } 84 83 85 offset = thisObj ->getDirectOffset(vm, propertyName, attributes);84 offset = thisObject->getDirectOffset(vm, propertyName, attributes); 86 85 if (!isValidOffset(offset)) { 87 86 dataLog("Static hashtable initialiation for ", propertyName, " did not produce a property.\n"); … … 91 90 92 91 if (isAccessor) 93 slot.setCacheableGetterSlot(thisObj , attributes, jsCast<GetterSetter*>(thisObj->getDirect(offset)), offset);92 slot.setCacheableGetterSlot(thisObject, attributes, jsCast<GetterSetter*>(thisObject->getDirect(offset)), offset); 94 93 else 95 slot.setValue(thisObj , attributes, thisObj->getDirect(offset), offset);94 slot.setValue(thisObject, attributes, thisObject->getDirect(offset), offset); 96 95 return true; 97 96 } -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r201428 r201448 192 192 }; 193 193 194 JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot( ExecState*, const HashTableValue*, JSObject* thisObject, PropertyName, PropertySlot&);194 JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot(VM&, const HashTableValue*, JSObject* thisObject, PropertyName, PropertySlot&); 195 195 JS_EXPORT_PRIVATE void reifyStaticAccessor(VM&, const HashTableValue&, JSObject& thisObject, PropertyName); 196 196 … … 207 207 ASSERT(m_attributes & Builtin); 208 208 return reinterpret_cast<BuiltinGenerator>(m_values.value2); 209 } 210 211 inline bool getStaticPropertySlotFromTable(VM& vm, const HashTable& table, JSObject* thisObject, PropertyName propertyName, PropertySlot& slot) 212 { 213 if (thisObject->staticFunctionsReified()) 214 return false; 215 216 auto* entry = table.entry(propertyName); 217 if (!entry) 218 return false; 219 220 if (entry->attributes() & BuiltinOrFunctionOrAccessorOrLazyProperty) 221 return setUpStaticFunctionSlot(vm, entry, thisObject, propertyName, slot); 222 223 if (entry->attributes() & ConstantInteger) { 224 slot.setValue(thisObject, attributesForStructure(entry->attributes()), jsNumber(entry->constantInteger())); 225 return true; 226 } 227 228 slot.setCacheableCustom(thisObject, attributesForStructure(entry->attributes()), entry->propertyGetter()); 229 return true; 209 230 } 210 231 … … 216 237 */ 217 238 template <class ThisImp, class ParentImp> 218 inline bool getStaticPropertySlot(ExecState* exec, const HashTable& table, ThisImp* thisObj , PropertyName propertyName, PropertySlot& slot)219 { 220 if (ParentImp::getOwnPropertySlot(thisObj , exec, propertyName, slot))221 return true; 222 223 if (thisObj ->staticFunctionsReified())239 inline bool getStaticPropertySlot(ExecState* exec, const HashTable& table, ThisImp* thisObject, PropertyName propertyName, PropertySlot& slot) 240 { 241 if (ParentImp::getOwnPropertySlot(thisObject, exec, propertyName, slot)) 242 return true; 243 244 if (thisObject->staticFunctionsReified()) 224 245 return false; 225 246 … … 229 250 230 251 if (entry->attributes() & BuiltinOrFunctionOrAccessorOrLazyProperty) 231 return setUpStaticFunctionSlot(exec , entry, thisObj, propertyName, slot);252 return setUpStaticFunctionSlot(exec->vm(), entry, thisObject, propertyName, slot); 232 253 233 254 if (entry->attributes() & ConstantInteger) { 234 slot.setValue(thisObj , attributesForStructure(entry->attributes()), jsNumber(entry->constantInteger()));235 return true; 236 } 237 238 slot.setCacheableCustom(thisObj , attributesForStructure(entry->attributes()), entry->propertyGetter());255 slot.setValue(thisObject, attributesForStructure(entry->attributes()), jsNumber(entry->constantInteger())); 256 return true; 257 } 258 259 slot.setCacheableCustom(thisObject, attributesForStructure(entry->attributes()), entry->propertyGetter()); 239 260 return true; 240 261 } … … 246 267 */ 247 268 template <class ParentImp> 248 inline bool getStaticFunctionSlot(ExecState* exec, const HashTable& table, JSObject* thisObj , PropertyName propertyName, PropertySlot& slot)249 { 250 if (ParentImp::getOwnPropertySlot(thisObj , exec, propertyName, slot))251 return true; 252 253 if (thisObj ->staticFunctionsReified())269 inline bool getStaticFunctionSlot(ExecState* exec, const HashTable& table, JSObject* thisObject, PropertyName propertyName, PropertySlot& slot) 270 { 271 if (ParentImp::getOwnPropertySlot(thisObject, exec, propertyName, slot)) 272 return true; 273 274 if (thisObject->staticFunctionsReified()) 254 275 return false; 255 276 … … 258 279 return false; 259 280 260 return setUpStaticFunctionSlot(exec , entry, thisObj, propertyName, slot);281 return setUpStaticFunctionSlot(exec->vm(), entry, thisObject, propertyName, slot); 261 282 } 262 283 … … 266 287 */ 267 288 template <class ThisImp, class ParentImp> 268 inline bool getStaticValueSlot(ExecState* exec, const HashTable& table, ThisImp* thisObj , PropertyName propertyName, PropertySlot& slot)269 { 270 if (ParentImp::getOwnPropertySlot(thisObj , exec, propertyName, slot))271 return true; 272 273 if (thisObj ->staticFunctionsReified())289 inline bool getStaticValueSlot(ExecState* exec, const HashTable& table, ThisImp* thisObject, PropertyName propertyName, PropertySlot& slot) 290 { 291 if (ParentImp::getOwnPropertySlot(thisObject, exec, propertyName, slot)) 292 return true; 293 294 if (thisObject->staticFunctionsReified()) 274 295 return false; 275 296 … … 281 302 282 303 if (entry->attributes() & ConstantInteger) { 283 slot.setValue(thisObj , attributesForStructure(entry->attributes()), jsNumber(entry->constantInteger()));284 return true; 285 } 286 287 slot.setCacheableCustom(thisObj , attributesForStructure(entry->attributes()), entry->propertyGetter());304 slot.setValue(thisObject, attributesForStructure(entry->attributes()), jsNumber(entry->constantInteger())); 305 return true; 306 } 307 308 slot.setCacheableCustom(thisObject, attributesForStructure(entry->attributes()), entry->propertyGetter()); 288 309 return true; 289 310 } -
trunk/Source/JavaScriptCore/runtime/MapPrototype.cpp
r200422 r201448 90 90 } 91 91 92 bool MapPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)93 {94 return getStaticFunctionSlot<Base>(exec, mapPrototypeTable, jsCast<MapPrototype*>(object), propertyName, slot);95 }96 97 92 ALWAYS_INLINE static JSMap* getMap(CallFrame* callFrame, JSValue thisValue) 98 93 { -
trunk/Source/JavaScriptCore/runtime/MapPrototype.h
r194838 r201448 35 35 typedef JSNonFinalObject Base; 36 36 37 static const unsigned StructureFlags = OverridesGetOwnPropertySlot| Base::StructureFlags;37 static const unsigned StructureFlags = HasStaticPropertyTable | Base::StructureFlags; 38 38 39 39 static MapPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 57 57 } 58 58 void finishCreation(VM&, JSGlobalObject*); 59 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);60 59 }; 61 60 -
trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp
r197614 r201448 120 120 } 121 121 122 bool ModuleLoaderObject::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)123 {124 return getStaticFunctionSlot<Base>(exec, moduleLoaderObjectTable, jsCast<ModuleLoaderObject*>(object), propertyName, slot);125 }126 127 122 // ------------------------------ Functions -------------------------------- 128 123 -
trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.h
r189941 r201448 38 38 public: 39 39 typedef JSNonFinalObject Base; 40 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;40 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 41 41 42 42 enum Status { … … 78 78 JSValue evaluate(ExecState*, JSValue key, JSValue moduleRecord); 79 79 80 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);81 82 80 protected: 83 81 void finishCreation(VM&, JSGlobalObject*); -
trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp
r199725 r201448 88 88 89 89 ASSERT(inherits(info())); 90 }91 92 bool NumberPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)93 {94 return getStaticFunctionSlot<NumberObject>(exec, numberPrototypeTable, jsCast<NumberPrototype*>(object), propertyName, slot);95 90 } 96 91 -
trunk/Source/JavaScriptCore/runtime/NumberPrototype.h
r199725 r201448 29 29 public: 30 30 typedef NumberObject Base; 31 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;31 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 32 32 33 33 static NumberPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 50 50 private: 51 51 NumberPrototype(VM&, Structure*); 52 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);53 52 }; 54 53 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r200421 r201448 112 112 putDirectWithoutTransition(vm, vm.propertyNames->defineProperty, definePropertyFunction, DontEnum); 113 113 return definePropertyFunction; 114 }115 116 bool ObjectConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)117 {118 return getStaticFunctionSlot<JSObject>(exec, objectConstructorTable, jsCast<ObjectConstructor*>(object), propertyName, slot);119 114 } 120 115 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h
r201049 r201448 39 39 public: 40 40 typedef InternalFunction Base; 41 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;41 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 42 42 43 43 static ObjectConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objectPrototype) … … 47 47 return constructor; 48 48 } 49 50 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);51 49 52 50 DECLARE_INFO; -
trunk/Source/JavaScriptCore/runtime/ReflectObject.cpp
r200355 r201448 90 90 } 91 91 92 bool ReflectObject::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)93 {94 return getStaticFunctionSlot<Base>(exec, reflectObjectTable, jsCast<ReflectObject*>(object), propertyName, slot);95 }96 97 92 // ------------------------------ Functions -------------------------------- 98 93 -
trunk/Source/JavaScriptCore/runtime/ReflectObject.h
r187401 r201448 37 37 public: 38 38 typedef JSNonFinalObject Base; 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;39 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 40 40 41 41 static ReflectObject* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 53 53 } 54 54 55 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);56 57 55 protected: 58 56 void finishCreation(VM&, JSGlobalObject*); -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r201322 r201448 146 146 return m_cachedResult.rightContext(exec, this); 147 147 } 148 149 bool RegExpConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)150 {151 return getStaticValueSlot<RegExpConstructor, InternalFunction>(exec, regExpConstructorTable, jsCast<RegExpConstructor*>(object), propertyName, slot);152 }153 148 154 149 template<int N> -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.h
r199144 r201448 35 35 public: 36 36 typedef InternalFunction Base; 37 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;37 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 38 38 39 39 static RegExpConstructor* create(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype, GetterSetter* species) … … 48 48 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); 49 49 } 50 51 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);52 50 53 51 DECLARE_INFO; -
trunk/Source/JavaScriptCore/runtime/SetPrototype.cpp
r200422 r201448 83 83 JSC_NATIVE_GETTER(vm.propertyNames->size, setProtoFuncSize, DontEnum | Accessor); 84 84 } 85 86 bool SetPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)87 {88 return getStaticFunctionSlot<Base>(exec, setPrototypeTable, jsCast<SetPrototype*>(object), propertyName, slot);89 }90 91 85 92 86 ALWAYS_INLINE static JSSet* getSet(CallFrame* callFrame, JSValue thisValue) -
trunk/Source/JavaScriptCore/runtime/SetPrototype.h
r194838 r201448 35 35 typedef JSNonFinalObject Base; 36 36 37 static const unsigned StructureFlags = OverridesGetOwnPropertySlot| Base::StructureFlags;37 static const unsigned StructureFlags = HasStaticPropertyTable | Base::StructureFlags; 38 38 39 39 static SetPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 57 57 } 58 58 void finishCreation(VM&, JSGlobalObject*); 59 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);60 59 }; 61 60 -
trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp
r197614 r201448 63 63 putDirectWithoutTransition(vm, vm.propertyNames->prototype, stringPrototype, ReadOnly | DontEnum | DontDelete); 64 64 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); 65 }66 67 bool StringConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)68 {69 return getStaticFunctionSlot<InternalFunction>(exec, stringConstructorTable, jsCast<StringConstructor*>(object), propertyName, slot);70 65 } 71 66 -
trunk/Source/JavaScriptCore/runtime/StringConstructor.h
r195460 r201448 32 32 public: 33 33 typedef InternalFunction Base; 34 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;34 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 35 35 36 36 static StringConstructor* create(VM& vm, Structure* structure, StringPrototype* stringPrototype, GetterSetter*) … … 53 53 static ConstructType getConstructData(JSCell*, ConstructData&); 54 54 static CallType getCallData(JSCell*, CallData&); 55 56 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);57 55 }; 58 56 -
trunk/Source/JavaScriptCore/runtime/StringIteratorPrototype.cpp
r192204 r201448 59 59 } 60 60 61 bool StringIteratorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)62 {63 return getStaticFunctionSlot<Base>(exec, stringIteratorPrototypeTable, jsCast<StringIteratorPrototype*>(object), propertyName, slot);64 }65 66 61 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/StringIteratorPrototype.h
r182747 r201448 35 35 public: 36 36 typedef JSNonFinalObject Base; 37 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;37 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 38 38 39 39 static StringIteratorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 57 57 } 58 58 void finishCreation(VM&, JSGlobalObject*); 59 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);60 59 }; 61 60 -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r200743 r201448 190 190 } 191 191 192 bool StringPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)193 {194 return getStaticFunctionSlot<Base>(exec, stringPrototypeTable, jsCast<StringPrototype*>(object), propertyName, slot);195 }196 197 192 // ------------------------------ Functions -------------------------- 198 193 -
trunk/Source/JavaScriptCore/runtime/StringPrototype.h
r199731 r201448 37 37 public: 38 38 typedef StringObject Base; 39 static const unsigned StructureFlags = OverridesGetOwnPropertySlot| Base::StructureFlags;39 static const unsigned StructureFlags = HasStaticPropertyTable | Base::StructureFlags; 40 40 41 41 static StringPrototype* create(VM&, JSGlobalObject*, Structure*); … … 50 50 protected: 51 51 void finishCreation(VM&, JSGlobalObject*, JSString*); 52 53 private:54 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);55 52 }; 56 53 -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.cpp
r200402 r201448 74 74 } 75 75 76 bool SymbolConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)77 {78 return getStaticFunctionSlot<Base>(exec, symbolConstructorTable, jsCast<SymbolConstructor*>(object), propertyName, slot);79 }80 81 76 // ------------------------------ Functions --------------------------- 82 77 -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.h
r195460 r201448 39 39 public: 40 40 typedef InternalFunction Base; 41 static const unsigned StructureFlags = OverridesGetOwnPropertySlot| Base::StructureFlags;41 static const unsigned StructureFlags = HasStaticPropertyTable | Base::StructureFlags; 42 42 43 43 static SymbolConstructor* create(VM& vm, Structure* structure, SymbolPrototype* prototype, GetterSetter*) … … 62 62 static ConstructType getConstructData(JSCell*, ConstructData&); 63 63 static CallType getCallData(JSCell*, CallData&); 64 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);65 64 }; 66 65 -
trunk/Source/JavaScriptCore/runtime/SymbolPrototype.cpp
r200402 r201448 66 66 } 67 67 68 bool SymbolPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)69 {70 return getStaticFunctionSlot<Base>(exec, symbolPrototypeTable, jsCast<SymbolPrototype*>(object), propertyName, slot);71 }72 73 68 // ------------------------------ Functions --------------------------- 74 69 -
trunk/Source/JavaScriptCore/runtime/SymbolPrototype.h
r197531 r201448 37 37 public: 38 38 typedef JSNonFinalObject Base; 39 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot;39 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; 40 40 41 41 static SymbolPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) … … 56 56 SymbolPrototype(VM&, Structure*); 57 57 void finishCreation(VM&, JSGlobalObject*); 58 59 private:60 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);61 58 }; 62 59 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(SymbolPrototype);
Note:
See TracChangeset
for help on using the changeset viewer.