diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime')
87 files changed, 642 insertions, 568 deletions
diff --git a/Source/JavaScriptCore/runtime/Arguments.cpp b/Source/JavaScriptCore/runtime/Arguments.cpp index 9a3d7257b..1fd05fd9e 100644 --- a/Source/JavaScriptCore/runtime/Arguments.cpp +++ b/Source/JavaScriptCore/runtime/Arguments.cpp @@ -124,12 +124,12 @@ void Arguments::createStrictModeCalleeIfNecessary(ExecState* exec) methodTable()->defineOwnProperty(this, exec, exec->propertyNames().callee, descriptor, false); } -bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { Arguments* thisObject = jsCast<Arguments*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + ASSERT(i < PropertyName::NotAnIndex); slot.setValue(thisObject->argument(i).get()); return true; } @@ -153,12 +153,12 @@ bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifi return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot); } -bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { Arguments* thisObject = jsCast<Arguments*>(object); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + ASSERT(i < PropertyName::NotAnIndex); descriptor.setDescriptor(thisObject->argument(i).get(), None); return true; } @@ -208,12 +208,12 @@ void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue va JSObject::put(thisObject, exec, Identifier(exec, UString::number(i)), value, slot); } -void Arguments::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void Arguments::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { Arguments* thisObject = jsCast<Arguments*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) { + ASSERT(i < PropertyName::NotAnIndex); thisObject->argument(i).set(exec->globalData(), thisObject, value); return; } @@ -259,15 +259,15 @@ bool Arguments::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned i) return JSObject::deleteProperty(thisObject, exec, Identifier(exec, UString::number(i))); } -bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { if (exec->globalData().isInDefineOwnProperty()) return Base::deleteProperty(cell, exec, propertyName); Arguments* thisObject = jsCast<Arguments*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments) { + ASSERT(i < PropertyName::NotAnIndex); if (!Base::deleteProperty(cell, exec, propertyName)) return false; @@ -300,12 +300,12 @@ bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& return JSObject::deleteProperty(thisObject, exec, propertyName); } -bool Arguments::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool Arguments::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { Arguments* thisObject = jsCast<Arguments*>(object); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex && i < thisObject->d->numArguments) { + unsigned i = propertyName.asIndex(); + if (i < thisObject->d->numArguments) { + ASSERT(i < PropertyName::NotAnIndex); // If the property is not yet present on the object, and is not yet marked as deleted, then add it now. PropertySlot slot; if ((!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i]) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) diff --git a/Source/JavaScriptCore/runtime/Arguments.h b/Source/JavaScriptCore/runtime/Arguments.h index a1f36de56..5925ed491 100644 --- a/Source/JavaScriptCore/runtime/Arguments.h +++ b/Source/JavaScriptCore/runtime/Arguments.h @@ -109,15 +109,15 @@ namespace JSC { private: static void destroy(JSCell*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); void createStrictModeCallerIfNecessary(ExecState*); void createStrictModeCalleeIfNecessary(ExecState*); diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.cpp b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp index ebcc43781..83e48ca1b 100644 --- a/Source/JavaScriptCore/runtime/ArrayConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ArrayConstructor.cpp @@ -60,17 +60,17 @@ ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* stru void ArrayConstructor::finishCreation(ExecState* exec, ArrayPrototype* arrayPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, arrayPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), arrayPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(cell), propertyName, slot); } -bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ArrayConstructor.h b/Source/JavaScriptCore/runtime/ArrayConstructor.h index c60571fbd..b223a0f13 100644 --- a/Source/JavaScriptCore/runtime/ArrayConstructor.h +++ b/Source/JavaScriptCore/runtime/ArrayConstructor.h @@ -51,9 +51,9 @@ namespace JSC { private: ArrayConstructor(JSGlobalObject*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static ConstructType getConstructData(JSCell*, ConstructData&); static CallType getCallData(JSCell*, CallData&); diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp index 6df58b773..b73a1296a 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -126,12 +126,12 @@ void ArrayPrototype::finishCreation(JSGlobalObject* globalObject) ASSERT(inherits(&s_info)); } -bool ArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool ArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayPrototypeTable(exec), jsCast<ArrayPrototype*>(cell), propertyName, slot); } -bool ArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSArray>(exec, ExecState::arrayPrototypeTable(exec), jsCast<ArrayPrototype*>(object), propertyName, descriptor); } @@ -147,7 +147,7 @@ static JSValue getProperty(ExecState* exec, JSObject* obj, unsigned index) return slot.getValue(exec, index); } -static void putProperty(ExecState* exec, JSObject* obj, const Identifier& propertyName, JSValue value) +static void putProperty(ExecState* exec, JSObject* obj, PropertyName propertyName, JSValue value) { PutPropertySlot slot; obj->methodTable()->put(obj, exec, propertyName, value, slot); diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.h b/Source/JavaScriptCore/runtime/ArrayPrototype.h index f49a9a667..4f52fb61f 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.h +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.h @@ -40,8 +40,8 @@ namespace JSC { return prototype; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp index a54d281a7..9b666292c 100644 --- a/Source/JavaScriptCore/runtime/BooleanConstructor.cpp +++ b/Source/JavaScriptCore/runtime/BooleanConstructor.cpp @@ -38,7 +38,7 @@ BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* void BooleanConstructor::finishCreation(ExecState* exec, BooleanPrototype* booleanPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, booleanPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), booleanPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.cpp b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp index b9605d0cf..1551eabf2 100644 --- a/Source/JavaScriptCore/runtime/BooleanPrototype.cpp +++ b/Source/JavaScriptCore/runtime/BooleanPrototype.cpp @@ -63,12 +63,12 @@ void BooleanPrototype::finishCreation(ExecState* exec, JSGlobalObject*) ASSERT(inherits(&s_info)); } -bool BooleanPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool BooleanPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), jsCast<BooleanPrototype*>(cell), propertyName, slot); } -bool BooleanPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool BooleanPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), jsCast<BooleanPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/BooleanPrototype.h b/Source/JavaScriptCore/runtime/BooleanPrototype.h index f35d586e6..3767f76ed 100644 --- a/Source/JavaScriptCore/runtime/BooleanPrototype.h +++ b/Source/JavaScriptCore/runtime/BooleanPrototype.h @@ -49,9 +49,9 @@ namespace JSC { private: BooleanPrototype(ExecState*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ClassInfo.h b/Source/JavaScriptCore/runtime/ClassInfo.h index eb4a6f9cd..b0adab32c 100644 --- a/Source/JavaScriptCore/runtime/ClassInfo.h +++ b/Source/JavaScriptCore/runtime/ClassInfo.h @@ -45,19 +45,19 @@ namespace JSC { typedef ConstructType (*GetConstructDataFunctionPtr)(JSCell*, ConstructData&); GetConstructDataFunctionPtr getConstructData; - typedef void (*PutFunctionPtr)(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + typedef void (*PutFunctionPtr)(JSCell*, ExecState*, PropertyName propertyName, JSValue, PutPropertySlot&); PutFunctionPtr put; typedef void (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); PutByIndexFunctionPtr putByIndex; - typedef bool (*DeletePropertyFunctionPtr)(JSCell*, ExecState*, const Identifier&); + typedef bool (*DeletePropertyFunctionPtr)(JSCell*, ExecState*, PropertyName); DeletePropertyFunctionPtr deleteProperty; typedef bool (*DeletePropertyByIndexFunctionPtr)(JSCell*, ExecState*, unsigned); DeletePropertyByIndexFunctionPtr deletePropertyByIndex; - typedef bool (*GetOwnPropertySlotFunctionPtr)(JSCell*, ExecState*, const Identifier&, PropertySlot&); + typedef bool (*GetOwnPropertySlotFunctionPtr)(JSCell*, ExecState*, PropertyName, PropertySlot&); GetOwnPropertySlotFunctionPtr getOwnPropertySlot; typedef bool (*GetOwnPropertySlotByIndexFunctionPtr)(JSCell*, ExecState*, unsigned, PropertySlot&); @@ -81,13 +81,13 @@ namespace JSC { typedef bool (*HasInstanceFunctionPtr)(JSObject*, ExecState*, JSValue, JSValue); HasInstanceFunctionPtr hasInstance; - typedef void (*PutWithAttributesFunctionPtr)(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); + typedef void (*PutWithAttributesFunctionPtr)(JSObject*, ExecState*, PropertyName propertyName, JSValue, unsigned attributes); PutWithAttributesFunctionPtr putDirectVirtual; - typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool); + typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool); DefineOwnPropertyFunctionPtr defineOwnProperty; - typedef bool (*GetOwnPropertyDescriptorFunctionPtr)(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + typedef bool (*GetOwnPropertyDescriptorFunctionPtr)(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); GetOwnPropertyDescriptorFunctionPtr getOwnPropertyDescriptor; }; diff --git a/Source/JavaScriptCore/runtime/DateConstructor.cpp b/Source/JavaScriptCore/runtime/DateConstructor.cpp index 66f0baea5..08b815035 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.cpp +++ b/Source/JavaScriptCore/runtime/DateConstructor.cpp @@ -81,17 +81,17 @@ DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* struct void DateConstructor::finishCreation(ExecState* exec, DatePrototype* datePrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, datePrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), datePrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete); } -bool DateConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool DateConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<InternalFunction>(exec, ExecState::dateConstructorTable(exec), jsCast<DateConstructor*>(cell), propertyName, slot); } -bool DateConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool DateConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::dateConstructorTable(exec), jsCast<DateConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/DateConstructor.h b/Source/JavaScriptCore/runtime/DateConstructor.h index fe6597418..f089e036c 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.h +++ b/Source/JavaScriptCore/runtime/DateConstructor.h @@ -54,9 +54,9 @@ namespace JSC { static ConstructType getConstructData(JSCell*, ConstructData&); static CallType getCallData(JSCell*, CallData&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; JSObject* constructDate(ExecState*, JSGlobalObject*, const ArgList&); diff --git a/Source/JavaScriptCore/runtime/DatePrototype.cpp b/Source/JavaScriptCore/runtime/DatePrototype.cpp index ddea33786..f81ae10f3 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.cpp +++ b/Source/JavaScriptCore/runtime/DatePrototype.cpp @@ -467,12 +467,12 @@ void DatePrototype::finishCreation(ExecState* exec, JSGlobalObject*) // The constructor will be added later, after DateConstructor has been built. } -bool DatePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool DatePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), jsCast<DatePrototype*>(cell), propertyName, slot); } -bool DatePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool DatePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::dateTable(exec), jsCast<DatePrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/DatePrototype.h b/Source/JavaScriptCore/runtime/DatePrototype.h index 90eec28a1..c4f6d6916 100644 --- a/Source/JavaScriptCore/runtime/DatePrototype.h +++ b/Source/JavaScriptCore/runtime/DatePrototype.h @@ -40,9 +40,9 @@ namespace JSC { prototype->finishCreation(exec, globalObject); return prototype; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/Error.h b/Source/JavaScriptCore/runtime/Error.h index 79617655e..65aea3edc 100644 --- a/Source/JavaScriptCore/runtime/Error.h +++ b/Source/JavaScriptCore/runtime/Error.h @@ -90,7 +90,7 @@ namespace JSC { static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message) { StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message); - function->finishCreation(exec->globalData(), exec->globalData().propertyNames->emptyIdentifier); + function->finishCreation(exec->globalData(), ""); return function; } diff --git a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp index c8f93ba32..96272d0cf 100644 --- a/Source/JavaScriptCore/runtime/ErrorConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ErrorConstructor.cpp @@ -39,7 +39,7 @@ ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* stru void ErrorConstructor::finishCreation(ExecState* exec, ErrorPrototype* errorPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, errorPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), errorPrototype->classInfo()->className); // ECMA 15.11.3.1 Error.prototype putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp index 7af294782..5dd3e85e2 100644 --- a/Source/JavaScriptCore/runtime/ErrorPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ErrorPrototype.cpp @@ -63,12 +63,12 @@ void ErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject*) putDirect(exec->globalData(), exec->propertyNames().name, jsNontrivialString(exec, "Error"), DontEnum); } -bool ErrorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ErrorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), jsCast<ErrorPrototype*>(cell), propertyName, slot); } -bool ErrorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ErrorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), jsCast<ErrorPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ErrorPrototype.h b/Source/JavaScriptCore/runtime/ErrorPrototype.h index 6f02583a6..e961946df 100644 --- a/Source/JavaScriptCore/runtime/ErrorPrototype.h +++ b/Source/JavaScriptCore/runtime/ErrorPrototype.h @@ -52,8 +52,8 @@ namespace JSC { static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags; private: - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h index b9d3e6ee1..d8367ecc8 100644 --- a/Source/JavaScriptCore/runtime/Executable.h +++ b/Source/JavaScriptCore/runtime/Executable.h @@ -43,8 +43,6 @@ namespace JSC { class LLIntOffsetsExtractor; class ProgramCodeBlock; class ScopeChainNode; - - struct ExceptionInfo; enum CompilationKind { FirstCompilation, OptimizingCompilation }; diff --git a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp index 956b2161d..7f82a74ce 100644 --- a/Source/JavaScriptCore/runtime/FunctionConstructor.cpp +++ b/Source/JavaScriptCore/runtime/FunctionConstructor.cpp @@ -47,7 +47,7 @@ FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure void FunctionConstructor::finishCreation(ExecState* exec, FunctionPrototype* functionPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, functionPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), functionPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly); // Number of arguments for constructor diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.cpp b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp index d341b847b..4206cf2b0 100644 --- a/Source/JavaScriptCore/runtime/FunctionPrototype.cpp +++ b/Source/JavaScriptCore/runtime/FunctionPrototype.cpp @@ -47,7 +47,7 @@ FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* st { } -void FunctionPrototype::finishCreation(ExecState* exec, const Identifier& name) +void FunctionPrototype::finishCreation(ExecState* exec, const UString& name) { Base::finishCreation(exec->globalData(), name); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); @@ -55,16 +55,16 @@ void FunctionPrototype::finishCreation(ExecState* exec, const Identifier& name) void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, JSFunction** callFunction, JSFunction** applyFunction) { - JSFunction* toStringFunction = JSFunction::create(exec, globalObject, 0, exec->propertyNames().toString, functionProtoFuncToString); + JSFunction* toStringFunction = JSFunction::create(exec, globalObject, 0, exec->propertyNames().toString.ustring(), functionProtoFuncToString); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().toString, toStringFunction, DontEnum); - *applyFunction = JSFunction::create(exec, globalObject, 2, exec->propertyNames().apply, functionProtoFuncApply); + *applyFunction = JSFunction::create(exec, globalObject, 2, exec->propertyNames().apply.ustring(), functionProtoFuncApply); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().apply, *applyFunction, DontEnum); - *callFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().call, functionProtoFuncCall); + *callFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().call.ustring(), functionProtoFuncCall); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().call, *callFunction, DontEnum); - JSFunction* bindFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().bind, functionProtoFuncBind); + JSFunction* bindFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().bind.ustring(), functionProtoFuncBind); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().bind, bindFunction, DontEnum); } @@ -207,9 +207,8 @@ EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState* exec) length = targetLength - numBoundArgs; } - Identifier name(exec, target.get(exec, exec->propertyNames().name).toString(exec)->value(exec)); - - return JSValue::encode(JSBoundFunction::create(exec, globalObject, targetObject, exec->argument(0), boundArgs, length, name)); + JSString* name = target.get(exec, exec->propertyNames().name).toString(exec); + return JSValue::encode(JSBoundFunction::create(exec, globalObject, targetObject, exec->argument(0), boundArgs, length, name->value(exec))); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/FunctionPrototype.h b/Source/JavaScriptCore/runtime/FunctionPrototype.h index 7dd1c2418..59427912b 100644 --- a/Source/JavaScriptCore/runtime/FunctionPrototype.h +++ b/Source/JavaScriptCore/runtime/FunctionPrototype.h @@ -32,7 +32,7 @@ namespace JSC { static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) { FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(globalObject, structure); - prototype->finishCreation(exec, exec->propertyNames().nullIdentifier); + prototype->finishCreation(exec, ""); return prototype; } @@ -46,7 +46,7 @@ namespace JSC { static const ClassInfo s_info; protected: - void finishCreation(ExecState*, const Identifier& name); + void finishCreation(ExecState*, const UString& name); private: FunctionPrototype(JSGlobalObject*, Structure*); diff --git a/Source/JavaScriptCore/runtime/GCActivityCallback.h b/Source/JavaScriptCore/runtime/GCActivityCallback.h index 1a18a8b45..32077f2b0 100644 --- a/Source/JavaScriptCore/runtime/GCActivityCallback.h +++ b/Source/JavaScriptCore/runtime/GCActivityCallback.h @@ -47,9 +47,16 @@ public: virtual void willCollect() { } virtual void synchronize() { } virtual void cancel() { } + bool isEnabled() const { return m_enabled; } + void setEnabled(bool enabled) { m_enabled = enabled; } protected: - GCActivityCallback() {} + GCActivityCallback() + : m_enabled(true) + { + } + + bool m_enabled; }; struct DefaultGCActivityCallbackPlatformData; diff --git a/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp b/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp index 8b690a480..d82403a6b 100644 --- a/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp +++ b/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp @@ -63,6 +63,9 @@ const CFTimeInterval hour = 60 * 60; void DefaultGCActivityCallbackPlatformData::timerDidFire(CFRunLoopTimerRef, void *info) { Heap* heap = static_cast<Heap*>(info); + if (!heap->activityCallback()->isEnabled()) + return; + APIEntryShim shim(heap->globalData()); #if !PLATFORM(IOS) double startTime = WTF::monotonicallyIncreasingTime(); diff --git a/Source/JavaScriptCore/runtime/Identifier.cpp b/Source/JavaScriptCore/runtime/Identifier.cpp index 182bcc462..20770928c 100644 --- a/Source/JavaScriptCore/runtime/Identifier.cpp +++ b/Source/JavaScriptCore/runtime/Identifier.cpp @@ -145,56 +145,6 @@ PassRefPtr<StringImpl> Identifier::add8(JSGlobalData* globalData, const UChar* s return addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.iterator; } -template <typename CharType> -ALWAYS_INLINE uint32_t Identifier::toUInt32FromCharacters(const CharType* characters, unsigned length, bool& ok) -{ - // Get the first character, turning it into a digit. - uint32_t value = characters[0] - '0'; - if (value > 9) - return 0; - - // Check for leading zeros. If the first characher is 0, then the - // length of the string must be one - e.g. "042" is not equal to "42". - if (!value && length > 1) - return 0; - - while (--length) { - // Multiply value by 10, checking for overflow out of 32 bits. - if (value > 0xFFFFFFFFU / 10) - return 0; - value *= 10; - - // Get the next character, turning it into a digit. - uint32_t newValue = *(++characters) - '0'; - if (newValue > 9) - return 0; - - // Add in the old value, checking for overflow out of 32 bits. - newValue += value; - if (newValue < value) - return 0; - value = newValue; - } - - ok = true; - return value; -} - -uint32_t Identifier::toUInt32(const UString& string, bool& ok) -{ - ok = false; - - unsigned length = string.length(); - - // An empty string is not a number. - if (!length) - return 0; - - if (string.is8Bit()) - return toUInt32FromCharacters(string.characters8(), length, ok); - return toUInt32FromCharacters(string.characters16(), length, ok); -} - PassRefPtr<StringImpl> Identifier::addSlowCase(JSGlobalData* globalData, StringImpl* r) { ASSERT(!r->isIdentifier()); diff --git a/Source/JavaScriptCore/runtime/Identifier.h b/Source/JavaScriptCore/runtime/Identifier.h index 14960876b..7b7907983 100644 --- a/Source/JavaScriptCore/runtime/Identifier.h +++ b/Source/JavaScriptCore/runtime/Identifier.h @@ -63,10 +63,6 @@ namespace JSC { static Identifier from(JSGlobalData*, int y); static Identifier from(JSGlobalData*, double y); - JS_EXPORT_PRIVATE static uint32_t toUInt32(const UString&, bool& ok); - uint32_t toUInt32(bool& ok) const { return toUInt32(m_string, ok); } - unsigned toArrayIndex(bool& ok) const; - bool isNull() const { return m_string.isNull(); } bool isEmpty() const { return m_string.isEmpty(); } diff --git a/Source/JavaScriptCore/runtime/InternalFunction.cpp b/Source/JavaScriptCore/runtime/InternalFunction.cpp index 50ea504c1..985ab73b0 100644 --- a/Source/JavaScriptCore/runtime/InternalFunction.cpp +++ b/Source/JavaScriptCore/runtime/InternalFunction.cpp @@ -39,12 +39,12 @@ InternalFunction::InternalFunction(JSGlobalObject* globalObject, Structure* stru { } -void InternalFunction::finishCreation(JSGlobalData& globalData, const Identifier& name) +void InternalFunction::finishCreation(JSGlobalData& globalData, const UString& name) { Base::finishCreation(globalData); ASSERT(inherits(&s_info)); ASSERT(methodTable()->getCallData != InternalFunction::s_info.methodTable.getCallData); - putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); + putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name), DontDelete | ReadOnly | DontEnum); } const UString& InternalFunction::name(ExecState* exec) diff --git a/Source/JavaScriptCore/runtime/InternalFunction.h b/Source/JavaScriptCore/runtime/InternalFunction.h index 532bd0c8d..150fb759e 100644 --- a/Source/JavaScriptCore/runtime/InternalFunction.h +++ b/Source/JavaScriptCore/runtime/InternalFunction.h @@ -51,7 +51,7 @@ namespace JSC { JS_EXPORT_PRIVATE InternalFunction(JSGlobalObject*, Structure*); - JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&, const Identifier& name); + JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&, const UString& name); static CallType getCallData(JSCell*, CallData&); }; diff --git a/Source/JavaScriptCore/runtime/JSActivation.cpp b/Source/JavaScriptCore/runtime/JSActivation.cpp index a10361007..f8883187e 100644 --- a/Source/JavaScriptCore/runtime/JSActivation.cpp +++ b/Source/JavaScriptCore/runtime/JSActivation.cpp @@ -90,7 +90,7 @@ void JSActivation::visitChildren(JSCell* cell, SlotVisitor& visitor) visitor.appendValues(registerArray + offset, thisObject->m_numCapturedVars); } -inline bool JSActivation::symbolTableGet(const Identifier& propertyName, PropertySlot& slot) +inline bool JSActivation::symbolTableGet(PropertyName propertyName, PropertySlot& slot) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (entry.isNull()) @@ -102,7 +102,7 @@ inline bool JSActivation::symbolTableGet(const Identifier& propertyName, Propert return true; } -inline bool JSActivation::symbolTablePut(ExecState* exec, const Identifier& propertyName, JSValue value, bool shouldThrow) +inline bool JSActivation::symbolTablePut(ExecState* exec, PropertyName propertyName, JSValue value, bool shouldThrow) { JSGlobalData& globalData = exec->globalData(); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -137,7 +137,7 @@ void JSActivation::getOwnPropertyNames(JSObject* object, ExecState* exec, Proper JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -154,7 +154,7 @@ inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData, return true; } -bool JSActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSActivation* thisObject = jsCast<JSActivation*>(cell); if (propertyName == exec->propertyNames().arguments) { @@ -177,7 +177,7 @@ bool JSActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Ident return false; } -void JSActivation::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSActivation::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSActivation* thisObject = jsCast<JSActivation*>(cell); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -193,7 +193,7 @@ void JSActivation::put(JSCell* cell, ExecState* exec, const Identifier& property } // FIXME: Make this function honor ReadOnly (const) and DontEnum -void JSActivation::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSActivation::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { JSActivation* thisObject = jsCast<JSActivation*>(object); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -208,7 +208,7 @@ void JSActivation::putDirectVirtual(JSObject* object, ExecState* exec, const Ide JSObject::putDirectVirtual(thisObject, exec, propertyName, value, attributes); } -bool JSActivation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSActivation::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { if (propertyName == exec->propertyNames().arguments) return false; @@ -221,7 +221,7 @@ JSObject* JSActivation::toThisObject(JSCell*, ExecState* exec) return exec->globalThisValue(); } -JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&) +JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, PropertyName) { JSActivation* activation = asActivation(slotBase); CallFrame* callFrame = CallFrame::create(reinterpret_cast<Register*>(activation->m_registers)); diff --git a/Source/JavaScriptCore/runtime/JSActivation.h b/Source/JavaScriptCore/runtime/JSActivation.h index fd1b2fd7f..95639076d 100644 --- a/Source/JavaScriptCore/runtime/JSActivation.h +++ b/Source/JavaScriptCore/runtime/JSActivation.h @@ -59,13 +59,13 @@ namespace JSC { bool isDynamicScope(bool& requiresDynamicChecks) const; - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static void putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static JSObject* toThisObject(JSCell*, ExecState*); @@ -82,13 +82,13 @@ namespace JSC { static const unsigned StructureFlags = IsEnvironmentRecord | OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags; private: - bool symbolTableGet(const Identifier&, PropertySlot&); - bool symbolTableGet(const Identifier&, PropertyDescriptor&); - bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable); - bool symbolTablePut(ExecState*, const Identifier&, JSValue, bool shouldThrow); - bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes); + bool symbolTableGet(PropertyName, PropertySlot&); + bool symbolTableGet(PropertyName, PropertyDescriptor&); + bool symbolTableGet(PropertyName, PropertySlot&, bool& slotIsWriteable); + bool symbolTablePut(ExecState*, PropertyName, JSValue, bool shouldThrow); + bool symbolTablePutWithAttributes(JSGlobalData&, PropertyName, JSValue, unsigned attributes); - static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&); + static JSValue argumentsGetter(ExecState*, JSValue, PropertyName); NEVER_INLINE PropertySlot::GetValueFunc getArgumentsGetter(); int m_numCapturedArgs; diff --git a/Source/JavaScriptCore/runtime/JSArray.cpp b/Source/JavaScriptCore/runtime/JSArray.cpp index aa1b8b7d9..9e7aaba51 100644 --- a/Source/JavaScriptCore/runtime/JSArray.cpp +++ b/Source/JavaScriptCore/runtime/JSArray.cpp @@ -535,7 +535,7 @@ void JSArray::setLengthWritable(ExecState* exec, bool writable) } // Defined in ES5.1 15.4.5.1 -bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { JSArray* array = jsCast<JSArray*>(object); @@ -618,10 +618,9 @@ bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, const Identif } // 4. Else if P is an array index (15.4), then - bool isArrayIndex; // a. Let index be ToUint32(P). - unsigned index = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) { + unsigned index = propertyName.asIndex(); + if (index != PropertyName::NotAnIndex) { // b. Reject if index >= oldLen and oldLenDesc.[[Writable]] is false. if (index >= array->length() && !array->isLengthWritable()) return reject(exec, throwException, "Attempting to define numeric property on array with non-writable length property."); @@ -665,7 +664,7 @@ bool JSArray::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned return JSObject::getOwnPropertySlot(thisObject, exec, Identifier::from(exec, i), slot); } -bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSArray* thisObject = jsCast<JSArray*>(cell); if (propertyName == exec->propertyNames().length) { @@ -673,15 +672,14 @@ bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier return true; } - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) return JSArray::getOwnPropertySlotByIndex(thisObject, exec, i, slot); return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot); } -bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSArray* thisObject = jsCast<JSArray*>(object); if (propertyName == exec->propertyNames().length) { @@ -691,9 +689,8 @@ bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const ArrayStorage* storage = thisObject->m_storage; - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) { + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) { if (i >= storage->m_length) return false; if (i < thisObject->m_vectorLength) { @@ -714,12 +711,11 @@ bool JSArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const } // ECMA 15.4.5.1 -void JSArray::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSArray::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSArray* thisObject = jsCast<JSArray*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) { + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) { putByIndex(thisObject, exec, i, value, slot.isStrictMode()); return; } @@ -919,12 +915,11 @@ bool JSArray::putDirectIndexBeyondVectorLength(ExecState* exec, unsigned i, JSVa return true; } -bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSArray* thisObject = jsCast<JSArray*>(cell); - bool isArrayIndex; - unsigned i = propertyName.toArrayIndex(isArrayIndex); - if (isArrayIndex) + unsigned i = propertyName.asIndex(); + if (i != PropertyName::NotAnIndex) return thisObject->methodTable()->deletePropertyByIndex(thisObject, exec, i); if (propertyName == exec->propertyNames().length) diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h index 17c7f3ed7..c1a3a632b 100644 --- a/Source/JavaScriptCore/runtime/JSArray.h +++ b/Source/JavaScriptCore/runtime/JSArray.h @@ -164,11 +164,11 @@ namespace JSC { // - called 'completeInitialization' after all properties have been initialized. static JSArray* tryCreateUninitialized(JSGlobalData&, Structure*, unsigned initialLength); - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool throwException); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool throwException); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); // This is similar to the JSObject::putDirect* methods: // - the prototype chain is not consulted @@ -281,9 +281,9 @@ namespace JSC { protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSObject::StructureFlags; - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); @@ -357,16 +357,6 @@ namespace JSC { inline bool isJSArray(JSCell* cell) { return cell->classInfo() == &JSArray::s_info; } inline bool isJSArray(JSValue v) { return v.isCell() && isJSArray(v.asCell()); } - // Rule from ECMA 15.2 about what an array index is. - // Must exactly match string form of an unsigned integer, and be less than 2^32 - 1. - inline unsigned Identifier::toArrayIndex(bool& ok) const - { - unsigned i = toUInt32(ok); - if (ok && i >= 0xFFFFFFFFU) - ok = false; - return i; - } - // The definition of MAX_STORAGE_VECTOR_LENGTH is dependant on the definition storageSize // function below - the MAX_STORAGE_VECTOR_LENGTH limit is defined such that the storage // size calculation cannot overflow. (sizeof(ArrayStorage) - sizeof(WriteBarrier<Unknown>)) + diff --git a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp index 5fee47c24..3f6430871 100644 --- a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp +++ b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp @@ -76,7 +76,7 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec) return JSValue::encode(construct(exec, targetFunction, constructType, constructData, args)); } -JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const Identifier& name) +JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const UString& name) { ConstructData constructData; ConstructType constructType = JSC::getConstructData(targetFunction, constructData); @@ -107,7 +107,7 @@ JSBoundFunction::JSBoundFunction(ExecState* exec, JSGlobalObject* globalObject, { } -void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const Identifier& name) +void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const UString& name) { Base::finishCreation(exec, executable, length, name); ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/runtime/JSBoundFunction.h b/Source/JavaScriptCore/runtime/JSBoundFunction.h index e54d45883..dd1229272 100644 --- a/Source/JavaScriptCore/runtime/JSBoundFunction.h +++ b/Source/JavaScriptCore/runtime/JSBoundFunction.h @@ -37,7 +37,7 @@ class JSBoundFunction : public JSFunction { public: typedef JSFunction Base; - static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const Identifier&); + static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const UString&); static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue proto); @@ -61,7 +61,7 @@ protected: private: JSBoundFunction(ExecState*, JSGlobalObject*, Structure*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs); - void finishCreation(ExecState*, NativeExecutable*, int, const Identifier&); + void finishCreation(ExecState*, NativeExecutable*, int, const UString&); WriteBarrier<JSObject> m_targetFunction; WriteBarrier<Unknown> m_boundThis; diff --git a/Source/JavaScriptCore/runtime/JSCell.cpp b/Source/JavaScriptCore/runtime/JSCell.cpp index 7f9ba88a2..06c1f7c4d 100644 --- a/Source/JavaScriptCore/runtime/JSCell.cpp +++ b/Source/JavaScriptCore/runtime/JSCell.cpp @@ -71,7 +71,7 @@ ConstructType JSCell::getConstructData(JSCell*, ConstructData&) return ConstructTypeNone; } -bool JSCell::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& identifier, PropertySlot& slot) +bool JSCell::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName identifier, PropertySlot& slot) { // This is not a general purpose implementation of getOwnPropertySlot. // It should only be called by JSValue::get. @@ -95,7 +95,7 @@ bool JSCell::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned i return true; } -void JSCell::put(JSCell* cell, ExecState* exec, const Identifier& identifier, JSValue value, PutPropertySlot& slot) +void JSCell::put(JSCell* cell, ExecState* exec, PropertyName identifier, JSValue value, PutPropertySlot& slot) { if (cell->isString()) { JSValue(cell).putToPrimitive(exec, identifier, value, slot); @@ -116,7 +116,7 @@ void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSVa thisObject->methodTable()->putByIndex(thisObject, exec, identifier, value, shouldThrow); } -bool JSCell::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& identifier) +bool JSCell::deleteProperty(JSCell* cell, ExecState* exec, PropertyName identifier) { JSObject* thisObject = cell->toObject(exec, exec->lexicalGlobalObject()); return thisObject->methodTable()->deleteProperty(thisObject, exec, identifier); @@ -195,18 +195,18 @@ bool JSCell::hasInstance(JSObject*, ExecState*, JSValue, JSValue) return false; } -void JSCell::putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned) +void JSCell::putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned) { ASSERT_NOT_REACHED(); } -bool JSCell::defineOwnProperty(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool) +bool JSCell::defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool) { ASSERT_NOT_REACHED(); return false; } -bool JSCell::getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) +bool JSCell::getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&) { ASSERT_NOT_REACHED(); return false; diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h index 431e67145..fa675fbca 100644 --- a/Source/JavaScriptCore/runtime/JSCell.h +++ b/Source/JavaScriptCore/runtime/JSCell.h @@ -106,10 +106,10 @@ namespace JSC { const ClassInfo* classInfo() const; const ClassInfo* validatedClassInfo() const; const MethodTable* methodTable() const; - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); static JSObject* toThisObject(JSCell*, ExecState*); @@ -121,7 +121,7 @@ namespace JSC { // fastGetOwnPropertySlot to getOwnPropertySlot. Callers should always // call this function, not its slower virtual counterpart. (For integer // property names, we want a similar interface with appropriate optimizations.) - bool fastGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool fastGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&); JSValue fastGetOwnProperty(ExecState*, const UString&); static ptrdiff_t structureOffset() @@ -150,7 +150,7 @@ namespace JSC { void finishCreation(JSGlobalData&, Structure*, CreatingEarlyCellTag); // Base implementation; for non-object classes implements getPropertySlot. - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); // Dummy implementations of override-able static functions for classes to put in their MethodTable @@ -159,9 +159,9 @@ namespace JSC { static NO_RETURN_DUE_TO_ASSERT void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); static UString className(const JSObject*); static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue prototypeProperty); - static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); private: friend class LLIntOffsetsExtractor; diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp index 563325ab0..f2d9c81e2 100644 --- a/Source/JavaScriptCore/runtime/JSFunction.cpp +++ b/Source/JavaScriptCore/runtime/JSFunction.cpp @@ -59,7 +59,7 @@ bool JSFunction::isHostFunctionNonInline() const return isHostFunction(); } -JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const Identifier& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor) +JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const UString& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor) { NativeExecutable* executable; #if !ENABLE(JIT) @@ -92,12 +92,12 @@ JSFunction::JSFunction(ExecState* exec, FunctionExecutable* executable, ScopeCha { } -void JSFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const Identifier& name) +void JSFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const UString& name) { Base::finishCreation(exec->globalData()); ASSERT(inherits(&s_info)); m_executable.set(exec->globalData(), this, executable); - putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); + putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name), DontDelete | ReadOnly | DontEnum); putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(length), DontDelete | ReadOnly | DontEnum); } @@ -183,14 +183,14 @@ CallType JSFunction::getCallData(JSCell* cell, CallData& callData) return CallTypeJS; } -JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue JSFunction::argumentsGetter(ExecState* exec, JSValue slotBase, PropertyName) { JSFunction* thisObj = jsCast<JSFunction*>(slotBase); ASSERT(!thisObj->isHostFunction()); return exec->interpreter()->retrieveArgumentsFromVMCode(exec, thisObj); } -JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, PropertyName) { JSFunction* thisObj = jsCast<JSFunction*>(slotBase); ASSERT(!thisObj->isHostFunction()); @@ -205,14 +205,14 @@ JSValue JSFunction::callerGetter(ExecState* exec, JSValue slotBase, const Identi return throwTypeError(exec, "Function.caller used to retrieve strict caller"); } -JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, const Identifier&) +JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, PropertyName) { JSFunction* thisObj = jsCast<JSFunction*>(slotBase); ASSERT(!thisObj->isHostFunction()); return jsNumber(thisObj->jsExecutable()->parameterCount()); } -bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSFunction* thisObject = jsCast<JSFunction*>(cell); if (thisObject->isHostFunction()) @@ -267,7 +267,7 @@ bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identif return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); } -bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSFunction* thisObject = jsCast<JSFunction*>(object); if (thisObject->isHostFunction()) @@ -330,7 +330,7 @@ void JSFunction::getOwnPropertyNames(JSObject* object, ExecState* exec, Property Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -void JSFunction::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSFunction::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSFunction* thisObject = jsCast<JSFunction*>(cell); if (thisObject->isHostFunction()) { @@ -343,6 +343,10 @@ void JSFunction::put(JSCell* cell, ExecState* exec, const Identifier& propertyNa PropertySlot slot; thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, propertyName, slot); thisObject->m_cachedInheritorID.clear(); + // Don't allow this to be cached, since a [[Put]] must clear m_cachedInheritorID. + PutPropertySlot dontCache; + Base::put(thisObject, exec, propertyName, value, dontCache); + return; } if (thisObject->jsExecutable()->isStrictMode() && (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().caller)) { // This will trigger the property to be reified, if this is not already the case! @@ -359,7 +363,7 @@ void JSFunction::put(JSCell* cell, ExecState* exec, const Identifier& propertyNa Base::put(thisObject, exec, propertyName, value, slot); } -bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSFunction* thisObject = jsCast<JSFunction*>(cell); // For non-host functions, don't let these properties by deleted - except by DefineOwnProperty. @@ -372,7 +376,7 @@ bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& return Base::deleteProperty(thisObject, exec, propertyName); } -bool JSFunction::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool JSFunction::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { JSFunction* thisObject = jsCast<JSFunction*>(object); if (thisObject->isHostFunction()) @@ -455,7 +459,7 @@ UString getCalculatedDisplayName(CallFrame* callFrame, JSObject* object) return function->calculatedDisplayName(callFrame); if (InternalFunction* function = jsDynamicCast<InternalFunction*>(object)) return function->calculatedDisplayName(callFrame); - return callFrame->globalData().propertyNames->emptyIdentifier.ustring(); + return ""; } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSFunction.h b/Source/JavaScriptCore/runtime/JSFunction.h index 9de66d721..56faf00de 100644 --- a/Source/JavaScriptCore/runtime/JSFunction.h +++ b/Source/JavaScriptCore/runtime/JSFunction.h @@ -55,7 +55,7 @@ namespace JSC { public: typedef JSNonFinalObject Base; - JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const Identifier& name, NativeFunction nativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor); + JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const UString& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor); static JSFunction* create(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChain) { @@ -139,19 +139,19 @@ namespace JSC { JS_EXPORT_PRIVATE JSFunction(ExecState*, JSGlobalObject*, Structure*); JSFunction(ExecState*, FunctionExecutable*, ScopeChainNode*); - void finishCreation(ExecState*, NativeExecutable*, int length, const Identifier& name); + void finishCreation(ExecState*, NativeExecutable*, int length, const UString& name); void finishCreation(ExecState*, FunctionExecutable*, ScopeChainNode*); Structure* cacheInheritorID(ExecState*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode = ExcludeDontEnumProperties); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static void visitChildren(JSCell*, SlotVisitor&); @@ -160,9 +160,9 @@ namespace JSC { JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const; - static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&); - static JSValue callerGetter(ExecState*, JSValue, const Identifier&); - static JSValue lengthGetter(ExecState*, JSValue, const Identifier&); + static JSValue argumentsGetter(ExecState*, JSValue, PropertyName); + static JSValue callerGetter(ExecState*, JSValue, PropertyName); + static JSValue lengthGetter(ExecState*, JSValue, PropertyName); WriteBarrier<ExecutableBase> m_executable; WriteBarrier<ScopeChainNode> m_scopeChain; diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp index b08c7dfa2..91ff9cefb 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp @@ -173,6 +173,9 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread { interpreter = new Interpreter; + if (isSharedInstance()) + turnOffVerifier(); + // Need to be careful to keep everything consistent here IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); JSLock lock(SilenceAssertionsOnly); diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index 0f74a8061..da55c0191 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -142,7 +142,7 @@ void JSGlobalObject::init(JSObject* thisValue) reset(prototype()); } -void JSGlobalObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSGlobalObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(cell); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -152,7 +152,7 @@ void JSGlobalObject::put(JSCell* cell, ExecState* exec, const Identifier& proper JSVariableObject::put(thisObject, exec, propertyName, value, slot); } -void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject)); @@ -170,7 +170,7 @@ void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, const I } } -bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); PropertySlot slot; @@ -205,8 +205,8 @@ void JSGlobalObject::reset(JSValue prototype) m_applyFunction.set(exec->globalData(), this, applyFunction); m_objectPrototype.set(exec->globalData(), this, ObjectPrototype::create(exec, this, ObjectPrototype::createStructure(exec->globalData(), this, jsNull()))); GetterSetter* protoAccessor = GetterSetter::create(exec); - protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, Identifier(), globalFuncProtoGetter)); - protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, Identifier(), globalFuncProtoSetter)); + protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoGetter)); + protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoSetter)); m_objectPrototype->putDirectAccessor(exec->globalData(), exec->propertyNames().underscoreProto, protoAccessor, Accessor | DontEnum); m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get()); @@ -293,7 +293,7 @@ void JSGlobalObject::reset(JSValue prototype) putDirectWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum); putDirectWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum); - m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, 1, exec->propertyNames().eval, globalFuncEval)); + m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, 1, exec->propertyNames().eval.ustring(), globalFuncEval)); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().eval, m_evalFunction.get(), DontEnum); putDirectWithoutTransition(exec->globalData(), Identifier(exec, "JSON"), JSONObject::create(exec, this, JSONObject::createStructure(exec->globalData(), this, m_objectPrototype.get())), DontEnum); @@ -311,7 +311,7 @@ void JSGlobalObject::reset(JSValue prototype) void JSGlobalObject::createThrowTypeError(ExecState* exec) { - JSFunction* thrower = JSFunction::create(exec, this, 0, Identifier(), globalFuncThrowTypeError); + JSFunction* thrower = JSFunction::create(exec, this, 0, "", globalFuncThrowTypeError); GetterSetter* getterSetter = GetterSetter::create(exec); getterSetter->setGetter(exec->globalData(), thrower); getterSetter->setSetter(exec->globalData(), thrower); @@ -431,7 +431,7 @@ void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count) } } -bool JSGlobalObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSGlobalObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(cell); if (getStaticFunctionSlot<JSVariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, slot)) @@ -439,7 +439,7 @@ bool JSGlobalObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Ide return thisObject->symbolTableGet(propertyName, slot); } -bool JSGlobalObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSGlobalObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); if (getStaticFunctionDescriptor<JSVariableObject>(exec, ExecState::globalObjectTable(exec), thisObject, propertyName, descriptor)) diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index d9fc81dc4..a330f5f1c 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -199,20 +199,20 @@ namespace JSC { JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&); - JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); - bool hasOwnPropertyForWrite(ExecState*, const Identifier&); - JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); + bool hasOwnPropertyForWrite(ExecState*, PropertyName); + JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); + JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); - JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes); - JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes); - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, PropertyName, JSObject* getterFunc, unsigned attributes); + JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, PropertyName, JSObject* setterFunc, unsigned attributes); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); // We use this in the code generator as we perform symbol table // lookups prior to initializing the properties - bool symbolTableHasProperty(const Identifier& propertyName); + bool symbolTableHasProperty(PropertyName); // The following accessors return pristine values, even if a script // replaces the global object's associated property. @@ -365,7 +365,7 @@ namespace JSC { m_registerArraySize = count; } - inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, const Identifier& propertyName) + inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, PropertyName propertyName) { PropertySlot slot; if (JSVariableObject::getOwnPropertySlot(this, exec, propertyName, slot)) @@ -374,7 +374,7 @@ namespace JSC { return symbolTableGet(propertyName, slot, slotIsWriteable); } - inline bool JSGlobalObject::symbolTableHasProperty(const Identifier& propertyName) + inline bool JSGlobalObject::symbolTableHasProperty(PropertyName propertyName) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); return !entry.isNull(); diff --git a/Source/JavaScriptCore/runtime/JSNotAnObject.cpp b/Source/JavaScriptCore/runtime/JSNotAnObject.cpp index 337e3a70c..f75fa1f96 100644 --- a/Source/JavaScriptCore/runtime/JSNotAnObject.cpp +++ b/Source/JavaScriptCore/runtime/JSNotAnObject.cpp @@ -47,7 +47,7 @@ JSValue JSNotAnObject::defaultValue(const JSObject*, ExecState* exec, PreferredP } // JSObject methods -bool JSNotAnObject::getOwnPropertySlot(JSCell*, ExecState* exec, const Identifier&, PropertySlot&) +bool JSNotAnObject::getOwnPropertySlot(JSCell*, ExecState* exec, PropertyName, PropertySlot&) { ASSERT_UNUSED(exec, exec->hadException()); return false; @@ -59,13 +59,13 @@ bool JSNotAnObject::getOwnPropertySlotByIndex(JSCell*, ExecState* exec, unsigned return false; } -bool JSNotAnObject::getOwnPropertyDescriptor(JSObject*, ExecState* exec, const Identifier&, PropertyDescriptor&) +bool JSNotAnObject::getOwnPropertyDescriptor(JSObject*, ExecState* exec, PropertyName, PropertyDescriptor&) { ASSERT_UNUSED(exec, exec->hadException()); return false; } -void JSNotAnObject::put(JSCell*, ExecState* exec, const Identifier& , JSValue, PutPropertySlot&) +void JSNotAnObject::put(JSCell*, ExecState* exec, PropertyName , JSValue, PutPropertySlot&) { ASSERT_UNUSED(exec, exec->hadException()); } @@ -75,7 +75,7 @@ void JSNotAnObject::putByIndex(JSCell*, ExecState* exec, unsigned, JSValue, bool ASSERT_UNUSED(exec, exec->hadException()); } -bool JSNotAnObject::deleteProperty(JSCell*, ExecState* exec, const Identifier&) +bool JSNotAnObject::deleteProperty(JSCell*, ExecState* exec, PropertyName) { ASSERT_UNUSED(exec, exec->hadException()); return false; diff --git a/Source/JavaScriptCore/runtime/JSNotAnObject.h b/Source/JavaScriptCore/runtime/JSNotAnObject.h index 5f80688b0..9980e4aab 100644 --- a/Source/JavaScriptCore/runtime/JSNotAnObject.h +++ b/Source/JavaScriptCore/runtime/JSNotAnObject.h @@ -68,14 +68,14 @@ namespace JSC { static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); // JSObject methods - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp index 436e78353..de9977d6e 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.cpp +++ b/Source/JavaScriptCore/runtime/JSONObject.cpp @@ -595,12 +595,12 @@ const ClassInfo JSONObject::s_info = { "JSON", &JSNonFinalObject::s_info, 0, Exe // ECMA 15.8 -bool JSONObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSONObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::jsonTable(exec), jsCast<JSONObject*>(cell), propertyName, slot); } -bool JSONObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSONObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::jsonTable(exec), jsCast<JSONObject*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/JSONObject.h b/Source/JavaScriptCore/runtime/JSONObject.h index 29535f6d0..3b8647714 100644 --- a/Source/JavaScriptCore/runtime/JSONObject.h +++ b/Source/JavaScriptCore/runtime/JSONObject.h @@ -56,8 +56,8 @@ namespace JSC { private: JSONObject(JSGlobalObject*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index a8c6c3f3f..baba28b46 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -120,7 +120,7 @@ bool JSObject::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned } // ECMA 8.6.2.2 -void JSObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSObject* thisObject = jsCast<JSObject*>(cell); ASSERT(value); @@ -192,7 +192,7 @@ void JSObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, propertyName), value, slot); } -void JSObject::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); PutPropertySlot slot; @@ -221,7 +221,7 @@ bool JSObject::allowsAccessFrom(ExecState* exec) return globalObject->globalObjectMethodTable()->allowsAccessFrom(globalObject, exec); } -void JSObject::putDirectAccessor(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSObject::putDirectAccessor(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(value.isGetterSetter() && (attributes & Accessor)); @@ -240,7 +240,7 @@ void JSObject::putDirectAccessor(JSGlobalData& globalData, const Identifier& pro structure()->setHasGetterSetterProperties(propertyName == globalData.propertyNames->underscoreProto); } -bool JSObject::hasProperty(ExecState* exec, const Identifier& propertyName) const +bool JSObject::hasProperty(ExecState* exec, PropertyName propertyName) const { PropertySlot slot; return const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot); @@ -253,7 +253,7 @@ bool JSObject::hasProperty(ExecState* exec, unsigned propertyName) const } // ECMA 8.6.2.5 -bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSObject* thisObject = jsCast<JSObject*>(cell); @@ -278,7 +278,7 @@ bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& p return true; } -bool JSObject::hasOwnProperty(ExecState* exec, const Identifier& propertyName) const +bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const { PropertySlot slot; return const_cast<JSObject*>(this)->methodTable()->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot); @@ -290,7 +290,7 @@ bool JSObject::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned pro return thisObject->methodTable()->deleteProperty(thisObject, exec, Identifier::from(exec, propertyName)); } -static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSObject* object, const Identifier& propertyName) +static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSObject* object, PropertyName propertyName) { JSValue function = object->get(exec, propertyName); CallData callData; @@ -344,7 +344,7 @@ JSValue JSObject::defaultValue(const JSObject* object, ExecState* exec, Preferre return throwError(exec, createTypeError(exec, "No default value")); } -const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifier& propertyName) const +const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, PropertyName propertyName) const { for (const ClassInfo* info = classInfo(); info; info = info->parentClass) { if (const HashTable* propHashTable = info->propHashTable(exec)) { @@ -381,7 +381,7 @@ bool JSObject::propertyIsEnumerable(ExecState* exec, const Identifier& propertyN return descriptor.enumerable(); } -bool JSObject::getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificValue) const +bool JSObject::getPropertySpecificValue(ExecState* exec, PropertyName propertyName, JSCell*& specificValue) const { unsigned attributes; if (structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) @@ -510,7 +510,7 @@ void JSObject::reifyStaticFunctionsForDelete(ExecState* exec) structure()->setStaticFunctionsReified(); } -void JSObject::removeDirect(JSGlobalData& globalData, const Identifier& propertyName) +void JSObject::removeDirect(JSGlobalData& globalData, PropertyName propertyName) { if (structure()->get(globalData, propertyName) == WTF::notFound) return; @@ -552,7 +552,7 @@ Structure* JSObject::createInheritorID(JSGlobalData& globalData) return m_inheritorID.get(); } -void JSObject::allocatePropertyStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize) +PropertyStorage JSObject::growPropertyStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize) { ASSERT(newSize > oldSize); @@ -580,10 +580,10 @@ void JSObject::allocatePropertyStorage(JSGlobalData& globalData, size_t oldSize, } ASSERT(newPropertyStorage); - m_propertyStorage.set(globalData, this, newPropertyStorage); + return newPropertyStorage; } -bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { unsigned attributes = 0; JSCell* cell = 0; @@ -594,7 +594,7 @@ bool JSObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const return true; } -bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSObject::getPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSObject* object = this; while (true) { @@ -607,7 +607,7 @@ bool JSObject::getPropertyDescriptor(ExecState* exec, const Identifier& property } } -static bool putDescriptor(ExecState* exec, JSObject* target, const Identifier& propertyName, PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor) +static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName propertyName, PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor) { if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) { if (descriptor.isGenericDescriptor() && oldDescriptor.isAccessorDescriptor()) { @@ -662,7 +662,7 @@ private: JSGlobalData& m_globalData; }; -bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { // Track on the globaldata that we're in define property. // Currently DefineOwnProperty uses delete to remove properties when they are being replaced diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h index 7345bb700..0a4f1c745 100644 --- a/Source/JavaScriptCore/runtime/JSObject.h +++ b/Source/JavaScriptCore/runtime/JSObject.h @@ -75,7 +75,7 @@ namespace JSC { friend class JIT; friend class JSCell; friend class MarkedBlock; - JS_EXPORT_PRIVATE friend bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot); + JS_EXPORT_PRIVATE friend bool setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject*, PropertyName, PropertySlot&); enum PutMode { PutModePut, @@ -95,39 +95,39 @@ namespace JSC { Structure* inheritorID(JSGlobalData&); - JSValue get(ExecState*, const Identifier& propertyName) const; + JSValue get(ExecState*, PropertyName) const; JSValue get(ExecState*, unsigned propertyName) const; - bool getPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool getPropertySlot(ExecState*, PropertyName, PropertySlot&); bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); - JS_EXPORT_PRIVATE bool getPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&); + JS_EXPORT_PRIVATE bool getPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); bool allowsAccessFrom(ExecState*); - JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); // putDirect is effectively an unchecked vesion of 'defineOwnProperty': // - the prototype chain is not consulted // - accessors are not called. // - attributes will be respected (after the call the property will exist with the given attributes) - JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); - void putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attributes = 0); - void putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, PutPropertySlot&); - void putDirectWithoutTransition(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attributes = 0); - void putDirectAccessor(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attributes); + JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); + void putDirect(JSGlobalData&, PropertyName, JSValue, unsigned attributes = 0); + void putDirect(JSGlobalData&, PropertyName, JSValue, PutPropertySlot&); + void putDirectWithoutTransition(JSGlobalData&, PropertyName, JSValue, unsigned attributes = 0); + void putDirectAccessor(JSGlobalData&, PropertyName, JSValue, unsigned attributes); bool propertyIsEnumerable(ExecState*, const Identifier& propertyName) const; - JS_EXPORT_PRIVATE bool hasProperty(ExecState*, const Identifier& propertyName) const; + JS_EXPORT_PRIVATE bool hasProperty(ExecState*, PropertyName) const; JS_EXPORT_PRIVATE bool hasProperty(ExecState*, unsigned propertyName) const; - bool hasOwnProperty(ExecState*, const Identifier& propertyName) const; + bool hasOwnProperty(ExecState*, PropertyName) const; - JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName); JS_EXPORT_PRIVATE static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); JS_EXPORT_PRIVATE static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); @@ -148,22 +148,22 @@ namespace JSC { JS_EXPORT_PRIVATE static JSObject* toThisObject(JSCell*, ExecState*); JSObject* unwrappedObject(); - bool getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificFunction) const; + bool getPropertySpecificValue(ExecState*, PropertyName, JSCell*& specificFunction) const; // This get function only looks at the property map. - JSValue getDirect(JSGlobalData& globalData, const Identifier& propertyName) const + JSValue getDirect(JSGlobalData& globalData, PropertyName propertyName) const { size_t offset = structure()->get(globalData, propertyName); return offset != WTF::notFound ? getDirectOffset(offset) : JSValue(); } - WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName) + WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, PropertyName propertyName) { size_t offset = structure()->get(globalData, propertyName); return offset != WTF::notFound ? locationForOffset(offset) : 0; } - WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes) + WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, PropertyName propertyName, unsigned& attributes) { JSCell* specificFunction; size_t offset = structure()->get(globalData, propertyName, attributes, specificFunction); @@ -177,7 +177,7 @@ namespace JSC { void transitionTo(JSGlobalData&, Structure*); - void removeDirect(JSGlobalData&, const Identifier& propertyName); + void removeDirect(JSGlobalData&, PropertyName); bool hasCustomProperties() { return structure()->didTransition(); } bool hasGetterSetterProperties() { return structure()->hasGetterSetterProperties(); } @@ -186,14 +186,14 @@ namespace JSC { // - provides no special handling for __proto__ // - does not walk the prototype chain (to check for accessors or non-writable properties). // This is used by JSActivation. - bool putOwnDataProperty(JSGlobalData&, const Identifier& propertyName, JSValue, PutPropertySlot&); + bool putOwnDataProperty(JSGlobalData&, PropertyName, JSValue, PutPropertySlot&); // Fast access to known property offsets. JSValue getDirectOffset(size_t offset) const { return propertyStorage()[offset].get(); } void putDirectOffset(JSGlobalData& globalData, size_t offset, JSValue value) { propertyStorage()[offset].set(globalData, this, value); } void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); } - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); bool isGlobalObject() const; bool isVariableObject() const; @@ -212,8 +212,9 @@ namespace JSC { bool staticFunctionsReified() { return structure()->staticFunctionsReified(); } void reifyStaticFunctionsForDelete(ExecState* exec); - JS_EXPORT_PRIVATE void allocatePropertyStorage(JSGlobalData&, size_t oldSize, size_t newSize); + JS_EXPORT_PRIVATE PropertyStorage growPropertyStorage(JSGlobalData&, size_t oldSize, size_t newSize); bool isUsingInlineStorage() const { return static_cast<const void*>(m_propertyStorage.get()) == static_cast<const void*>(this + 1); } + void setPropertyStorage(JSGlobalData&, PropertyStorage, Structure*); void* addressOfPropertyStorage() { @@ -294,12 +295,12 @@ namespace JSC { } template<PutMode> - bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*); + bool putDirectInternal(JSGlobalData&, PropertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*); - bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool inlineGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&); JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location); - const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const; + const HashEntry* findPropertyHashEntry(ExecState*, PropertyName) const; Structure* createInheritorID(JSGlobalData&); StorageBarrier m_propertyStorage; @@ -452,6 +453,14 @@ inline bool JSObject::isGlobalThis() const return structure()->typeInfo().type() == GlobalThisType; } +inline void JSObject::setPropertyStorage(JSGlobalData& globalData, PropertyStorage storage, Structure* structure) +{ + ASSERT(storage); + ASSERT(structure); + setStructure(globalData, structure); + m_propertyStorage.set(globalData, this, storage); +} + inline JSObject* constructEmptyObject(ExecState* exec, Structure* structure) { return JSFinalObject::create(exec, structure); @@ -539,7 +548,7 @@ inline JSObject* JSValue::toThisObject(ExecState* exec) const return isCell() ? asCell()->methodTable()->toThisObject(asCell(), exec) : toThisObjectSlowCase(exec); } -ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) { if (structure()->hasGetterSetterProperties() && location->isGetterSetter()) @@ -555,12 +564,12 @@ ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Ide // It may seem crazy to inline a function this large, especially a virtual function, // but it makes a big difference to property lookup that derived classes can inline their // base class call to this. -ALWAYS_INLINE bool JSObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return jsCast<JSObject*>(cell)->inlineGetOwnPropertySlot(exec, propertyName, slot); } -ALWAYS_INLINE bool JSCell::fastGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSCell::fastGetOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (!structure()->typeInfo().overridesGetOwnPropertySlot()) return asObject(this)->inlineGetOwnPropertySlot(exec, propertyName, slot); @@ -585,7 +594,7 @@ ALWAYS_INLINE JSValue JSCell::fastGetOwnProperty(ExecState* exec, const UString& // It may seem crazy to inline a function this large but it makes a big difference // since this is function very hot in variable lookup -ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSObject* object = this; while (true) { @@ -611,7 +620,7 @@ ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, unsigned propertyN } } -inline JSValue JSObject::get(ExecState* exec, const Identifier& propertyName) const +inline JSValue JSObject::get(ExecState* exec, PropertyName propertyName) const { PropertySlot slot(this); if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot)) @@ -630,7 +639,7 @@ inline JSValue JSObject::get(ExecState* exec, unsigned propertyName) const } template<JSObject::PutMode mode> -inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, PutPropertySlot& slot, JSCell* specificFunction) +inline bool JSObject::putDirectInternal(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes, PutPropertySlot& slot, JSCell* specificFunction) { ASSERT(value); ASSERT(value.isGetterSetter() == !!(attributes & Accessor)); @@ -663,10 +672,11 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi if ((mode == PutModePut) && !isExtensible()) return false; - size_t currentCapacity = structure()->propertyStorageCapacity(); + PropertyStorage newStorage = propertyStorage(); + if (structure()->shouldGrowPropertyStorage()) + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), structure()->suggestedNewPropertyStorageSize()); offset = structure()->addPropertyWithoutTransition(globalData, propertyName, attributes, specificFunction); - if (currentCapacity != structure()->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure()->propertyStorageCapacity()); + setPropertyStorage(globalData, newStorage, structure()); ASSERT(offset < structure()->propertyStorageCapacity()); putDirectOffset(globalData, offset, value); @@ -678,12 +688,13 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi size_t offset; size_t currentCapacity = structure()->propertyStorageCapacity(); - if (Structure* structure = Structure::addPropertyTransitionToExistingStructure(this->structure(), propertyName, attributes, specificFunction, offset)) { + if (Structure* structure = Structure::addPropertyTransitionToExistingStructure(this->structure(), propertyName, attributes, specificFunction, offset)) { + PropertyStorage newStorage = propertyStorage(); if (currentCapacity != structure->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity()); + newStorage = growPropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity()); ASSERT(offset < structure->propertyStorageCapacity()); - setStructure(globalData, structure); + setPropertyStorage(globalData, newStorage, structure); putDirectOffset(globalData, offset, value); // This is a new property; transitions with specific values are not currently cachable, // so leave the slot in an uncachable state. @@ -727,13 +738,14 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi if ((mode == PutModePut) && !isExtensible()) return false; - Structure* structure = Structure::addPropertyTransition(globalData, this->structure(), propertyName, attributes, specificFunction, offset); + PropertyStorage newStorage = propertyStorage(); + if (structure()->shouldGrowPropertyStorage()) + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), structure()->suggestedNewPropertyStorageSize()); - if (currentCapacity != structure->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity()); + Structure* structure = Structure::addPropertyTransition(globalData, this->structure(), propertyName, attributes, specificFunction, offset); ASSERT(offset < structure->propertyStorageCapacity()); - setStructure(globalData, structure); + setPropertyStorage(globalData, newStorage, structure); putDirectOffset(globalData, offset, value); // This is a new property; transitions with specific values are not currently cachable, // so leave the slot in an uncachable state. @@ -742,7 +754,7 @@ inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifi return true; } -inline bool JSObject::putOwnDataProperty(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +inline bool JSObject::putOwnDataProperty(JSGlobalData& globalData, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { ASSERT(value); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -751,34 +763,36 @@ inline bool JSObject::putOwnDataProperty(JSGlobalData& globalData, const Identif return putDirectInternal<PutModePut>(globalData, propertyName, value, 0, slot, getJSFunction(value)); } -inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +inline void JSObject::putDirect(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); PutPropertySlot slot; putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, value, attributes, slot, getJSFunction(value)); } -inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +inline void JSObject::putDirect(JSGlobalData& globalData, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { ASSERT(!value.isGetterSetter()); putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, value, 0, slot, getJSFunction(value)); } -inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) +inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); - size_t currentCapacity = structure()->propertyStorageCapacity(); + PropertyStorage newStorage = propertyStorage(); + if (structure()->shouldGrowPropertyStorage()) + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), structure()->suggestedNewPropertyStorageSize()); size_t offset = structure()->addPropertyWithoutTransition(globalData, propertyName, attributes, getJSFunction(value)); - if (currentCapacity != structure()->propertyStorageCapacity()) - allocatePropertyStorage(globalData, currentCapacity, structure()->propertyStorageCapacity()); + setPropertyStorage(globalData, newStorage, structure()); putDirectOffset(globalData, offset, value); } inline void JSObject::transitionTo(JSGlobalData& globalData, Structure* newStructure) { + PropertyStorage newStorage = propertyStorage(); if (structure()->propertyStorageCapacity() != newStructure->propertyStorageCapacity()) - allocatePropertyStorage(globalData, structure()->propertyStorageCapacity(), newStructure->propertyStorageCapacity()); - setStructure(globalData, newStructure); + newStorage = growPropertyStorage(globalData, structure()->propertyStorageCapacity(), newStructure->propertyStorageCapacity()); + setPropertyStorage(globalData, newStorage, newStructure); } inline JSValue JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const @@ -786,13 +800,13 @@ inline JSValue JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType pre return methodTable()->defaultValue(this, exec, preferredType); } -inline JSValue JSValue::get(ExecState* exec, const Identifier& propertyName) const +inline JSValue JSValue::get(ExecState* exec, PropertyName propertyName) const { PropertySlot slot(asValue()); return get(exec, propertyName, slot); } -inline JSValue JSValue::get(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) const +inline JSValue JSValue::get(ExecState* exec, PropertyName propertyName, PropertySlot& slot) const { if (UNLIKELY(!isCell())) { JSObject* prototype = synthesizePrototype(exec); @@ -836,7 +850,7 @@ inline JSValue JSValue::get(ExecState* exec, unsigned propertyName, PropertySlot } } -inline void JSValue::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +inline void JSValue::put(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { if (UNLIKELY(!isCell())) { putToPrimitive(exec, propertyName, value, slot); diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp index f8942b5f8..fc4c27bab 100644 --- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp +++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp @@ -54,7 +54,7 @@ JSObject* JSStaticScopeObject::toThisObject(JSCell*, ExecState* exec) return exec->globalThisValue(); } -void JSStaticScopeObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSStaticScopeObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSStaticScopeObject* thisObject = jsCast<JSStaticScopeObject*>(cell); if (slot.isStrictMode()) { @@ -78,7 +78,7 @@ void JSStaticScopeObject::put(JSCell* cell, ExecState* exec, const Identifier& p ASSERT_NOT_REACHED(); } -void JSStaticScopeObject::putDirectVirtual(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +void JSStaticScopeObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes) { JSStaticScopeObject* thisObject = jsCast<JSStaticScopeObject*>(object); if (thisObject->symbolTablePutWithAttributes(exec->globalData(), propertyName, value, attributes)) @@ -87,7 +87,7 @@ void JSStaticScopeObject::putDirectVirtual(JSObject* object, ExecState* exec, co ASSERT_NOT_REACHED(); } -bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, const Identifier& propertyName, PropertySlot& slot) +bool JSStaticScopeObject::getOwnPropertySlot(JSCell* cell, ExecState*, PropertyName propertyName, PropertySlot& slot) { return jsCast<JSStaticScopeObject*>(cell)->symbolTableGet(propertyName, slot); } diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h index bbf03a347..f351349a6 100644 --- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.h +++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.h @@ -44,10 +44,10 @@ namespace JSC{ static void visitChildren(JSCell*, SlotVisitor&); bool isDynamicScope(bool& requiresDynamicChecks) const; static JSObject* toThisObject(JSCell*, ExecState*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static void putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes); + static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(globalData, globalObject, proto, TypeInfo(StaticScopeObjectType, StructureFlags), &s_info); } diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp index 904cc4d3e..7faa393c3 100644 --- a/Source/JavaScriptCore/runtime/JSString.cpp +++ b/Source/JavaScriptCore/runtime/JSString.cpp @@ -257,7 +257,7 @@ JSObject* JSString::toThisObject(JSCell* cell, ExecState* exec) return StringObject::create(exec, exec->lexicalGlobalObject(), jsCast<JSString*>(cell)); } -bool JSString::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSString::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSString* thisObject = jsCast<JSString*>(cell); // The semantics here are really getPropertySlot, not getOwnPropertySlot. @@ -275,16 +275,16 @@ bool JSString::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifie return true; } -bool JSString::getStringPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSString::getStringPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { descriptor.setDescriptor(jsNumber(m_length), DontEnum | DontDelete | ReadOnly); return true; } - bool isStrictUInt32; - unsigned i = propertyName.toUInt32(isStrictUInt32); - if (isStrictUInt32 && i < m_length) { + unsigned i = propertyName.asIndex(); + if (i < m_length) { + ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! descriptor.setDescriptor(getIndex(exec, i), DontDelete | ReadOnly); return true; } diff --git a/Source/JavaScriptCore/runtime/JSString.h b/Source/JavaScriptCore/runtime/JSString.h index c95233deb..4ba9b79ad 100644 --- a/Source/JavaScriptCore/runtime/JSString.h +++ b/Source/JavaScriptCore/runtime/JSString.h @@ -67,7 +67,6 @@ namespace JSC { friend class JSGlobalData; friend class SpecializedThunkJIT; friend class JSRopeString; - friend class MarkStack; friend struct ThunkHelpers; typedef JSCell Base; @@ -92,7 +91,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = length; m_is8Bit = m_value.impl()->is8Bit(); - m_isHashConstSingleton = false; } void finishCreation(JSGlobalData& globalData, size_t length, size_t cost) @@ -101,7 +99,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = length; m_is8Bit = m_value.impl()->is8Bit(); - m_isHashConstSingleton = false; Heap::heap(this)->reportExtraMemoryCost(cost); } @@ -111,7 +108,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = 0; m_is8Bit = true; - m_isHashConstSingleton = false; } public: @@ -143,9 +139,9 @@ namespace JSC { JSObject* toObject(ExecState*, JSGlobalObject*) const; double toNumber(ExecState*) const; - bool getStringPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + bool getStringPropertySlot(ExecState*, PropertyName, PropertySlot&); bool getStringPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); - bool getStringPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&); + bool getStringPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&); bool canGetIndex(unsigned i) { return i < m_length; } JSString* getIndex(ExecState*, unsigned); @@ -165,13 +161,9 @@ namespace JSC { protected: bool isRope() const { return m_value.isNull(); } bool is8Bit() const { return m_is8Bit; } - bool isHashConstSingleton() const { return m_isHashConstSingleton; } - void clearHashConstSingleton() { m_isHashConstSingleton = false; } - void setHashConstSingleton() { m_isHashConstSingleton = true; } // A string is represented either by a UString or a rope of fibers. bool m_is8Bit : 1; - bool m_isHashConstSingleton : 1; unsigned m_length; mutable UString m_value; @@ -181,7 +173,7 @@ namespace JSC { static JSObject* toThisObject(JSCell*, ExecState*); // Actually getPropertySlot, not getOwnPropertySlot (see JSCell). - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); UString& string() { ASSERT(!isRope()); return m_value; } @@ -241,7 +233,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = s1->length() + s2->length(); m_is8Bit = (s1->is8Bit() && s2->is8Bit()); - m_isHashConstSingleton = false; m_fibers[0].set(globalData, this, s1); m_fibers[1].set(globalData, this, s2); } @@ -251,7 +242,6 @@ namespace JSC { Base::finishCreation(globalData); m_length = s1->length() + s2->length() + s3->length(); m_is8Bit = (s1->is8Bit() && s2->is8Bit() && s3->is8Bit()); - m_isHashConstSingleton = false; m_fibers[0].set(globalData, this, s1); m_fibers[1].set(globalData, this, s2); m_fibers[2].set(globalData, this, s3); @@ -449,16 +439,16 @@ namespace JSC { inline JSString* jsNontrivialString(ExecState* exec, const char* s) { return jsNontrivialString(&exec->globalData(), s); } inline JSString* jsOwnedString(ExecState* exec, const UString& s) { return jsOwnedString(&exec->globalData(), s); } - ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) + ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (propertyName == exec->propertyNames().length) { slot.setValue(jsNumber(m_length)); return true; } - bool isStrictUInt32; - unsigned i = propertyName.toUInt32(isStrictUInt32); - if (isStrictUInt32 && i < m_length) { + unsigned i = propertyName.asIndex(); + if (i < m_length) { + ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! slot.setValue(getIndex(exec, i)); return true; } diff --git a/Source/JavaScriptCore/runtime/JSValue.cpp b/Source/JavaScriptCore/runtime/JSValue.cpp index 088f214b9..628642f71 100644 --- a/Source/JavaScriptCore/runtime/JSValue.cpp +++ b/Source/JavaScriptCore/runtime/JSValue.cpp @@ -109,7 +109,7 @@ JSObject* JSValue::synthesizePrototype(ExecState* exec) const } // ECMA 8.7.2 -void JSValue::putToPrimitive(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSGlobalData& globalData = exec->globalData(); diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index 7facb9353..40cf69979 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -36,12 +36,12 @@ namespace JSC { class ExecState; - class Identifier; class JSCell; class JSGlobalData; class JSGlobalObject; class JSObject; class JSString; + class PropertyName; class PropertySlot; class PutPropertySlot; class UString; @@ -219,12 +219,12 @@ namespace JSC { float toFloat(ExecState* exec) const { return static_cast<float>(toNumber(exec)); } // Object operations, with the toObject operation included. - JSValue get(ExecState*, const Identifier& propertyName) const; - JSValue get(ExecState*, const Identifier& propertyName, PropertySlot&) const; + JSValue get(ExecState*, PropertyName) const; + JSValue get(ExecState*, PropertyName, PropertySlot&) const; JSValue get(ExecState*, unsigned propertyName) const; JSValue get(ExecState*, unsigned propertyName, PropertySlot&) const; - void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); - void putToPrimitive(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + void put(ExecState*, PropertyName, JSValue, PutPropertySlot&); + void putToPrimitive(ExecState*, PropertyName, JSValue, PutPropertySlot&); void putByIndex(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); JSObject* toThisObject(ExecState*) const; diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.cpp b/Source/JavaScriptCore/runtime/JSVariableObject.cpp index 8ca695074..3a4df7464 100644 --- a/Source/JavaScriptCore/runtime/JSVariableObject.cpp +++ b/Source/JavaScriptCore/runtime/JSVariableObject.cpp @@ -42,7 +42,7 @@ void JSVariableObject::destroy(JSCell* cell) jsCast<JSVariableObject*>(cell)->JSVariableObject::~JSVariableObject(); } -bool JSVariableObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSVariableObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSVariableObject* thisObject = jsCast<JSVariableObject*>(cell); if (thisObject->symbolTable().contains(propertyName.impl())) @@ -63,7 +63,7 @@ void JSVariableObject::getOwnPropertyNames(JSObject* object, ExecState* exec, Pr JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertyDescriptor& descriptor) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (!entry.isNull()) { @@ -73,7 +73,7 @@ bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDe return false; } -void JSVariableObject::putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned) +void JSVariableObject::putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned) { ASSERT_NOT_REACHED(); } diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.h b/Source/JavaScriptCore/runtime/JSVariableObject.h index bcfe4ab89..8b7587b5c 100644 --- a/Source/JavaScriptCore/runtime/JSVariableObject.h +++ b/Source/JavaScriptCore/runtime/JSVariableObject.h @@ -52,9 +52,9 @@ namespace JSC { JS_EXPORT_PRIVATE static void destroy(JSCell*); - static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, const Identifier&, JSValue, unsigned attributes); + static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes); - JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, const Identifier&); + JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName); JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); bool isDynamicScope(bool& requiresDynamicChecks) const; @@ -89,18 +89,18 @@ namespace JSC { PassOwnArrayPtr<WriteBarrier<Unknown> > copyRegisterArray(JSGlobalData&, WriteBarrier<Unknown>* src, size_t count, size_t callframeStarts); void setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray); - bool symbolTableGet(const Identifier&, PropertySlot&); - JS_EXPORT_PRIVATE bool symbolTableGet(const Identifier&, PropertyDescriptor&); - bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable); - bool symbolTablePut(ExecState*, const Identifier&, JSValue, bool shouldThrow); - bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes); + bool symbolTableGet(PropertyName, PropertySlot&); + JS_EXPORT_PRIVATE bool symbolTableGet(PropertyName, PropertyDescriptor&); + bool symbolTableGet(PropertyName, PropertySlot&, bool& slotIsWriteable); + bool symbolTablePut(ExecState*, PropertyName, JSValue, bool shouldThrow); + bool symbolTablePutWithAttributes(JSGlobalData&, PropertyName, JSValue, unsigned attributes); SymbolTable* m_symbolTable; // Maps name -> offset from "r" in register file. WriteBarrier<Unknown>* m_registers; // "r" in the register file. OwnArrayPtr<WriteBarrier<Unknown> > m_registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file. }; - inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot) + inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (!entry.isNull()) { @@ -110,7 +110,7 @@ namespace JSC { return false; } - inline bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertySlot& slot, bool& slotIsWriteable) + inline bool JSVariableObject::symbolTableGet(PropertyName propertyName, PropertySlot& slot, bool& slotIsWriteable) { SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl()); if (!entry.isNull()) { @@ -121,7 +121,7 @@ namespace JSC { return false; } - inline bool JSVariableObject::symbolTablePut(ExecState* exec, const Identifier& propertyName, JSValue value, bool shouldThrow) + inline bool JSVariableObject::symbolTablePut(ExecState* exec, PropertyName propertyName, JSValue value, bool shouldThrow) { JSGlobalData& globalData = exec->globalData(); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -138,7 +138,7 @@ namespace JSC { return true; } - inline bool JSVariableObject::symbolTablePutWithAttributes(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) + inline bool JSVariableObject::symbolTablePutWithAttributes(JSGlobalData& globalData, PropertyName propertyName, JSValue value, unsigned attributes) { ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); diff --git a/Source/JavaScriptCore/runtime/Lookup.cpp b/Source/JavaScriptCore/runtime/Lookup.cpp index b935eb260..30d982d2c 100644 --- a/Source/JavaScriptCore/runtime/Lookup.cpp +++ b/Source/JavaScriptCore/runtime/Lookup.cpp @@ -64,7 +64,7 @@ void HashTable::deleteTable() const } } -bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot) +bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* thisObj, PropertyName propertyName, PropertySlot& slot) { ASSERT(thisObj->globalObject()); ASSERT(entry->attributes() & Function); @@ -76,7 +76,7 @@ bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject* if (thisObj->staticFunctionsReified()) return false; - JSFunction* function = JSFunction::create(exec, thisObj->globalObject(), entry->functionLength(), propertyName, entry->function(), entry->intrinsic()); + JSFunction* function = JSFunction::create(exec, thisObj->globalObject(), entry->functionLength(), propertyName.ustring(), entry->function(), entry->intrinsic()); thisObj->putDirect(exec->globalData(), propertyName, function, entry->attributes()); location = thisObj->getDirectLocation(exec->globalData(), propertyName); } diff --git a/Source/JavaScriptCore/runtime/Lookup.h b/Source/JavaScriptCore/runtime/Lookup.h index 64d06b503..d6806ae0c 100644 --- a/Source/JavaScriptCore/runtime/Lookup.h +++ b/Source/JavaScriptCore/runtime/Lookup.h @@ -129,13 +129,13 @@ namespace JSC { JS_EXPORT_PRIVATE void deleteTable() const; // Find an entry in the table, and return the entry. - ALWAYS_INLINE const HashEntry* entry(JSGlobalData* globalData, const Identifier& identifier) const + ALWAYS_INLINE const HashEntry* entry(JSGlobalData* globalData, PropertyName identifier) const { initializeIfNeeded(globalData); return entry(identifier); } - ALWAYS_INLINE const HashEntry* entry(ExecState* exec, const Identifier& identifier) const + ALWAYS_INLINE const HashEntry* entry(ExecState* exec, PropertyName identifier) const { initializeIfNeeded(exec); return entry(identifier); @@ -199,7 +199,7 @@ namespace JSC { } private: - ALWAYS_INLINE const HashEntry* entry(const Identifier& identifier) const + ALWAYS_INLINE const HashEntry* entry(PropertyName identifier) const { ASSERT(table); @@ -221,7 +221,7 @@ namespace JSC { JS_EXPORT_PRIVATE void createTable(JSGlobalData*) const; }; - JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject* thisObject, const Identifier& propertyName, PropertySlot&); + JS_EXPORT_PRIVATE bool setUpStaticFunctionSlot(ExecState*, const HashEntry*, JSObject* thisObject, PropertyName, PropertySlot&); /** * This method does it all (looking in the hashtable, checking for function @@ -230,7 +230,7 @@ namespace JSC { * unknown property). */ template <class ThisImp, class ParentImp> - inline bool getStaticPropertySlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot) + inline bool getStaticPropertySlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot) { const HashEntry* entry = table->entry(exec, propertyName); @@ -245,7 +245,7 @@ namespace JSC { } template <class ThisImp, class ParentImp> - inline bool getStaticPropertyDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor) + inline bool getStaticPropertyDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor) { const HashEntry* entry = table->entry(exec, propertyName); @@ -271,7 +271,7 @@ namespace JSC { * a dummy getValueProperty. */ template <class ParentImp> - inline bool getStaticFunctionSlot(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot) + inline bool getStaticFunctionSlot(ExecState* exec, const HashTable* table, JSObject* thisObj, PropertyName propertyName, PropertySlot& slot) { if (ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot)) return true; @@ -289,7 +289,7 @@ namespace JSC { * a dummy getValueProperty. */ template <class ParentImp> - inline bool getStaticFunctionDescriptor(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor) + inline bool getStaticFunctionDescriptor(ExecState* exec, const HashTable* table, JSObject* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor) { if (ParentImp::getOwnPropertyDescriptor(static_cast<ParentImp*>(thisObj), exec, propertyName, descriptor)) return true; @@ -310,7 +310,7 @@ namespace JSC { * Using this instead of getStaticPropertySlot removes the need for a FuncImp class. */ template <class ThisImp, class ParentImp> - inline bool getStaticValueSlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot) + inline bool getStaticValueSlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot) { const HashEntry* entry = table->entry(exec, propertyName); @@ -328,7 +328,7 @@ namespace JSC { * Using this instead of getStaticPropertyDescriptor removes the need for a FuncImp class. */ template <class ThisImp, class ParentImp> - inline bool getStaticValueDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertyDescriptor& descriptor) + inline bool getStaticValueDescriptor(ExecState* exec, const HashTable* table, ThisImp* thisObj, PropertyName propertyName, PropertyDescriptor& descriptor) { const HashEntry* entry = table->entry(exec, propertyName); @@ -348,7 +348,7 @@ namespace JSC { * is found it sets the value and returns true, else it returns false. */ template <class ThisImp> - inline bool lookupPut(ExecState* exec, const Identifier& propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, bool shouldThrow = false) + inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, bool shouldThrow = false) { const HashEntry* entry = table->entry(exec, propertyName); @@ -373,7 +373,7 @@ namespace JSC { * then it calls put() on the ParentImp class. */ template <class ThisImp, class ParentImp> - inline void lookupPut(ExecState* exec, const Identifier& propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, PutPropertySlot& slot) + inline void lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable* table, ThisImp* thisObj, PutPropertySlot& slot) { if (!lookupPut<ThisImp>(exec, propertyName, value, table, thisObj, slot.isStrictMode())) ParentImp::put(thisObj, exec, propertyName, value, slot); // not found: forward to parent diff --git a/Source/JavaScriptCore/runtime/MathObject.cpp b/Source/JavaScriptCore/runtime/MathObject.cpp index 58b09122d..9d83290a5 100644 --- a/Source/JavaScriptCore/runtime/MathObject.cpp +++ b/Source/JavaScriptCore/runtime/MathObject.cpp @@ -106,12 +106,12 @@ void MathObject::finishCreation(ExecState* exec, JSGlobalObject* globalObject) putDirectWithoutTransition(exec->globalData(), Identifier(exec, "SQRT2"), jsNumber(sqrt(2.0)), DontDelete | DontEnum | ReadOnly); } -bool MathObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool MathObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::mathTable(exec), jsCast<MathObject*>(cell), propertyName, slot); } -bool MathObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool MathObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::mathTable(exec), jsCast<MathObject*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/MathObject.h b/Source/JavaScriptCore/runtime/MathObject.h index d8da039d8..f4082f087 100644 --- a/Source/JavaScriptCore/runtime/MathObject.h +++ b/Source/JavaScriptCore/runtime/MathObject.h @@ -38,8 +38,8 @@ namespace JSC { object->finishCreation(exec, globalObject); return object; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/NativeErrorConstructor.h b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h index 41e4235fa..76aea9da8 100644 --- a/Source/JavaScriptCore/runtime/NativeErrorConstructor.h +++ b/Source/JavaScriptCore/runtime/NativeErrorConstructor.h @@ -53,7 +53,7 @@ namespace JSC { protected: void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& name) { - Base::finishCreation(exec->globalData(), Identifier(exec, name)); + Base::finishCreation(exec->globalData(), name); ASSERT(inherits(&s_info)); NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, name, this); diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.cpp b/Source/JavaScriptCore/runtime/NumberConstructor.cpp index e1ff62f32..03d616073 100644 --- a/Source/JavaScriptCore/runtime/NumberConstructor.cpp +++ b/Source/JavaScriptCore/runtime/NumberConstructor.cpp @@ -30,11 +30,11 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(NumberConstructor); -static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&); -static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&); +static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName); +static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName); } // namespace JSC @@ -63,7 +63,7 @@ NumberConstructor::NumberConstructor(JSGlobalObject* globalObject, Structure* st void NumberConstructor::finishCreation(ExecState* exec, NumberPrototype* numberPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, numberPrototype->s_info.className)); + Base::finishCreation(exec->globalData(), numberPrototype->s_info.className); ASSERT(inherits(&s_info)); // Number.Prototype @@ -73,42 +73,42 @@ void NumberConstructor::finishCreation(ExecState* exec, NumberPrototype* numberP putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool NumberConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool NumberConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticValueSlot<NumberConstructor, InternalFunction>(exec, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(cell), propertyName, slot); } -bool NumberConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool NumberConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor<NumberConstructor, InternalFunction>(exec, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(object), propertyName, descriptor); } -void NumberConstructor::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void NumberConstructor::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { lookupPut<NumberConstructor, InternalFunction>(exec, propertyName, value, ExecState::numberConstructorTable(exec), jsCast<NumberConstructor*>(cell), slot); } -static JSValue numberConstructorNaNValue(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorNaNValue(ExecState*, JSValue, PropertyName) { return jsNaN(); } -static JSValue numberConstructorNegInfinity(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorNegInfinity(ExecState*, JSValue, PropertyName) { return jsNumber(-std::numeric_limits<double>::infinity()); } -static JSValue numberConstructorPosInfinity(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorPosInfinity(ExecState*, JSValue, PropertyName) { return jsNumber(std::numeric_limits<double>::infinity()); } -static JSValue numberConstructorMaxValue(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorMaxValue(ExecState*, JSValue, PropertyName) { return jsNumber(1.7976931348623157E+308); } -static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&) +static JSValue numberConstructorMinValue(ExecState*, JSValue, PropertyName) { return jsNumber(5E-324); } diff --git a/Source/JavaScriptCore/runtime/NumberConstructor.h b/Source/JavaScriptCore/runtime/NumberConstructor.h index 4ee5b0716..75f55f88e 100644 --- a/Source/JavaScriptCore/runtime/NumberConstructor.h +++ b/Source/JavaScriptCore/runtime/NumberConstructor.h @@ -38,10 +38,10 @@ namespace JSC { return constructor; } - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); JSValue getValueProperty(ExecState*, int token) const; static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.cpp b/Source/JavaScriptCore/runtime/NumberPrototype.cpp index 060a80107..1df7b6951 100644 --- a/Source/JavaScriptCore/runtime/NumberPrototype.cpp +++ b/Source/JavaScriptCore/runtime/NumberPrototype.cpp @@ -84,12 +84,12 @@ void NumberPrototype::finishCreation(ExecState* exec, JSGlobalObject*) ASSERT(inherits(&s_info)); } -bool NumberPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool NumberPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<NumberObject>(exec, ExecState::numberPrototypeTable(exec), jsCast<NumberPrototype*>(cell), propertyName, slot); } -bool NumberPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool NumberPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<NumberObject>(exec, ExecState::numberPrototypeTable(exec), jsCast<NumberPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/NumberPrototype.h b/Source/JavaScriptCore/runtime/NumberPrototype.h index d63cc3a6f..d7caecf3f 100644 --- a/Source/JavaScriptCore/runtime/NumberPrototype.h +++ b/Source/JavaScriptCore/runtime/NumberPrototype.h @@ -49,8 +49,8 @@ namespace JSC { private: NumberPrototype(ExecState*, Structure*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp index b7dd71655..5a6fcddf0 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -84,19 +84,19 @@ ObjectConstructor::ObjectConstructor(JSGlobalObject* globalObject, Structure* st void ObjectConstructor::finishCreation(ExecState* exec, ObjectPrototype* objectPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, "Object")); + Base::finishCreation(exec->globalData(), Identifier(exec, "Object").ustring()); // ECMA 15.2.3.1 putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly); // no. of arguments for constructor putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool ObjectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ObjectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<JSObject>(exec, ExecState::objectConstructorTable(exec), jsCast<ObjectConstructor*>(cell), propertyName, slot); } -bool ObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSObject>(exec, ExecState::objectConstructorTable(exec), jsCast<ObjectConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.h b/Source/JavaScriptCore/runtime/ObjectConstructor.h index 87c6414c4..c89134599 100644 --- a/Source/JavaScriptCore/runtime/ObjectConstructor.h +++ b/Source/JavaScriptCore/runtime/ObjectConstructor.h @@ -38,8 +38,8 @@ namespace JSC { return constructor; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp index e980ac590..6faa16848 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp @@ -77,28 +77,22 @@ void ObjectPrototype::finishCreation(JSGlobalData& globalData, JSGlobalObject*) ASSERT(inherits(&s_info)); } -void ObjectPrototype::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void ObjectPrototype::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { ObjectPrototype* thisObject = jsCast<ObjectPrototype*>(cell); Base::put(cell, exec, propertyName, value, slot); - if (thisObject->m_hasNoPropertiesWithUInt32Names) { - bool isUInt32; - propertyName.toUInt32(isUInt32); - thisObject->m_hasNoPropertiesWithUInt32Names = !isUInt32; - } + if (thisObject->m_hasNoPropertiesWithUInt32Names && propertyName.asIndex() != PropertyName::NotAnIndex) + thisObject->m_hasNoPropertiesWithUInt32Names = false; } -bool ObjectPrototype::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool ObjectPrototype::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { ObjectPrototype* thisObject = jsCast<ObjectPrototype*>(object); bool result = Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow); - if (thisObject->m_hasNoPropertiesWithUInt32Names) { - bool isUInt32; - propertyName.toUInt32(isUInt32); - thisObject->m_hasNoPropertiesWithUInt32Names = !isUInt32; - } + if (thisObject->m_hasNoPropertiesWithUInt32Names && propertyName.asIndex() != PropertyName::NotAnIndex) + thisObject->m_hasNoPropertiesWithUInt32Names = false; return result; } @@ -111,12 +105,12 @@ bool ObjectPrototype::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, u return Base::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot); } -bool ObjectPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool ObjectPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<JSNonFinalObject>(exec, ExecState::objectPrototypeTable(exec), jsCast<ObjectPrototype*>(cell), propertyName, slot); } -bool ObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool ObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<JSNonFinalObject>(exec, ExecState::objectPrototypeTable(exec), jsCast<ObjectPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.h b/Source/JavaScriptCore/runtime/ObjectPrototype.h index b9b8a30d4..d46cb91c3 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.h +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.h @@ -50,12 +50,12 @@ namespace JSC { private: ObjectPrototype(ExecState*, Structure*); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); bool m_hasNoPropertiesWithUInt32Names; }; diff --git a/Source/JavaScriptCore/runtime/PropertyName.h b/Source/JavaScriptCore/runtime/PropertyName.h new file mode 100644 index 000000000..d2258b471 --- /dev/null +++ b/Source/JavaScriptCore/runtime/PropertyName.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PropertyName_h +#define PropertyName_h + +#include "Identifier.h" + +namespace JSC { + +template <typename CharType> +ALWAYS_INLINE uint32_t toUInt32FromCharacters(const CharType* characters, unsigned length) +{ + // An empty string is not a number. + if (!length) + return UINT_MAX; + + // Get the first character, turning it into a digit. + uint32_t value = characters[0] - '0'; + if (value > 9) + return UINT_MAX; + + // Check for leading zeros. If the first characher is 0, then the + // length of the string must be one - e.g. "042" is not equal to "42". + if (!value && length > 1) + return UINT_MAX; + + while (--length) { + // Multiply value by 10, checking for overflow out of 32 bits. + if (value > 0xFFFFFFFFU / 10) + return UINT_MAX; + value *= 10; + + // Get the next character, turning it into a digit. + uint32_t newValue = *(++characters) - '0'; + if (newValue > 9) + return UINT_MAX; + + // Add in the old value, checking for overflow out of 32 bits. + newValue += value; + if (newValue < value) + return UINT_MAX; + value = newValue; + } + + return value; +} + +ALWAYS_INLINE uint32_t toUInt32FromStringImpl(StringImpl* impl) +{ + if (impl->is8Bit()) + return toUInt32FromCharacters(impl->characters8(), impl->length()); + return toUInt32FromCharacters(impl->characters16(), impl->length()); +} + +class PropertyName { +public: + PropertyName(const Identifier& propertyName) + : m_impl(propertyName.impl()) + { + } + + StringImpl* impl() const { return m_impl; } + UString ustring() const { return m_impl; } + + static const uint32_t NotAnIndex = UINT_MAX; + uint32_t asIndex() + { + return toUInt32FromStringImpl(m_impl); + } + +private: + StringImpl* m_impl; +}; + +inline bool operator==(PropertyName a, const Identifier& b) +{ + return a.impl() == b.impl(); +} + +inline bool operator==(const Identifier& a, PropertyName b) +{ + return a.impl() == b.impl(); +} + +inline bool operator==(PropertyName a, PropertyName b) +{ + return a.impl() == b.impl(); +} + +inline bool operator!=(PropertyName a, const Identifier& b) +{ + return a.impl() != b.impl(); +} + +inline bool operator!=(const Identifier& a, PropertyName b) +{ + return a.impl() != b.impl(); +} + +inline bool operator!=(PropertyName a, PropertyName b) +{ + return a.impl() != b.impl(); +} + +} + +#endif diff --git a/Source/JavaScriptCore/runtime/PropertySlot.h b/Source/JavaScriptCore/runtime/PropertySlot.h index cfedf7876..131cf7a92 100644 --- a/Source/JavaScriptCore/runtime/PropertySlot.h +++ b/Source/JavaScriptCore/runtime/PropertySlot.h @@ -21,8 +21,8 @@ #ifndef PropertySlot_h #define PropertySlot_h -#include "Identifier.h" #include "JSValue.h" +#include "PropertyName.h" #include "Register.h" #include <wtf/Assertions.h> #include <wtf/NotFound.h> @@ -61,10 +61,10 @@ namespace JSC { clearValue(); } - typedef JSValue (*GetValueFunc)(ExecState*, JSValue slotBase, const Identifier&); + typedef JSValue (*GetValueFunc)(ExecState*, JSValue slotBase, PropertyName); typedef JSValue (*GetIndexValueFunc)(ExecState*, JSValue slotBase, unsigned); - JSValue getValue(ExecState* exec, const Identifier& propertyName) const + JSValue getValue(ExecState* exec, PropertyName propertyName) const { if (m_getValue == JSC_VALUE_MARKER) return m_value; diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp index fd03db569..879511ac2 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -28,21 +28,21 @@ namespace JSC { -static JSValue regExpConstructorInput(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorMultiline(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorLastMatch(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorLastParen(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorLeftContext(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorRightContext(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar1(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar2(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar3(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar4(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar5(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar6(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar7(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar8(ExecState*, JSValue, const Identifier&); -static JSValue regExpConstructorDollar9(ExecState*, JSValue, const Identifier&); +static JSValue regExpConstructorInput(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorMultiline(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorLastMatch(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorLastParen(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorLeftContext(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorRightContext(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar1(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar2(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar3(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar4(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar5(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar6(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar7(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar8(ExecState*, JSValue, PropertyName); +static JSValue regExpConstructorDollar9(ExecState*, JSValue, PropertyName); static void setRegExpConstructorInput(ExecState*, JSObject*, JSValue); static void setRegExpConstructorMultiline(ExecState*, JSObject*, JSValue); @@ -92,7 +92,7 @@ RegExpConstructor::RegExpConstructor(JSGlobalObject* globalObject, Structure* st void RegExpConstructor::finishCreation(ExecState* exec, RegExpPrototype* regExpPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, "RegExp")); + Base::finishCreation(exec->globalData(), Identifier(exec, "RegExp").ustring()); ASSERT(inherits(&s_info)); // ECMA 15.10.5.1 RegExp.prototype @@ -154,92 +154,92 @@ JSValue RegExpConstructor::getRightContext(ExecState* exec) return m_cachedResult.lastResult(exec, this)->rightContext(exec); } -bool RegExpConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool RegExpConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { return getStaticValueSlot<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(cell), propertyName, slot); } -bool RegExpConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool RegExpConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(object), propertyName, descriptor); } -JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 1); } -JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 2); } -JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 3); } -JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 4); } -JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 5); } -JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 6); } -JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 7); } -JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 8); } -JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 9); } -JSValue regExpConstructorInput(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpConstructorInput(ExecState*, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->input(); } -JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpConstructor(slotBase)->multiline()); } -JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getBackref(exec, 0); } -JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getLastParen(exec); } -JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getLeftContext(exec); } -JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, PropertyName) { return asRegExpConstructor(slotBase)->getRightContext(exec); } -void RegExpConstructor::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void RegExpConstructor::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { lookupPut<RegExpConstructor, InternalFunction>(exec, propertyName, value, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(cell), slot); } diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.h b/Source/JavaScriptCore/runtime/RegExpConstructor.h index 0093f9484..d714f2167 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.h +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.h @@ -48,10 +48,10 @@ namespace JSC { return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info); } - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/RegExpMatchesArray.h b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h index 595457bca..f26411f5f 100644 --- a/Source/JavaScriptCore/runtime/RegExpMatchesArray.h +++ b/Source/JavaScriptCore/runtime/RegExpMatchesArray.h @@ -81,7 +81,7 @@ namespace JSC { reifyMatchProperty(exec); } - static bool getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) + static bool getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell); thisObject->reifyAllPropertiesIfNecessary(exec); @@ -98,14 +98,14 @@ namespace JSC { return JSArray::getOwnPropertySlotByIndex(thisObject, exec, propertyName, slot); } - static bool getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) + static bool getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object); thisObject->reifyAllPropertiesIfNecessary(exec); return JSArray::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); } - static void put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue v, PutPropertySlot& slot) + static void put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue v, PutPropertySlot& slot) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell); thisObject->reifyAllPropertiesIfNecessary(exec); @@ -119,7 +119,7 @@ namespace JSC { JSArray::putByIndex(thisObject, exec, propertyName, v, shouldThrow); } - static bool deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) + static bool deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell); thisObject->reifyAllPropertiesIfNecessary(exec); @@ -140,7 +140,7 @@ namespace JSC { JSArray::getOwnPropertyNames(thisObject, exec, arr, mode); } - static bool defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) + static bool defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(object); thisObject->reifyAllPropertiesIfNecessary(exec); diff --git a/Source/JavaScriptCore/runtime/RegExpObject.cpp b/Source/JavaScriptCore/runtime/RegExpObject.cpp index da4ea0446..8aeeb9edc 100644 --- a/Source/JavaScriptCore/runtime/RegExpObject.cpp +++ b/Source/JavaScriptCore/runtime/RegExpObject.cpp @@ -37,10 +37,10 @@ namespace JSC { -static JSValue regExpObjectGlobal(ExecState*, JSValue, const Identifier&); -static JSValue regExpObjectIgnoreCase(ExecState*, JSValue, const Identifier&); -static JSValue regExpObjectMultiline(ExecState*, JSValue, const Identifier&); -static JSValue regExpObjectSource(ExecState*, JSValue, const Identifier&); +static JSValue regExpObjectGlobal(ExecState*, JSValue, PropertyName); +static JSValue regExpObjectIgnoreCase(ExecState*, JSValue, PropertyName); +static JSValue regExpObjectMultiline(ExecState*, JSValue, PropertyName); +static JSValue regExpObjectSource(ExecState*, JSValue, PropertyName); } // namespace JSC @@ -88,7 +88,7 @@ void RegExpObject::visitChildren(JSCell* cell, SlotVisitor& visitor) visitor.append(&thisObject->m_lastIndex); } -bool RegExpObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool RegExpObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { if (propertyName == exec->propertyNames().lastIndex) { RegExpObject* regExp = asRegExpObject(cell); @@ -98,7 +98,7 @@ bool RegExpObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Ident return getStaticValueSlot<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), jsCast<RegExpObject*>(cell), propertyName, slot); } -bool RegExpObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool RegExpObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().lastIndex) { RegExpObject* regExp = asRegExpObject(object); @@ -108,7 +108,7 @@ bool RegExpObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, c return getStaticValueDescriptor<RegExpObject, JSObject>(exec, ExecState::regExpTable(exec), jsCast<RegExpObject*>(object), propertyName, descriptor); } -bool RegExpObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool RegExpObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { if (propertyName == exec->propertyNames().lastIndex) return false; @@ -136,7 +136,7 @@ static bool reject(ExecState* exec, bool throwException, const char* message) return false; } -bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) +bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { if (propertyName == exec->propertyNames().lastIndex) { RegExpObject* regExp = asRegExpObject(object); @@ -163,22 +163,22 @@ bool RegExpObject::defineOwnProperty(JSObject* object, ExecState* exec, const Id return Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow); } -JSValue regExpObjectGlobal(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpObjectGlobal(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpObject(slotBase)->regExp()->global()); } -JSValue regExpObjectIgnoreCase(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpObjectIgnoreCase(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpObject(slotBase)->regExp()->ignoreCase()); } -JSValue regExpObjectMultiline(ExecState*, JSValue slotBase, const Identifier&) +JSValue regExpObjectMultiline(ExecState*, JSValue slotBase, PropertyName) { return jsBoolean(asRegExpObject(slotBase)->regExp()->multiline()); } -JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, PropertyName) { UString pattern = asRegExpObject(slotBase)->regExp()->pattern(); unsigned length = pattern.length(); @@ -268,7 +268,7 @@ JSValue regExpObjectSource(ExecState* exec, JSValue slotBase, const Identifier&) return jsString(exec, result.toUString()); } -void RegExpObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void RegExpObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { if (propertyName == exec->propertyNames().lastIndex) { asRegExpObject(cell)->setLastIndex(exec, value, slot.isStrictMode()); diff --git a/Source/JavaScriptCore/runtime/RegExpObject.h b/Source/JavaScriptCore/runtime/RegExpObject.h index a7dd54705..d1df2b202 100644 --- a/Source/JavaScriptCore/runtime/RegExpObject.h +++ b/Source/JavaScriptCore/runtime/RegExpObject.h @@ -70,9 +70,9 @@ namespace JSC { bool test(ExecState* exec, JSString* string) { return match(exec, string); } JSValue exec(ExecState*, JSString*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); static JS_EXPORTDATA const ClassInfo s_info; @@ -89,10 +89,10 @@ namespace JSC { static void visitChildren(JSCell*, SlotVisitor&); - JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName); JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); JS_EXPORT_PRIVATE static void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); private: MatchResult match(ExecState*, JSString*); diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp index fba4de2b4..24c7c8027 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -67,12 +67,12 @@ RegExpPrototype::RegExpPrototype(JSGlobalObject* globalObject, Structure* struct { } -bool RegExpPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool RegExpPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<RegExpObject>(exec, ExecState::regExpPrototypeTable(exec), jsCast<RegExpPrototype*>(cell), propertyName, slot); } -bool RegExpPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool RegExpPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<RegExpObject>(exec, ExecState::regExpPrototypeTable(exec), jsCast<RegExpPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.h b/Source/JavaScriptCore/runtime/RegExpPrototype.h index 6702592fd..78c6ae1d4 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.h +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.h @@ -49,8 +49,8 @@ namespace JSC { static const unsigned StructureFlags = OverridesGetOwnPropertySlot | RegExpObject::StructureFlags; private: - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp index fbd9d5fbd..8b47a5d70 100644 --- a/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp +++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.cpp @@ -37,7 +37,7 @@ StrictEvalActivation::StrictEvalActivation(ExecState* exec) { } -bool StrictEvalActivation::deleteProperty(JSCell*, ExecState*, const Identifier&) +bool StrictEvalActivation::deleteProperty(JSCell*, ExecState*, PropertyName) { return false; } diff --git a/Source/JavaScriptCore/runtime/StrictEvalActivation.h b/Source/JavaScriptCore/runtime/StrictEvalActivation.h index a7b6d3e96..d73eedf5a 100644 --- a/Source/JavaScriptCore/runtime/StrictEvalActivation.h +++ b/Source/JavaScriptCore/runtime/StrictEvalActivation.h @@ -41,7 +41,7 @@ public: return activation; } - static bool deleteProperty(JSCell*, ExecState*, const Identifier&); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static JSObject* toThisObject(JSCell*, ExecState*); static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) diff --git a/Source/JavaScriptCore/runtime/StringConstructor.cpp b/Source/JavaScriptCore/runtime/StringConstructor.cpp index e03a87f03..460343761 100644 --- a/Source/JavaScriptCore/runtime/StringConstructor.cpp +++ b/Source/JavaScriptCore/runtime/StringConstructor.cpp @@ -55,17 +55,17 @@ StringConstructor::StringConstructor(JSGlobalObject* globalObject, Structure* st void StringConstructor::finishCreation(ExecState* exec, StringPrototype* stringPrototype) { - Base::finishCreation(exec->globalData(), Identifier(exec, stringPrototype->classInfo()->className)); + Base::finishCreation(exec->globalData(), stringPrototype->classInfo()->className); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete); putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool StringConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool StringConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<InternalFunction>(exec, ExecState::stringConstructorTable(exec), jsCast<StringConstructor*>(cell), propertyName, slot); } -bool StringConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool StringConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::stringConstructorTable(exec), jsCast<StringConstructor*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/StringConstructor.h b/Source/JavaScriptCore/runtime/StringConstructor.h index 6f553cdbb..11f70d499 100644 --- a/Source/JavaScriptCore/runtime/StringConstructor.h +++ b/Source/JavaScriptCore/runtime/StringConstructor.h @@ -54,8 +54,8 @@ namespace JSC { static ConstructType getConstructData(JSCell*, ConstructData&); static CallType getCallData(JSCell*, CallData&); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/StringObject.cpp b/Source/JavaScriptCore/runtime/StringObject.cpp index d7e1c8a17..1dac06b46 100644 --- a/Source/JavaScriptCore/runtime/StringObject.cpp +++ b/Source/JavaScriptCore/runtime/StringObject.cpp @@ -43,7 +43,7 @@ void StringObject::finishCreation(JSGlobalData& globalData, JSString* string) setInternalValue(globalData, string); } -bool StringObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool StringObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { StringObject* thisObject = jsCast<StringObject*>(cell); if (thisObject->internalValue()->getStringPropertySlot(exec, propertyName, slot)) @@ -59,7 +59,7 @@ bool StringObject::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsi return JSObject::getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot); } -bool StringObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool StringObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { StringObject* thisObject = jsCast<StringObject*>(object); if (thisObject->internalValue()->getStringPropertyDescriptor(exec, propertyName, descriptor)) @@ -67,7 +67,7 @@ bool StringObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, c return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); } -void StringObject::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void StringObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { if (propertyName == exec->propertyNames().length) { if (slot.isStrictMode()) @@ -77,7 +77,7 @@ void StringObject::put(JSCell* cell, ExecState* exec, const Identifier& property JSObject::put(cell, exec, propertyName, value, slot); } -bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) +bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool throwException) { StringObject* thisObject = jsCast<StringObject*>(object); @@ -119,15 +119,16 @@ bool StringObject::defineOwnProperty(JSObject* object, ExecState* exec, const Id return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); } -bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { StringObject* thisObject = jsCast<StringObject*>(cell); if (propertyName == exec->propertyNames().length) return false; - bool isStrictUInt32; - unsigned i = propertyName.toUInt32(isStrictUInt32); - if (isStrictUInt32 && thisObject->internalValue()->canGetIndex(i)) + unsigned i = propertyName.asIndex(); + if (thisObject->internalValue()->canGetIndex(i)) { + ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! return false; + } return JSObject::deleteProperty(thisObject, exec, propertyName); } diff --git a/Source/JavaScriptCore/runtime/StringObject.h b/Source/JavaScriptCore/runtime/StringObject.h index bad5595c3..7089e8983 100644 --- a/Source/JavaScriptCore/runtime/StringObject.h +++ b/Source/JavaScriptCore/runtime/StringObject.h @@ -45,15 +45,15 @@ namespace JSC { } static StringObject* create(ExecState*, JSGlobalObject*, JSString*); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); - static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); + static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow); static const JS_EXPORTDATA ClassInfo s_info; diff --git a/Source/JavaScriptCore/runtime/StringPrototype.cpp b/Source/JavaScriptCore/runtime/StringPrototype.cpp index 81129f2a2..001e5e8b0 100644 --- a/Source/JavaScriptCore/runtime/StringPrototype.cpp +++ b/Source/JavaScriptCore/runtime/StringPrototype.cpp @@ -147,12 +147,12 @@ void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject*, JSString* putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); } -bool StringPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot) +bool StringPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { return getStaticFunctionSlot<StringObject>(exec, ExecState::stringTable(exec), jsCast<StringPrototype*>(cell), propertyName, slot); } -bool StringPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool StringPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor<StringObject>(exec, ExecState::stringTable(exec), jsCast<StringPrototype*>(object), propertyName, descriptor); } diff --git a/Source/JavaScriptCore/runtime/StringPrototype.h b/Source/JavaScriptCore/runtime/StringPrototype.h index 113f21f2a..b846c7bb3 100644 --- a/Source/JavaScriptCore/runtime/StringPrototype.h +++ b/Source/JavaScriptCore/runtime/StringPrototype.h @@ -42,8 +42,8 @@ namespace JSC { return prototype; } - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) { diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp index ac4b4f1fe..693f3f317 100644 --- a/Source/JavaScriptCore/runtime/Structure.cpp +++ b/Source/JavaScriptCore/runtime/Structure.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "Structure.h" -#include "Identifier.h" #include "JSObject.h" #include "JSPropertyNameIterator.h" #include "Lookup.h" @@ -267,7 +266,14 @@ void Structure::growPropertyStorageCapacity() m_propertyStorageCapacity *= 2; } -void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, const Identifier& propertyName) +size_t Structure::suggestedNewPropertyStorageSize() +{ + if (isUsingInlineStorage()) + return JSObject::baseExternalStorageCapacity; + return m_propertyStorageCapacity * 2; +} + +void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, PropertyName propertyName) { StringImpl* rep = propertyName.impl(); @@ -281,7 +287,7 @@ void Structure::despecifyDictionaryFunction(JSGlobalData& globalData, const Iden entry->specificValue.clear(); } -Structure* Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) +Structure* Structure::addPropertyTransitionToExistingStructure(Structure* structure, PropertyName propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { ASSERT(!structure->isDictionary()); ASSERT(structure->isObject()); @@ -298,7 +304,7 @@ Structure* Structure::addPropertyTransitionToExistingStructure(Structure* struct return 0; } -Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) +Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) { // If we have a specific function, we may have got to this point if there is // already a transition with the correct property name and attributes, but @@ -355,7 +361,7 @@ Structure* Structure::addPropertyTransition(JSGlobalData& globalData, Structure* return transition; } -Structure* Structure::removePropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, size_t& offset) +Structure* Structure::removePropertyTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, size_t& offset) { ASSERT(!structure->isUncacheableDictionary()); @@ -381,7 +387,7 @@ Structure* Structure::changePrototypeTransition(JSGlobalData& globalData, Struct return transition; } -Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Structure* structure, const Identifier& replaceFunction) +Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Structure* structure, PropertyName replaceFunction) { ASSERT(structure->m_specificFunctionThrashCount < maxSpecificFunctionThrashCount); Structure* transition = create(globalData, structure); @@ -404,7 +410,7 @@ Structure* Structure::despecifyFunctionTransition(JSGlobalData& globalData, Stru return transition; } -Structure* Structure::attributeChangeTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, unsigned attributes) +Structure* Structure::attributeChangeTransition(JSGlobalData& globalData, Structure* structure, PropertyName propertyName, unsigned attributes) { if (!structure->isUncacheableDictionary()) { Structure* transition = create(globalData, structure); @@ -562,7 +568,7 @@ Structure* Structure::flattenDictionaryStructure(JSGlobalData& globalData, JSObj return this; } -size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue) +size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, PropertyName propertyName, unsigned attributes, JSCell* specificValue) { ASSERT(!m_enumerationCache); @@ -579,7 +585,7 @@ size_t Structure::addPropertyWithoutTransition(JSGlobalData& globalData, const I return offset; } -size_t Structure::removePropertyWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName) +size_t Structure::removePropertyWithoutTransition(JSGlobalData& globalData, PropertyName propertyName) { ASSERT(isUncacheableDictionary()); ASSERT(!m_enumerationCache); @@ -636,13 +642,15 @@ PassOwnPtr<PropertyTable> Structure::copyPropertyTableForPinning(JSGlobalData& g return adoptPtr(m_propertyTable ? new PropertyTable(globalData, owner, *m_propertyTable) : new PropertyTable(m_offset == noOffset ? 0 : m_offset)); } -size_t Structure::get(JSGlobalData& globalData, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue) +size_t Structure::get(JSGlobalData& globalData, PropertyName propertyName, unsigned& attributes, JSCell*& specificValue) { + ASSERT(structure()->classInfo() == &s_info); + materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return WTF::notFound; - PropertyMapEntry* entry = m_propertyTable->find(propertyName).first; + PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first; if (!entry) return WTF::notFound; @@ -651,13 +659,12 @@ size_t Structure::get(JSGlobalData& globalData, StringImpl* propertyName, unsign return entry->offset; } -bool Structure::despecifyFunction(JSGlobalData& globalData, const Identifier& propertyName) +bool Structure::despecifyFunction(JSGlobalData& globalData, PropertyName propertyName) { materializePropertyMapIfNecessary(globalData); if (!m_propertyTable) return false; - ASSERT(!propertyName.isNull()); PropertyMapEntry* entry = m_propertyTable->find(propertyName.impl()).first; if (!entry) return false; @@ -678,9 +685,8 @@ void Structure::despecifyAllFunctions(JSGlobalData& globalData) iter->specificValue.clear(); } -size_t Structure::putSpecificValue(JSGlobalData& globalData, const Identifier& propertyName, unsigned attributes, JSCell* specificValue) +size_t Structure::putSpecificValue(JSGlobalData& globalData, PropertyName propertyName, unsigned attributes, JSCell* specificValue) { - ASSERT(!propertyName.isNull()); ASSERT(get(globalData, propertyName) == notFound); checkConsistency(); @@ -705,10 +711,8 @@ size_t Structure::putSpecificValue(JSGlobalData& globalData, const Identifier& p return newOffset; } -size_t Structure::remove(const Identifier& propertyName) +size_t Structure::remove(PropertyName propertyName) { - ASSERT(!propertyName.isNull()); - checkConsistency(); StringImpl* rep = propertyName.impl(); diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index ee580e245..230f59d65 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -27,11 +27,11 @@ #define Structure_h #include "ClassInfo.h" -#include "Identifier.h" #include "JSCell.h" #include "JSType.h" #include "JSValue.h" #include "PropertyMapHashTable.h" +#include "PropertyName.h" #include "PropertyNameArray.h" #include "Protect.h" #include "StructureTransitionTable.h" @@ -86,12 +86,12 @@ namespace JSC { public: static void dumpStatistics(); - JS_EXPORT_PRIVATE static Structure* addPropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); - JS_EXPORT_PRIVATE static Structure* addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); - static Structure* removePropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, size_t& offset); + JS_EXPORT_PRIVATE static Structure* addPropertyTransition(JSGlobalData&, Structure*, PropertyName, unsigned attributes, JSCell* specificValue, size_t& offset); + JS_EXPORT_PRIVATE static Structure* addPropertyTransitionToExistingStructure(Structure*, PropertyName, unsigned attributes, JSCell* specificValue, size_t& offset); + static Structure* removePropertyTransition(JSGlobalData&, Structure*, PropertyName, size_t& offset); JS_EXPORT_PRIVATE static Structure* changePrototypeTransition(JSGlobalData&, Structure*, JSValue prototype); - JS_EXPORT_PRIVATE static Structure* despecifyFunctionTransition(JSGlobalData&, Structure*, const Identifier&); - static Structure* attributeChangeTransition(JSGlobalData&, Structure*, const Identifier& propertyName, unsigned attributes); + JS_EXPORT_PRIVATE static Structure* despecifyFunctionTransition(JSGlobalData&, Structure*, PropertyName); + static Structure* attributeChangeTransition(JSGlobalData&, Structure*, PropertyName, unsigned attributes); static Structure* toCacheableDictionaryTransition(JSGlobalData&, Structure*); static Structure* toUncacheableDictionaryTransition(JSGlobalData&, Structure*); static Structure* sealTransition(JSGlobalData&, Structure*); @@ -102,14 +102,16 @@ namespace JSC { bool isFrozen(JSGlobalData&); bool isExtensible() const { return !m_preventExtensions; } bool didTransition() const { return m_didTransition; } + bool shouldGrowPropertyStorage() { return propertyStorageCapacity() == propertyStorageSize(); } + JS_EXPORT_PRIVATE size_t suggestedNewPropertyStorageSize(); Structure* flattenDictionaryStructure(JSGlobalData&, JSObject*); static void destroy(JSCell*); // These should be used with caution. - JS_EXPORT_PRIVATE size_t addPropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue); - size_t removePropertyWithoutTransition(JSGlobalData&, const Identifier& propertyName); + JS_EXPORT_PRIVATE size_t addPropertyWithoutTransition(JSGlobalData&, PropertyName, unsigned attributes, JSCell* specificValue); + size_t removePropertyWithoutTransition(JSGlobalData&, PropertyName); void setPrototypeWithoutTransition(JSGlobalData& globalData, JSValue prototype) { m_prototype.set(globalData, this, prototype); } bool isDictionary() const { return m_dictionaryKind != NoneDictionaryKind; } @@ -136,15 +138,9 @@ namespace JSC { unsigned propertyStorageSize() const { ASSERT(structure()->classInfo() == &s_info); return (m_propertyTable ? m_propertyTable->propertyStorageSize() : static_cast<unsigned>(m_offset + 1)); } bool isUsingInlineStorage() const; - size_t get(JSGlobalData&, const Identifier& propertyName); + size_t get(JSGlobalData&, PropertyName); size_t get(JSGlobalData&, const UString& name); - JS_EXPORT_PRIVATE size_t get(JSGlobalData&, StringImpl* propertyName, unsigned& attributes, JSCell*& specificValue); - size_t get(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes, JSCell*& specificValue) - { - ASSERT(!propertyName.isNull()); - ASSERT(structure()->classInfo() == &s_info); - return get(globalData, propertyName.impl(), attributes, specificValue); - } + JS_EXPORT_PRIVATE size_t get(JSGlobalData&, PropertyName, unsigned& attributes, JSCell*& specificValue); bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } bool hasReadOnlyOrGetterSetterPropertiesExcludingProto() const { return m_hasReadOnlyOrGetterSetterPropertiesExcludingProto; } @@ -163,7 +159,7 @@ namespace JSC { bool isEmpty() const { return m_propertyTable ? m_propertyTable->isEmpty() : m_offset == noOffset; } - JS_EXPORT_PRIVATE void despecifyDictionaryFunction(JSGlobalData&, const Identifier& propertyName); + JS_EXPORT_PRIVATE void despecifyDictionaryFunction(JSGlobalData&, PropertyName); void disableSpecificFunctionTracking() { m_specificFunctionThrashCount = maxSpecificFunctionThrashCount; } void setEnumerationCache(JSGlobalData&, JSPropertyNameIterator* enumerationCache); // Defined in JSPropertyNameIterator.h. @@ -216,7 +212,7 @@ namespace JSC { private: friend class LLIntOffsetsExtractor; - + JS_EXPORT_PRIVATE Structure(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*); Structure(JSGlobalData&); Structure(JSGlobalData&, const Structure*); @@ -236,13 +232,13 @@ namespace JSC { } DictionaryKind; static Structure* toDictionaryTransition(JSGlobalData&, Structure*, DictionaryKind); - size_t putSpecificValue(JSGlobalData&, const Identifier& propertyName, unsigned attributes, JSCell* specificValue); - size_t remove(const Identifier& propertyName); + size_t putSpecificValue(JSGlobalData&, PropertyName, unsigned attributes, JSCell* specificValue); + size_t remove(PropertyName); void createPropertyMap(unsigned keyCount = 0); void checkConsistency(); - bool despecifyFunction(JSGlobalData&, const Identifier&); + bool despecifyFunction(JSGlobalData&, PropertyName); void despecifyAllFunctions(JSGlobalData&); PassOwnPtr<PropertyTable> copyPropertyTable(JSGlobalData&, Structure* owner); @@ -314,7 +310,7 @@ namespace JSC { unsigned m_staticFunctionReified; }; - inline size_t Structure::get(JSGlobalData& globalData, const Identifier& propertyName) + inline size_t Structure::get(JSGlobalData& globalData, PropertyName propertyName) { ASSERT(structure()->classInfo() == &s_info); materializePropertyMapIfNecessary(globalData); |