Commit 07e5bced authored by ap@webkit.org's avatar ap@webkit.org

Reviewed by Geoff Garen.

        Make Identifier construction use an explicitly passed IdentifierTable.

        No change on SunSpider total.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 030c82a0
......@@ -146,7 +146,7 @@ bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, const Identifie
template <class Base>
bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
{
return getOwnPropertySlot(exec, Identifier::from(propertyName), slot);
return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
}
template <class Base>
......@@ -193,7 +193,7 @@ void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName
template <class Base>
void JSCallbackObject<Base>::put(ExecState* exec, unsigned propertyName, JSValue* value)
{
return put(exec, Identifier::from(propertyName), value);
return put(exec, Identifier::from(exec, propertyName), value);
}
template <class Base>
......@@ -233,7 +233,7 @@ bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, const Identifier& p
template <class Base>
bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, unsigned propertyName)
{
return deleteProperty(exec, Identifier::from(propertyName));
return deleteProperty(exec, Identifier::from(exec, propertyName));
}
template <class Base>
......@@ -344,7 +344,7 @@ void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray
UString::Rep* name = it->first.get();
StaticValueEntry* entry = it->second;
if (entry->getProperty && !(entry->attributes & kJSPropertyAttributeDontEnum))
propertyNames.add(Identifier(name));
propertyNames.add(Identifier(exec, name));
}
}
......@@ -355,7 +355,7 @@ void JSCallbackObject<Base>::getPropertyNames(ExecState* exec, PropertyNameArray
UString::Rep* name = it->first.get();
StaticFunctionEntry* entry = it->second;
if (!(entry->attributes & kJSPropertyAttributeDontEnum))
propertyNames.add(Identifier(name));
propertyNames.add(Identifier(exec, name));
}
}
}
......
......@@ -87,7 +87,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name,
{
JSLock lock;
ExecState* exec = toJS(ctx);
Identifier nameID = name ? Identifier(toJS(name)) : Identifier("anonymous");
Identifier nameID = name ? Identifier(exec, toJS(name)) : Identifier(exec, "anonymous");
return toRef(new JSCallbackFunction(exec, callAsFunction, nameID));
}
......@@ -114,7 +114,7 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa
UString::Rep* bodyRep = toJS(body);
UString::Rep* sourceURLRep = sourceURL ? toJS(sourceURL) : &UString::Rep::null;
Identifier nameID = name ? Identifier(toJS(name)) : Identifier("anonymous");
Identifier nameID = name ? Identifier(exec, toJS(name)) : Identifier(exec, "anonymous");
ArgList args;
for (unsigned i = 0; i < parameterCount; i++)
......@@ -152,7 +152,7 @@ bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope
JSObject* jsObject = toJS(object);
UString::Rep* nameRep = toJS(propertyName);
return jsObject->hasProperty(exec, Identifier(nameRep));
return jsObject->hasProperty(exec, Identifier(exec, nameRep));
}
JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
......@@ -162,7 +162,7 @@ JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef
JSObject* jsObject = toJS(object);
UString::Rep* nameRep = toJS(propertyName);
JSValue* jsValue = jsObject->get(exec, Identifier(nameRep));
JSValue* jsValue = jsObject->get(exec, Identifier(exec, nameRep));
if (exec->hadException()) {
if (exception)
*exception = toRef(exec->exception());
......@@ -176,7 +176,7 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope
JSLock lock;
ExecState* exec = toJS(ctx);
JSObject* jsObject = toJS(object);
Identifier name(toJS(propertyName));
Identifier name(exec, toJS(propertyName));
JSValue* jsValue = toJS(value);
if (attributes && !jsObject->hasProperty(exec, name))
......@@ -229,7 +229,7 @@ bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef pr
JSObject* jsObject = toJS(object);
UString::Rep* nameRep = toJS(propertyName);
bool result = jsObject->deleteProperty(exec, Identifier(nameRep));
bool result = jsObject->deleteProperty(exec, Identifier(exec, nameRep));
if (exec->hadException()) {
if (exception)
*exception = toRef(exec->exception());
......@@ -324,7 +324,7 @@ JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size
struct OpaqueJSPropertyNameArray
{
OpaqueJSPropertyNameArray() : refCount(0)
OpaqueJSPropertyNameArray(JSGlobalData* globalData) : refCount(0), array(globalData)
{
}
......@@ -338,7 +338,7 @@ JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef o
JSObject* jsObject = toJS(object);
ExecState* exec = toJS(ctx);
JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray();
JSPropertyNameArrayRef propertyNames = new OpaqueJSPropertyNameArray(&exec->globalData());
jsObject->getPropertyNames(exec, propertyNames->array);
return JSPropertyNameArrayRetain(propertyNames);
......
2008-06-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff Garen.
Make Identifier construction use an explicitly passed IdentifierTable.
No change on SunSpider total.
* API/JSCallbackObjectFunctions.h:
(KJS::::getOwnPropertySlot):
(KJS::::put):
(KJS::::deleteProperty):
(KJS::::getPropertyNames):
* API/JSObjectRef.cpp:
(JSObjectMakeFunctionWithCallback):
(JSObjectMakeFunction):
(JSObjectHasProperty):
(JSObjectGetProperty):
(JSObjectSetProperty):
(JSObjectDeleteProperty):
(OpaqueJSPropertyNameArray::OpaqueJSPropertyNameArray):
(JSObjectCopyPropertyNames):
* JavaScriptCore.exp:
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator):
(KJS::CodeGenerator::registerForLocal):
(KJS::CodeGenerator::isLocal):
(KJS::CodeGenerator::addConstant):
(KJS::CodeGenerator::findScopedProperty):
* VM/CodeGenerator.h:
(KJS::CodeGenerator::globalData):
(KJS::CodeGenerator::propertyNames):
* VM/JSPropertyNameIterator.cpp:
(KJS::JSPropertyNameIterator::create):
* VM/Machine.cpp:
(KJS::Machine::throwException):
(KJS::Machine::privateExecute):
* kjs/ArrayPrototype.cpp:
(KJS::ArrayConstructor::ArrayConstructor):
* kjs/BooleanObject.cpp:
(KJS::BooleanConstructor::BooleanConstructor):
* kjs/FunctionPrototype.cpp:
(KJS::FunctionConstructor::FunctionConstructor):
(KJS::FunctionConstructor::construct):
* kjs/JSArray.cpp:
(KJS::JSArray::inlineGetOwnPropertySlot):
(KJS::JSArray::put):
(KJS::JSArray::deleteProperty):
(KJS::JSArray::getPropertyNames):
* kjs/JSFunction.cpp:
(KJS::Arguments::Arguments):
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
* kjs/JSGlobalObject.cpp:
(KJS::JSGlobalObject::reset):
* kjs/JSObject.cpp:
(KJS::JSObject::getOwnPropertySlot):
(KJS::JSObject::put):
(KJS::JSObject::putWithAttributes):
(KJS::JSObject::deleteProperty):
(KJS::JSObject::findPropertyHashEntry):
(KJS::JSObject::getPropertyNames):
(KJS::Error::create):
* kjs/JSVariableObject.cpp:
(KJS::JSVariableObject::getPropertyNames):
* kjs/NumberObject.cpp:
(KJS::NumberConstructor::NumberConstructor):
* kjs/PropertyNameArray.cpp:
(KJS::PropertyNameArray::add):
* kjs/PropertyNameArray.h:
(KJS::PropertyNameArray::PropertyNameArray):
(KJS::PropertyNameArray::addKnownUnique):
* kjs/PropertySlot.h:
(KJS::PropertySlot::getValue):
* kjs/RegExpObject.cpp:
(KJS::RegExpConstructor::RegExpConstructor):
* kjs/ScopeChain.cpp:
(KJS::ScopeChainNode::print):
* kjs/Shell.cpp:
(GlobalObject::GlobalObject):
* kjs/date_object.cpp:
(KJS::DateConstructor::DateConstructor):
* kjs/error_object.cpp:
(KJS::ErrorConstructor::ErrorConstructor):
(KJS::NativeErrorConstructor::NativeErrorConstructor):
* kjs/grammar.y:
* kjs/identifier.cpp:
(KJS::Identifier::add):
(KJS::Identifier::addSlowCase):
* kjs/identifier.h:
(KJS::Identifier::Identifier):
(KJS::Identifier::from):
(KJS::Identifier::equal):
(KJS::Identifier::add):
(KJS::operator==):
(KJS::operator!=):
* kjs/internal.cpp:
(KJS::JSString::getOwnPropertySlot):
* kjs/lexer.cpp:
(KJS::Lexer::Lexer):
(KJS::Lexer::lex):
(KJS::Lexer::makeIdentifier):
* kjs/lexer.h:
* kjs/lookup.cpp:
(KJS::HashTable::createTable):
* kjs/lookup.h:
(KJS::HashTable::initializeIfNeeded):
(KJS::HashTable::entry):
(KJS::getStaticPropertySlot):
(KJS::getStaticFunctionSlot):
(KJS::getStaticValueSlot):
(KJS::lookupPut):
* kjs/object_object.cpp:
(KJS::objectProtoFuncHasOwnProperty):
(KJS::objectProtoFuncDefineGetter):
(KJS::objectProtoFuncDefineSetter):
(KJS::objectProtoFuncLookupGetter):
(KJS::objectProtoFuncLookupSetter):
(KJS::objectProtoFuncPropertyIsEnumerable):
(KJS::ObjectConstructor::ObjectConstructor):
* kjs/string_object.cpp:
(KJS::StringObject::getOwnPropertySlot):
(KJS::StringObject::getPropertyNames):
(KJS::StringConstructor::StringConstructor):
Just pass ExecState or JSGlobalData everywhere. Identifier construction is now always
explicit.
* kjs/nodes.cpp: (KJS::RegExpNode::emitCode): Here, Identifier was created from a non-literal
char*, which was incorrect, as that uses the pointer value as a key.
2008-06-16 Thiago Macieira <tjmaciei@trolltech.com>
Reviewed by Darin.
......
......@@ -76,9 +76,9 @@ _WTFReportFatalError
__Z12jsRegExpFreeP8JSRegExp
__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
__ZN3KJS10Identifier11addSlowCaseEPNS_7UString3RepE
__ZN3KJS10Identifier3addEPKc
__ZN3KJS10Identifier3addEPKti
__ZN3KJS10Identifier11addSlowCaseEPNS_12JSGlobalDataEPNS_7UString3RepE
__ZN3KJS10Identifier11addSlowCaseEPNS_9ExecStateEPNS_7UString3RepE
__ZN3KJS10Identifier3addEPNS_9ExecStateEPKc
__ZN3KJS10Identifier5equalEPKNS_7UString3RepEPKc
__ZN3KJS10throwErrorEPNS_9ExecStateENS_9ErrorTypeE
__ZN3KJS10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
......@@ -97,6 +97,7 @@ __ZN3KJS11PropertyMap11getLocationERKNS_10IdentifierERb
__ZN3KJS11PropertyMap3putERKNS_10IdentifierEPNS_7JSValueEjb
__ZN3KJS11PropertyMapD1Ev
__ZN3KJS12DateInstance4infoE
__ZN3KJS12JSGlobalData14threadInstanceEv
__ZN3KJS12PropertySlot15undefinedGetterEPNS_9ExecStateERKNS_10IdentifierERKS0_
__ZN3KJS12RegisterFile14addGlobalSlotsEm
__ZN3KJS12StringObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
......@@ -283,7 +284,7 @@ __ZNK3KJS8JSObject8toStringEPNS_9ExecStateE
__ZNK3KJS8JSObject9classInfoEv
__ZNK3KJS8JSObject9classNameEv
__ZNK3KJS8JSObject9toBooleanEPNS_9ExecStateE
__ZNK3KJS9HashTable11createTableEv
__ZNK3KJS9HashTable11createTableEPNS_12JSGlobalDataE
__ZNK3WTF8Collator7collateEPKtmS2_m
__ZTVN3KJS12JSNumberCellE
__ZTVN3KJS12StringObjectE
......
......@@ -179,7 +179,7 @@ CodeGenerator::CodeGenerator(ProgramNode* programNode, const Debugger* debugger,
, m_codeType(GlobalCode)
, m_continueDepth(0)
, m_nextVar(-1)
, m_propertyNames(&scopeChain.globalObject()->globalExec()->propertyNames())
, m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
, m_lastOpcodeID(op_end)
{
// Global code can inherit previously defined symbols.
......@@ -238,7 +238,7 @@ CodeGenerator::CodeGenerator(FunctionBodyNode* functionBody, const Debugger* deb
, m_codeType(FunctionCode)
, m_continueDepth(0)
, m_nextVar(-1)
, m_propertyNames(&scopeChain.globalObject()->globalExec()->propertyNames())
, m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
, m_lastOpcodeID(op_end)
{
const Node::FunctionStack& functionStack = functionBody->functionStack();
......@@ -253,7 +253,7 @@ CodeGenerator::CodeGenerator(FunctionBodyNode* functionBody, const Debugger* deb
const Node::VarStack& varStack = functionBody->varStack();
for (size_t i = 0; i < varStack.size(); ++i) {
const Identifier& ident = varStack[i].first;
if (ident == m_propertyNames->arguments)
if (ident == propertyNames().arguments)
continue;
RegisterID* r0;
......@@ -285,7 +285,7 @@ CodeGenerator::CodeGenerator(EvalNode* evalNode, const Debugger* debugger, const
, m_codeType(EvalCode)
, m_continueDepth(0)
, m_nextVar(-1)
, m_propertyNames(&scopeChain.globalObject()->globalExec()->propertyNames())
, m_globalData(&scopeChain.globalObject()->globalExec()->globalData())
, m_lastOpcodeID(op_end)
{
m_codeBlock->numVars = 1; // Allocate space for "this"
......@@ -316,10 +316,10 @@ RegisterID* CodeGenerator::addParameter(const Identifier& ident)
RegisterID* CodeGenerator::registerForLocal(const Identifier& ident)
{
if (m_codeType == FunctionCode && ident == m_propertyNames->arguments)
if (m_codeType == FunctionCode && ident == propertyNames().arguments)
m_codeBlock->needsFullScopeChain = true;
if (ident == m_propertyNames->thisIdentifier)
if (ident == propertyNames().thisIdentifier)
return &m_thisRegister;
if (!shouldOptimizeLocals())
......@@ -345,7 +345,7 @@ RegisterID* CodeGenerator::registerForLocalConstInit(const Identifier& ident)
bool CodeGenerator::isLocal(const Identifier& ident)
{
if (ident == m_propertyNames->thisIdentifier)
if (ident == propertyNames().thisIdentifier)
return true;
return shouldOptimizeLocals() && symbolTable().contains(ident.ustring().rep());
......@@ -480,7 +480,7 @@ unsigned CodeGenerator::addConstant(const Identifier& ident)
UString::Rep* rep = ident.ustring().rep();
pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock->identifiers.size());
if (result.second) // new entry
m_codeBlock->identifiers.append(rep);
m_codeBlock->identifiers.append(Identifier(m_globalData, rep));
return result.first->second;
}
......@@ -590,7 +590,7 @@ RegisterID* CodeGenerator::emitNullaryOp(OpcodeID opcode, RegisterID* dst)
bool CodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth)
{
// Cases where we cannot optimise the lookup
if (property == m_propertyNames->arguments || !canOptimizeNonLocals()) {
if (property == propertyNames().arguments || !canOptimizeNonLocals()) {
stackDepth = 0;
index = missingSymbolMarker();
return false;
......
......@@ -82,7 +82,8 @@ namespace KJS {
~CodeGenerator();
const CommonIdentifiers& propertyNames() const { return *m_propertyNames; }
JSGlobalData* globalData() const { return m_globalData; }
const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; }
void generate();
......@@ -360,7 +361,7 @@ namespace KJS {
IdentifierMap m_identifierMap;
JSValueMap m_jsValueMap;
const CommonIdentifiers* m_propertyNames;
JSGlobalData* m_globalData;
OpcodeID m_lastOpcodeID;
......
......@@ -43,7 +43,7 @@ JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSValue*
return new JSPropertyNameIterator(0, 0, 0);
JSObject* o = v->toObject(exec);
PropertyNameArray propertyNames;
PropertyNameArray propertyNames(exec);
o->getPropertyNames(exec, propertyNames);
size_t numProperties = propertyNames.size();
return new JSPropertyNameIterator(o, propertyNames.releaseIdentifiers(), numProperties);
......
......@@ -609,9 +609,9 @@ NEVER_INLINE Instruction* Machine::throwException(ExecState* exec, JSValue* exce
if (exceptionValue->isObject()) {
JSObject* exception = static_cast<JSObject*>(exceptionValue);
if (!exception->hasProperty(exec, "line") && !exception->hasProperty(exec, "sourceURL")) {
exception->put(exec, "line", jsNumber(codeBlock->lineNumberForVPC(vPC)));
exception->put(exec, "sourceURL", jsOwnedString(codeBlock->ownerNode->sourceURL()));
if (!exception->hasProperty(exec, Identifier(exec, "line")) && !exception->hasProperty(exec, Identifier(exec, "sourceURL"))) {
exception->put(exec, Identifier(exec, "line"), jsNumber(codeBlock->lineNumberForVPC(vPC)));
exception->put(exec, Identifier(exec, "sourceURL"), jsOwnedString(codeBlock->ownerNode->sourceURL()));
}
}
......@@ -1539,7 +1539,7 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
if (propName->getUInt32(i))
r[dst].u.jsValue = jsBoolean(baseObj->hasProperty(exec, i));
else {
Identifier property(propName->toString(exec));
Identifier property(exec, propName->toString(exec));
VM_CHECK_EXCEPTION();
r[dst].u.jsValue = jsBoolean(baseObj->hasProperty(exec, property));
}
......@@ -1764,9 +1764,9 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
Identifier property;
if (subscript->isObject()) {
VM_CHECK_EXCEPTION(); // If toObject threw, we must not call toString, which may execute arbitrary code
property = Identifier(subscript->toString(exec));
property = Identifier(exec, subscript->toString(exec));
} else
property = Identifier(subscript->toString(exec));
property = Identifier(exec, subscript->toString(exec));
VM_CHECK_EXCEPTION(); // This check is needed to prevent us from incorrectly calling a getter after an exception is thrown
result = baseObj->get(exec, property);
......@@ -1805,9 +1805,9 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
Identifier property;
if (subscript->isObject()) {
VM_CHECK_EXCEPTION(); // If toObject threw, we must not call toString, which may execute arbitrary code
property = Identifier(subscript->toString(exec));
property = Identifier(exec, subscript->toString(exec));
} else
property = Identifier(subscript->toString(exec));
property = Identifier(exec, subscript->toString(exec));
VM_CHECK_EXCEPTION(); // This check is needed to prevent us from incorrectly calling a setter after an exception is thrown
baseObj->put(exec, property, r[value].u.jsValue);
......@@ -1838,7 +1838,7 @@ JSValue* Machine::privateExecute(ExecutionFlag flag, ExecState* exec, RegisterFi
result = jsBoolean(baseObj->deleteProperty(exec, i));
else {
VM_CHECK_EXCEPTION(); // If toObject threw, we must not call toString, which may execute arbitrary code
Identifier property(subscript->toString(exec));
Identifier property(exec, subscript->toString(exec));
VM_CHECK_EXCEPTION();
result = jsBoolean(baseObj->deleteProperty(exec, property));
}
......
......@@ -726,7 +726,7 @@ JSValue* arrayProtoFuncLastIndexOf(ExecState* exec, JSObject* thisObj, const Arg
// ------------------------------ ArrayConstructor -------------------------------
ArrayConstructor::ArrayConstructor(ExecState* exec, FunctionPrototype* funcProto, ArrayPrototype* arrayProto)
: InternalFunction(funcProto, arrayProto->classInfo()->className)
: InternalFunction(funcProto, Identifier(exec, arrayProto->classInfo()->className))
{
// ECMA 15.4.3.1 Array.prototype
putDirect(exec->propertyNames().prototype, arrayProto, DontEnum|DontDelete|ReadOnly);
......
......@@ -85,7 +85,7 @@ JSValue* booleanProtoFuncValueOf(ExecState* exec, JSObject* thisObj, const ArgLi
BooleanConstructor::BooleanConstructor(ExecState* exec, FunctionPrototype* functionPrototype, BooleanPrototype* booleanPrototype)
: InternalFunction(functionPrototype, booleanPrototype->classInfo()->className)
: InternalFunction(functionPrototype, Identifier(exec, booleanPrototype->classInfo()->className))
{
putDirect(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
......
......@@ -128,7 +128,7 @@ JSValue* functionProtoFuncCall(ExecState* exec, JSObject* thisObj, const ArgList
// ------------------------------ FunctionConstructor ----------------------------
FunctionConstructor::FunctionConstructor(ExecState* exec, FunctionPrototype* functionPrototype)
: InternalFunction(functionPrototype, functionPrototype->classInfo()->className)
: InternalFunction(functionPrototype, Identifier(exec, functionPrototype->classInfo()->className))
{
putDirect(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
......@@ -194,11 +194,11 @@ JSObject* FunctionConstructor::construct(ExecState* exec, const ArgList& args, c
while (i < len && *c == ' ')
c++, i++;
if (i == len) {
functionBody->parameters().append(Identifier(param));
functionBody->parameters().append(Identifier(exec, param));
params++;
break;
} else if (*c == ',') {
functionBody->parameters().append(Identifier(param));
functionBody->parameters().append(Identifier(exec, param));
params++;
c++, i++;
continue;
......@@ -217,7 +217,7 @@ JSObject* FunctionConstructor::construct(ExecState* exec, const ArgList& args, c
// ECMA 15.3.2 The Function Constructor
JSObject* FunctionConstructor::construct(ExecState* exec, const ArgList& args)
{
return construct(exec, args, "anonymous", UString(), 1);
return construct(exec, args, Identifier(exec, "anonymous"), UString(), 1);
}
// ECMA 15.3.1 The Function Constructor Called as a Function
......
......@@ -157,7 +157,7 @@ ALWAYS_INLINE bool JSArray::inlineGetOwnPropertySlot(ExecState* exec, unsigned i
if (UNLIKELY(i >= m_length)) {
if (i > maxArrayIndex)
return getOwnPropertySlot(exec, Identifier::from(i), slot);
return getOwnPropertySlot(exec, Identifier::from(exec, i), slot);
return false;
}
......@@ -230,7 +230,7 @@ void JSArray::put(ExecState* exec, unsigned i, JSValue* value)
unsigned length = m_length;
if (i >= length) {
if (i > maxArrayIndex) {
put(exec, Identifier::from(i), value);
put(exec, Identifier::from(exec, i), value);
return;
}
length = i + 1;
......@@ -360,7 +360,7 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i)
checkConsistency();
if (i > maxArrayIndex)
return deleteProperty(exec, Identifier::from(i));
return deleteProperty(exec, Identifier::from(exec, i));
return false;
}
......@@ -376,13 +376,13 @@ void JSArray::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames
unsigned usedVectorLength = min(m_length, m_vectorLength);
for (unsigned i = 0; i < usedVectorLength; ++i) {
if (storage->m_vector[i])
propertyNames.add(Identifier::from(i));
propertyNames.add(Identifier::from(exec, i));
}
if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
SparseArrayValueMap::iterator end = map->end();
for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it)
propertyNames.add(Identifier::from(it->first));
propertyNames.add(Identifier::from(exec, it->first));
}
JSObject::getPropertyNames(exec, propertyNames);
......
......@@ -289,7 +289,7 @@ Arguments::Arguments(ExecState* exec, JSFunction* func, const ArgList& args, JSA
int i = 0;
ArgList::const_iterator end = args.end();
for (ArgList::const_iterator it = args.begin(); it != end; ++it, ++i) {
Identifier name = Identifier::from(i);
Identifier name = Identifier::from(exec, i);
if (!indexToNameMap.isMapped(name))
putDirect(name, *it, DontEnum);
}
......
......@@ -75,7 +75,7 @@ JSGlobalData::JSGlobalData()
#endif
, identifierTable(createIdentifierTable())
, propertyNames(new CommonIdentifiers(this))
, lexer(new Lexer)
, lexer(new Lexer(this))
, parser(new Parser)
, head(0)
{
......
......@@ -293,28 +293,28 @@ void JSGlobalObject::reset(JSValue* prototype)
// FIXME: These properties could be handled by a static hash table.
putDirect("Object", d()->objectConstructor, DontEnum);
putDirect("Function", d()->functionConstructor, DontEnum);
putDirect("Array", d()->arrayConstructor, DontEnum);
putDirect("Boolean", d()->booleanConstructor, DontEnum);
putDirect("String", d()->stringConstructor, DontEnum);
putDirect("Number", d()->numberConstructor, DontEnum);
putDirect("Date", d()->dateConstructor, DontEnum);
putDirect("RegExp", d()->regExpConstructor, DontEnum);
putDirect("Error", d()->errorConstructor, DontEnum);
putDirect("EvalError", d()->evalErrorConstructor);
putDirect("RangeError", d()->rangeErrorConstructor);
putDirect("ReferenceError", d()->referenceErrorConstructor);
putDirect("SyntaxError", d()->syntaxErrorConstructor);
putDirect("TypeError", d()->typeErrorConstructor);
putDirect("URIError", d()->URIErrorConstructor);
putDirect(Identifier(exec, "Object"), d()->objectConstructor, DontEnum);
putDirect(Identifier(exec, "Function"), d()->functionConstructor, DontEnum);
putDirect(Identifier(exec, "Array"), d()->arrayConstructor, DontEnum);
putDirect(Identifier(exec, "Boolean"), d()->booleanConstructor, DontEnum);
putDirect(Identifier(exec, "String"), d()->stringConstructor, DontEnum);
putDirect(Identifier(exec, "Number"), d()->numberConstructor, DontEnum);
putDirect(Identifier(exec, "Date"), d()->dateConstructor, DontEnum);
putDirect(Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum);
putDirect(Identifier(exec, "Error"), d()->errorConstructor, DontEnum);
putDirect(Identifier(exec, "EvalError"), d()->evalErrorConstructor);
putDirect(Identifier(exec, "RangeError"), d()->rangeErrorConstructor);
putDirect(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor);
putDirect(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor);
putDirect(Identifier(exec, "TypeError"), d()->typeErrorConstructor);
putDirect(Identifier(exec, "URIError"), d()->URIErrorConstructor);
// Set global values.
GlobalPropertyInfo staticGlobals[] = {
GlobalPropertyInfo("Math", new MathObject(exec, d()->objectPrototype), DontEnum | DontDelete),
GlobalPropertyInfo("NaN", jsNaN(), DontEnum | DontDelete),
GlobalPropertyInfo("Infinity", jsNumber(Inf), DontEnum | DontDelete),
GlobalPropertyInfo("undefined", jsUndefined(), DontEnum | DontDelete)
GlobalPropertyInfo(Identifier(exec, "Math"), new MathObject(exec, d()->objectPrototype), DontEnum | DontDelete),
GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(), DontEnum | DontDelete),
GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(Inf), DontEnum | DontDelete),
GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete)
};
addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
......@@ -323,18 +323,18 @@ void JSGlobalObject::reset(JSValue* prototype)