Reviewed by Geoff Garen.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2008 23:28:38 +0000 (23:28 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2008 23:28:38 +0000 (23:28 +0000)
        Make Identifier construction use an explicitly passed IdentifierTable.

        No change on SunSpider total.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@34607 268f45cc-cd09-0410-ab3c-d52691b4dbfc

76 files changed:
JavaScriptCore/API/JSCallbackObjectFunctions.h
JavaScriptCore/API/JSObjectRef.cpp
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/VM/CodeGenerator.cpp
JavaScriptCore/VM/CodeGenerator.h
JavaScriptCore/VM/JSPropertyNameIterator.cpp
JavaScriptCore/VM/Machine.cpp
JavaScriptCore/kjs/ArrayPrototype.cpp
JavaScriptCore/kjs/BooleanObject.cpp
JavaScriptCore/kjs/FunctionPrototype.cpp
JavaScriptCore/kjs/JSArray.cpp
JavaScriptCore/kjs/JSFunction.cpp
JavaScriptCore/kjs/JSGlobalData.cpp
JavaScriptCore/kjs/JSGlobalObject.cpp
JavaScriptCore/kjs/JSObject.cpp
JavaScriptCore/kjs/JSVariableObject.cpp
JavaScriptCore/kjs/NumberObject.cpp
JavaScriptCore/kjs/PropertyNameArray.cpp
JavaScriptCore/kjs/PropertyNameArray.h
JavaScriptCore/kjs/PropertySlot.h
JavaScriptCore/kjs/RegExpObject.cpp
JavaScriptCore/kjs/ScopeChain.cpp
JavaScriptCore/kjs/Shell.cpp
JavaScriptCore/kjs/date_object.cpp
JavaScriptCore/kjs/error_object.cpp
JavaScriptCore/kjs/grammar.y
JavaScriptCore/kjs/identifier.cpp
JavaScriptCore/kjs/identifier.h
JavaScriptCore/kjs/internal.cpp
JavaScriptCore/kjs/lexer.cpp
JavaScriptCore/kjs/lexer.h
JavaScriptCore/kjs/lookup.cpp
JavaScriptCore/kjs/lookup.h
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/object_object.cpp
JavaScriptCore/kjs/string_object.cpp
JavaScriptGlue/ChangeLog
JavaScriptGlue/JSUtils.cpp
JavaScriptGlue/JSUtils.h
JavaScriptGlue/JSValueWrapper.cpp
JavaScriptGlue/UserObjectImp.cpp
WebCore/ChangeLog
WebCore/bindings/js/JSCustomSQLStatementCallback.cpp
WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp
WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp
WebCore/bindings/js/JSCustomVoidCallback.cpp
WebCore/bindings/js/JSCustomXPathNSResolver.cpp
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSDOMWindowCustom.cpp
WebCore/bindings/js/JSDOMWindowCustom.h
WebCore/bindings/js/JSEventListener.cpp
WebCore/bindings/js/JSEventTargetBase.h
WebCore/bindings/js/JSHTMLCollectionCustom.cpp
WebCore/bindings/js/JSHTMLDocumentCustom.cpp
WebCore/bindings/js/JSHTMLInputElementBase.cpp
WebCore/bindings/js/JSHistoryCustom.cpp
WebCore/bindings/js/JSLocationCustom.cpp
WebCore/bindings/js/JSNavigatorCustom.cpp
WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
WebCore/bindings/js/JSStorageCustom.cpp
WebCore/bindings/js/ScheduledAction.cpp
WebCore/bindings/js/ScriptController.cpp
WebCore/bindings/objc/WebScriptObject.mm
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bridge/NP_jsobject.cpp
WebCore/bridge/c/c_instance.cpp
WebCore/bridge/c/c_utility.cpp
WebCore/bridge/jni/jni_class.cpp
WebCore/bridge/jni/jni_jsobject.mm
WebCore/bridge/runtime_method.cpp
WebCore/platform/text/AtomicString.cpp
WebCore/platform/text/AtomicString.h
WebCore/platform/text/PlatformString.h
WebCore/platform/text/String.cpp

index 38bc23d..d7c048e 100644 (file)
@@ -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));
             }
         }
     }
index f5e1854..427bd58 100644 (file)
@@ -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);
index aa37ce8..55779ef 100644 (file)
@@ -1,3 +1,133 @@
+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.
index 2676b9d..64a8887 100644 (file)
@@ -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
index 6538a81..9bad1cb 100644 (file)
@@ -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;
index efd724e..568e071 100644 (file)
@@ -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;
 
index 5e64626..07757e2 100644 (file)
@@ -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);
index 7797616..617afef 100644 (file)
@@ -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));
         }
index 5e7847b..3f1ad2a 100644 (file)
@@ -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);
index 7a05cfb..2b58f22 100644 (file)
@@ -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);
 
index 6e055f1..955e123 100644 (file)
@@ -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
index 1a15e1c..69547b6 100644 (file)
@@ -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);
index 27ce2df..6db1459 100644 (file)
@@ -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);
     }
index bfa8599..7a32c5d 100644 (file)
@@ -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)
 {
index 08e3d75..f03fbb4 100644 (file)
@@ -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)
 
     d()->evalFunction = new PrototypeReflexiveFunction(exec, d()->functionPrototype, 1, exec->propertyNames().eval, globalFuncEval, this);
     putDirectFunction(d()->evalFunction, DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 2, "parseInt", globalFuncParseInt), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "parseFloat", globalFuncParseFloat), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "isNaN", globalFuncIsNaN), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "isFinite", globalFuncIsFinite), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "escape", globalFuncEscape), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "unescape", globalFuncUnescape), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "decodeURI", globalFuncDecodeURI), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "decodeURIComponent", globalFuncDecodeURIComponent), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "encodeURI", globalFuncEncodeURI), DontEnum);
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "encodeURIComponent", globalFuncEncodeURIComponent), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
 #ifndef NDEBUG
-    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "kjsprint", globalFuncKJSPrint), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum);
 #endif
 
     // Set prototype, and also insert the object prototype at the end of the chain.
index 4980703..ce28a5b 100644 (file)
@@ -84,7 +84,7 @@ UString JSObject::className() const
 
 bool JSObject::getOwnPropertySlot(ExecState *exec, unsigned propertyName, PropertySlot& slot)
 {
-  return getOwnPropertySlot(exec, Identifier::from(propertyName), slot);
+  return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
 }
 
 static void throwSetterError(ExecState *exec)
@@ -171,7 +171,7 @@ void JSObject::put(ExecState* exec, const Identifier &propertyName, JSValue *val
 
 void JSObject::put(ExecState* exec, unsigned propertyName, JSValue* value)
 {
-    put(exec, Identifier::from(propertyName), value);
+    put(exec, Identifier::from(exec, propertyName), value);
 }
 
 void JSObject::putWithAttributes(ExecState*, const Identifier& propertyName, JSValue* value, unsigned attributes)
@@ -181,7 +181,7 @@ void JSObject::putWithAttributes(ExecState*, const Identifier& propertyName, JSV
 
 void JSObject::putWithAttributes(ExecState* exec, unsigned propertyName, JSValue* value, unsigned attributes)
 {
-    putWithAttributes(exec, Identifier::from(propertyName), value, attributes);
+    putWithAttributes(exec, Identifier::from(exec, propertyName), value, attributes);
 }
 
 bool JSObject::hasProperty(ExecState *exec, const Identifier &propertyName) const
@@ -226,7 +226,7 @@ bool JSObject::hasOwnProperty(ExecState* exec, const Identifier& propertyName) c
 
 bool JSObject::deleteProperty(ExecState *exec, unsigned propertyName)
 {
-  return deleteProperty(exec, Identifier::from(propertyName));
+  return deleteProperty(exec, Identifier::from(exec, propertyName));
 }
 
 static ALWAYS_INLINE JSValue *tryGetAndCallProperty(ExecState *exec, const JSObject *object, const Identifier &propertyName) {
@@ -286,7 +286,7 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi
 {
     for (const ClassInfo* info = classInfo(); info; info = info->parentClass) {
         if (const HashTable* propHashTable = info->propHashTable(exec)) {
-            if (const HashEntry* e = propHashTable->entry(propertyName))
+            if (const HashEntry* e = propHashTable->entry(exec, propertyName))
                 return e;
         }
     }
@@ -446,8 +446,7 @@ void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyName
         const HashTable* table = info->propHashTable(exec);
         if (!table)
             continue;
-        if (!table->table)
-            table->createTable();
+        table->initializeIfNeeded(exec);
         ASSERT(table->table);
         int hashSizeMask = table->hashSizeMask;
         const HashEntry* e = table->table;
@@ -563,12 +562,12 @@ JSObject* Error::create(ExecState* exec, ErrorType errtype, const UString& messa
   JSObject *err = static_cast<JSObject *>(cons->construct(exec,args));
 
   if (lineno != -1)
-    err->put(exec, "line", jsNumber(lineno));
+    err->put(exec, Identifier(exec, "line"), jsNumber(lineno));
   if (sourceId != -1)
-    err->put(exec, "sourceId", jsNumber(sourceId));
+    err->put(exec, Identifier(exec, "sourceId"), jsNumber(sourceId));
 
   if(!sourceURL.isNull())
-    err->put(exec, "sourceURL", jsString(sourceURL));
+    err->put(exec, Identifier(exec, "sourceURL"), jsString(sourceURL));
  
   return err;
 }
index 8365db0..a212348 100644 (file)
@@ -47,7 +47,7 @@ void JSVariableObject::getPropertyNames(ExecState* exec, PropertyNameArray& prop
     SymbolTable::const_iterator end = symbolTable().end();
     for (SymbolTable::const_iterator it = symbolTable().begin(); it != end; ++it) {
         if (!(it->second.getAttributes() & DontEnum))
-            propertyNames.add(Identifier(it->first.get()));
+            propertyNames.add(Identifier(exec, it->first.get()));
     }
     
     JSObject::getPropertyNames(exec, propertyNames);
index e3f24dc..954fcef 100644 (file)
@@ -462,7 +462,7 @@ const ClassInfo NumberConstructor::info = { "Function", &InternalFunction::info,
 @end
 */
 NumberConstructor::NumberConstructor(ExecState* exec, FunctionPrototype* funcProto, NumberPrototype* numberProto)
-    : InternalFunction(funcProto, numberProto->classInfo()->className)
+    : InternalFunction(funcProto, Identifier(exec, numberProto->classInfo()->className))
 {
     // Number.Prototype
     putDirect(exec->propertyNames().prototype, numberProto, DontEnum|DontDelete|ReadOnly);
index a9b6b85..d2bfbad 100644 (file)
@@ -45,7 +45,7 @@ void PropertyNameArray::add(UString::Rep* identifier)
             return;
     }
 
-    m_vector.append(identifier);
+    m_vector.append(Identifier(m_globalData, identifier));
 }
 
 } // namespace KJS
index f743f53..fab1b2b 100644 (file)
@@ -33,9 +33,12 @@ namespace KJS {
         typedef Identifier ValueType;
         typedef Vector<Identifier>::const_iterator const_iterator;
 
+        PropertyNameArray(JSGlobalData* globalData) : m_globalData(globalData) {}
+        PropertyNameArray(ExecState* exec) : m_globalData(&exec->globalData()) {}
+
         void add(const Identifier& identifier) { add(identifier.ustring().rep()); }
         void add(UString::Rep*);
-        void addKnownUnique(UString::Rep* identifier) { m_vector.append(identifier); }
+        void addKnownUnique(UString::Rep* identifier) { m_vector.append(Identifier(m_globalData, identifier)); }
 
         const_iterator begin() const { return m_vector.begin(); }
         const_iterator end() const { return m_vector.end(); }
@@ -52,6 +55,7 @@ namespace KJS {
 
         Vector<Identifier, 20> m_vector;
         IdentifierSet m_set;
+        JSGlobalData* m_globalData;
     };
 
 } // namespace KJS
index fb5820d..5921b84 100644 (file)
@@ -65,7 +65,7 @@ public:
             return *m_data.valueSlot;
         if (m_getValue == KJS_NUMERIC_PROPERTY_NAME_SLOT_MARKER)
             return m_data.numericFunc(exec, propertyName, *this);
-        return m_getValue(exec, Identifier::from(propertyName), *this);
+        return m_getValue(exec, Identifier::from(exec, propertyName), *this);
     }
 
     void putValue(JSValue* value)
index 1a6d45b..f6f8eb6 100644 (file)
@@ -280,7 +280,7 @@ struct RegExpConstructorPrivate {
 };
 
 RegExpConstructor::RegExpConstructor(ExecState* exec, FunctionPrototype* funcProto, RegExpPrototype* regProto)
-  : InternalFunction(funcProto, "RegExp")
+  : InternalFunction(funcProto, Identifier(exec, "RegExp"))
   , d(new RegExpConstructorPrivate)
 {
   // ECMA 15.10.5.1 RegExp.prototype
index 4ac2ea1..d7fd22a 100644 (file)
@@ -35,9 +35,8 @@ void ScopeChainNode::print() const
     ScopeChainIterator scopeEnd = end();
     for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) {
         JSObject* o = *scopeIter;
-        PropertyNameArray propertyNames;
-        // FIXME: should pass ExecState here!
-        o->getPropertyNames(0, propertyNames);
+        PropertyNameArray propertyNames(globalObject()->globalExec());
+        o->getPropertyNames(globalObject()->globalExec(), propertyNames);
         PropertyNameArray::const_iterator propEnd = propertyNames.end();
 
         fprintf(stderr, "----- [scope %p] -----\n", o);
index 90082c9..654b187 100644 (file)
@@ -163,19 +163,19 @@ COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false
 
 GlobalObject::GlobalObject(Vector<UString>& arguments)
 {
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, "debug", functionDebug));
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, "print", functionPrint));
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 0, "quit", functionQuit));
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 0, "gc", functionGC));
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, "version", functionVersion));
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, "run", functionRun));
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, "load", functionLoad));
-    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 0, "readline", functionReadline));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "debug"), functionDebug));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "print"), functionPrint));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 0, Identifier(globalExec(), "quit"), functionQuit));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 0, Identifier(globalExec(), "gc"), functionGC));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "version"), functionVersion));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "run"), functionRun));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, Identifier(globalExec(), "load"), functionLoad));
+    putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 0, Identifier(globalExec(), "readline"), functionReadline));
 
     JSObject* array = arrayConstructor()->construct(globalExec(), globalExec()->emptyList());
     for (size_t i = 0; i < arguments.size(); ++i)
         array->put(globalExec(), i, jsString(arguments[i]));
-    putDirect("arguments", array);
+    putDirect(Identifier(globalExec(), "arguments"), array);
 
     Interpreter::setShouldPrintExceptions(true);
 }
index 0498bb5..e18efb6 100644 (file)
@@ -486,7 +486,7 @@ bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& proper
 // TODO: MakeTime (15.9.11.1) etc. ?
 
 DateConstructor::DateConstructor(ExecState* exec, FunctionPrototype* funcProto, DatePrototype* dateProto)
-  : InternalFunction(funcProto, dateProto->classInfo()->className)
+  : InternalFunction(funcProto, Identifier(exec, dateProto->classInfo()->className))
 {
   putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly);
   putDirectFunction(new DateFunction(exec, funcProto, DateFunction::Parse, 1, exec->propertyNames().parse), DontEnum);
index c087ae3..d373656 100644 (file)
@@ -71,7 +71,7 @@ JSValue* errorProtoFuncToString(ExecState* exec, JSObject* thisObj, const ArgLis
 // ------------------------------ ErrorConstructor -------------------------------
 
 ErrorConstructor::ErrorConstructor(ExecState* exec, FunctionPrototype* funcProto, ErrorPrototype* errorProto)
-    : InternalFunction(funcProto, errorProto->classInfo()->className)
+    : InternalFunction(funcProto, Identifier(exec, errorProto->classInfo()->className))
 {
     // ECMA 15.11.3.1 Error.prototype
     putDirect(exec->propertyNames().prototype, errorProto, DontEnum|DontDelete|ReadOnly);
@@ -117,7 +117,7 @@ NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, ErrorPrototype* erro
 const ClassInfo NativeErrorConstructor::info = { "Function", &InternalFunction::info, 0, 0 };
 
 NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, FunctionPrototype* funcProto, NativeErrorPrototype* prot)
-    : InternalFunction(funcProto, Identifier(prot->getDirect(exec->propertyNames().name)->getString()))
+    : InternalFunction(funcProto, Identifier(exec, prot->getDirect(exec->propertyNames().name)->getString()))
     , proto(prot)
 {
     putDirect(exec->propertyNames().length, jsNumber(1), DontDelete|ReadOnly|DontEnum); // ECMA 15.11.7.5
index 59382d7..f51987e 100644 (file)
@@ -300,8 +300,8 @@ Literal:
 
 Property:
     IDENT ':' AssignmentExpr            { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(*$1, $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
-  | STRING ':' AssignmentExpr           { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(Identifier(*$1), $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
-  | NUMBER ':' AssignmentExpr           { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(Identifier(UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
+  | STRING ':' AssignmentExpr           { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(Identifier(GLOBAL_DATA, *$1), $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
+  | NUMBER ':' AssignmentExpr           { $$ = createNodeFeatureInfo<PropertyNode*>(new PropertyNode(Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_featureInfo); }
   | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE    { $$ = createNodeFeatureInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER->sourceRange($5, $7)), ClosureFeature); DBG($6, @5, @7); if (!$$.m_node) YYABORT; }
   | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
                                         { $$ = createNodeFeatureInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.head, $7, LEXER->sourceRange($6, $8)), ClosureFeature); DBG($7, @6, @8); if (!$$.m_node) YYABORT; }
index 304e4ca..54dbd7e 100644 (file)
@@ -124,7 +124,7 @@ struct CStringTranslator
     }
 };
 
-PassRefPtr<UString::Rep> Identifier::add(const char* c)
+PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const char* c)
 {
     if (!c) {
         UString::Rep::null.hash();
@@ -136,7 +136,7 @@ PassRefPtr<UString::Rep> Identifier::add(const char* c)
         return &UString::Rep::empty;
     }
 
-    IdentifierTable& identifierTable = *JSGlobalData::threadInstance().identifierTable;
+    IdentifierTable& identifierTable = *globalData->identifierTable;
     LiteralIdentifierTable& literalIdentifierTable = identifierTable.literalTable();
 
     const LiteralIdentifierTable::iterator& iter = literalIdentifierTable.find(c);
@@ -149,29 +149,9 @@ PassRefPtr<UString::Rep> Identifier::add(const char* c)
     return addedString;
 }
 
-PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const char* c)
+PassRefPtr<UString::Rep> Identifier::add(ExecState* exec, const char* c)
 {
-    if (!c) {
-        UString::Rep::null.hash();
-        return &UString::Rep::null;
-    }
-
-    if (!c[0]) {
-        UString::Rep::empty.hash();
-        return &UString::Rep::empty;
-    }
-
-    IdentifierTable& identifierTable = *globalData->identifierTable;
-    LiteralIdentifierTable& literalIdentifierTable = identifierTable.literalTable();
-
-    const LiteralIdentifierTable::iterator& iter = literalIdentifierTable.find(c);
-    if (iter != literalIdentifierTable.end())
-        return iter->second;
-
-    UString::Rep* addedString = *identifierTable.add<const char*, CStringTranslator>(c).first;
-    literalIdentifierTable.add(c, addedString);
-
-    return addedString;
+    return add(&exec->globalData(), c);
 }
 
 struct UCharBuffer {
@@ -205,7 +185,7 @@ struct UCharBufferTranslator
     }
 };
 
-PassRefPtr<UString::Rep> Identifier::add(const UChar *s, int length)
+PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const UChar* s, int length)
 {
     if (!length) {
         UString::Rep::empty.hash();
@@ -213,10 +193,15 @@ PassRefPtr<UString::Rep> Identifier::add(const UChar *s, int length)
     }
     
     UCharBuffer buf = {s, length}; 
-    return *JSGlobalData::threadInstance().identifierTable->add<UCharBuffer, UCharBufferTranslator>(buf).first;
+    return *globalData->identifierTable->add<UCharBuffer, UCharBufferTranslator>(buf).first;
+}
+
+PassRefPtr<UString::Rep> Identifier::add(ExecState* exec, const UChar* s, int length)
+{
+    return add(&exec->globalData(), s, length);
 }
 
-PassRefPtr<UString::Rep> Identifier::addSlowCase(UString::Rep *r)
+PassRefPtr<UString::Rep> Identifier::addSlowCase(JSGlobalData* globalData, UString::Rep* r)
 {
     ASSERT(!r->identifierTable);
 
@@ -225,7 +210,12 @@ PassRefPtr<UString::Rep> Identifier::addSlowCase(UString::Rep *r)
         return &UString::Rep::empty;
     }
 
-    return *JSGlobalData::threadInstance().identifierTable->add(r).first;
+    return *globalData->identifierTable->add(r).first;
+}
+
+PassRefPtr<UString::Rep> Identifier::addSlowCase(ExecState* exec, UString::Rep* r)
+{
+    return addSlowCase(&exec->globalData(), r);
 }
 
 void Identifier::remove(UString::Rep *r)
index 8198a6e..4eb03d8 100644 (file)
@@ -30,12 +30,16 @@ namespace KJS {
         friend class PropertyMap;
     public:
         Identifier() { }
-        Identifier(const char* s) : _ustring(add(s)) { } // Only to be used with string literals.
-        Identifier(const UChar* s, int length) : _ustring(add(s, length)) { }
-        explicit Identifier(UString::Rep* rep) : _ustring(add(rep)) { } 
-        explicit Identifier(const UString& s) : _ustring(add(s.rep())) { }
+
+        Identifier(ExecState* exec, const char* s) : _ustring(add(exec, s)) { } // Only to be used with string literals.
+        Identifier(ExecState* exec, const UChar* s, int length) : _ustring(add(exec, s, length)) { }
+        Identifier(ExecState* exec, UString::Rep* rep) : _ustring(add(exec, rep)) { } 
+        Identifier(ExecState* exec, const UString& s) : _ustring(add(exec, s.rep())) { }
 
         Identifier(JSGlobalData* globalData, const char* s) : _ustring(add(globalData, s)) { } // Only to be used with string literals.
+        Identifier(JSGlobalData* globalData, const UChar* s, int length) : _ustring(add(globalData, s, length)) { }
+        Identifier(JSGlobalData* globalData, UString::Rep* rep) : _ustring(add(globalData, rep)) { } 
+        Identifier(JSGlobalData* globalData, const UString& s) : _ustring(add(globalData, s.rep())) { }
 
         // Special constructor for cases where we overwrite an object in place.
         Identifier(PlacementNewAdoptType) : _ustring(PlacementNewAdopt) { }
@@ -48,7 +52,7 @@ namespace KJS {
         
         const char* ascii() const { return _ustring.ascii(); }
         
-        static Identifier from(unsigned y) { return Identifier(UString::from(y)); }
+        static Identifier from(ExecState* exec, unsigned y) { return Identifier(exec, UString::from(y)); }
         
         bool isNull() const { return _ustring.isNull(); }
         bool isEmpty() const { return _ustring.isEmpty(); }
@@ -70,37 +74,51 @@ namespace KJS {
         static bool equal(const UString::Rep*, const UChar*, int length);
         static bool equal(const UString::Rep* a, const UString::Rep* b) { return KJS::equal(a, b); }
 
-        static PassRefPtr<UString::Rep> add(const char*);
+        static PassRefPtr<UString::Rep> add(ExecState*, const char*); // Only to be used with string literals.
+        static PassRefPtr<UString::Rep> add(JSGlobalData*, const char*); // Only to be used with string literals.
 
         static void initializeIdentifierThreading();
 
     private:
         UString _ustring;
         
-        static bool equal(const Identifier& a, const Identifier& b)
-            { return a._ustring.rep() == b._ustring.rep(); }
-        static bool equal(const Identifier& a, const char* b)
-            { return equal(a._ustring.rep(), b); }
-        
-        static PassRefPtr<UString::Rep> add(JSGlobalData*, const char*);
-        static PassRefPtr<UString::Rep> add(const UChar*, int length);
-        static PassRefPtr<UString::Rep> add(UString::Rep* r)
+        static bool equal(const Identifier& a, const Identifier& b) { return a._ustring.rep() == b._ustring.rep(); }
+        static bool equal(const Identifier& a, const char* b) { return equal(a._ustring.rep(), b); }
+
+        static PassRefPtr<UString::Rep> add(ExecState*, const UChar*, int length);
+        static PassRefPtr<UString::Rep> add(JSGlobalData*, const UChar*, int length);
+
+        static PassRefPtr<UString::Rep> add(ExecState* exec, UString::Rep* r)
         {
             if (r->identifierTable)
                 return r;
-            return addSlowCase(r);
+            return addSlowCase(exec, r);
         }
-        static PassRefPtr<UString::Rep> addSlowCase(UString::Rep *r);
+        static PassRefPtr<UString::Rep> add(JSGlobalData* globalData, UString::Rep* r)
+        {
+            if (r->identifierTable)
+                return r;
+            return addSlowCase(globalData, r);
+        }
+
+        static PassRefPtr<UString::Rep> addSlowCase(ExecState*, UString::Rep* r);
+        static PassRefPtr<UString::Rep> addSlowCase(JSGlobalData*, UString::Rep* r);
     };
     
     inline bool operator==(const Identifier& a, const Identifier& b)
-        { return Identifier::equal(a, b); }
+    {
+        return Identifier::equal(a, b);
+    }
 
     inline bool operator!=(const Identifier& a, const Identifier& b)
-        { return !Identifier::equal(a, b); }
+    {
+        return !Identifier::equal(a, b);
+    }
 
     inline bool operator==(const Identifier& a, const char* b)
-        { return Identifier::equal(a, b); }
+    {
+        return Identifier::equal(a, b);
+    }
 
     IdentifierTable* createIdentifierTable();
     void deleteIdentifierTable(IdentifierTable*);
index 902757f..514dd6f 100644 (file)
@@ -136,7 +136,7 @@ bool JSString::getOwnPropertySlot(ExecState* exec, unsigned propertyName, Proper
     // This function should only be called by JSValue::get.
     if (getStringPropertySlot(propertyName, slot))
         return true;
-    return JSString::getOwnPropertySlot(exec, Identifier::from(propertyName), slot);
+    return JSString::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
 }
 
 // ------------------------------ JSNumberCell ------------------------------------
index 483b1f4..9c5e1e7 100644 (file)
@@ -59,7 +59,7 @@ static bool isDecimalDigit(int);
 static const size_t initialReadBufferCapacity = 32;
 static const size_t initialStringTableCapacity = 64;
 
-Lexer::Lexer()
+Lexer::Lexer(JSGlobalData* globalData)
     : yylineno(1)
     , restrKeyword(false)
     , eatNextIdentifier(false)
@@ -73,6 +73,7 @@ Lexer::Lexer()
     , next1(0)
     , next2(0)
     , next3(0)
+    , m_globalData(globalData)
     , mainTable(KJS::mainTable)
 {
     m_buffer8.reserveCapacity(initialReadBufferCapacity);
@@ -549,18 +550,21 @@ int Lexer::lex(void* p1, void* p2)
     lvalp->ident = makeIdentifier(m_buffer16);
     token = IDENT;
     break;
-  case IdentifierOrKeyword:
+  case IdentifierOrKeyword: {
     lvalp->ident = makeIdentifier(m_buffer16);
-    if ((token = mainTable.value(*lvalp->ident)) < 0) {
+    const HashEntry* entry = mainTable.entry(m_globalData, *lvalp->ident);
+    if (!entry) {
       // Lookup for keyword failed, means this is an identifier.
       token = IDENT;
       break;
     }
+    token = entry->integerValue;
     // Hack for "f = function somename() { ... }"; too hard to get into the grammar.
     eatNextIdentifier = token == FUNCTION && lastToken == '=';
     if (token == CONTINUE || token == BREAK || token == RETURN || token == THROW)
       restrKeyword = true;
     break;
+  }
   case String:
     lvalp->string = makeUString(m_buffer16);
     token = STRING;
@@ -886,7 +890,7 @@ void Lexer::clear()
 
 Identifier* Lexer::makeIdentifier(const Vector<UChar>& buffer)
 {
-    KJS::Identifier* identifier = new KJS::Identifier(buffer.data(), buffer.size());
+    KJS::Identifier* identifier = new KJS::Identifier(m_globalData, buffer.data(), buffer.size());
     m_identifiers.append(identifier);
     return identifier;
 }
index 7401185..d956d59 100644 (file)
@@ -91,7 +91,7 @@ namespace KJS {
 
   private:
     friend struct JSGlobalData;
-    Lexer();
+    Lexer(JSGlobalData*);
     ~Lexer();
 
     int yylineno;
@@ -142,7 +142,9 @@ namespace KJS {
 
     Vector<UString*> m_strings;
     Vector<KJS::Identifier*> m_identifiers;
-    
+
+    JSGlobalData* m_globalData;
+
     UString m_pattern;
     UString m_flags;
 
index 8e028e8..345e916 100644 (file)
 
 namespace KJS {
 
-void HashTable::createTable() const
+void HashTable::createTable(JSGlobalData* globalData) const
 {
     ASSERT(!table);
     HashEntry* entries = new HashEntry[hashSizeMask + 1];
     for (int i = 0; i <= hashSizeMask; ++i)
         entries[i].key = 0;
     for (int i = 0; values[i].key; ++i) {
-        UString::Rep* identifier = Identifier::add(values[i].key).releaseRef();
+        UString::Rep* identifier = Identifier::add(globalData, values[i].key).releaseRef();
         int hashIndex = identifier->computedHash() & hashSizeMask;
         ASSERT(!entries[hashIndex].key);
         entries[hashIndex].key = identifier;
index f0e0f19..39a398f 100644 (file)
@@ -56,11 +56,34 @@ namespace KJS {
         const HashTableValue* values; // Fixed values generated by script.
         mutable const HashEntry* table; // Table allocated at runtime.
 
+        ALWAYS_INLINE void initializeIfNeeded(JSGlobalData* globalData) const
+        {
+            if (!table)
+                createTable(globalData);
+        }
+
+        ALWAYS_INLINE void initializeIfNeeded(ExecState* exec) const
+        {
+            if (!table)
+                createTable(&exec->globalData());
+        }
+
         // Find an entry in the table, and return the entry.
+        ALWAYS_INLINE const HashEntry* entry(JSGlobalData* globalData, const Identifier& identifier) const
+        {
+            initializeIfNeeded(globalData);
+            return entry(identifier);
+        }
+
+        ALWAYS_INLINE const HashEntry* entry(ExecState* exec, const Identifier& identifier) const
+        {
+            initializeIfNeeded(exec);
+            return entry(identifier);
+        }
+
+private:
         ALWAYS_INLINE const HashEntry* entry(const Identifier& identifier) const
         {
-            if (!table)
-                createTable();
             ASSERT(table);
             const HashEntry* entry = &table[identifier.ustring().rep()->computedHash() & hashSizeMask];
             if (entry->key != identifier.ustring().rep())
@@ -68,15 +91,8 @@ namespace KJS {
             return entry;
         }
 
-        // Find an entry in the table, and return the value.
-        int value(const Identifier& identifier) const
-        {
-            const HashEntry* entry = this->entry(identifier);
-            return entry ? entry->integerValue : -1;
-        }
-
         // Convert the hash table keys to identifiers.
-        void createTable() const;
+        void createTable(JSGlobalData*) const;
     };
 
   /**
@@ -133,7 +149,7 @@ namespace KJS {
   template <class ThisImp, class ParentImp>
   inline bool getStaticPropertySlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot)
   {
-    const HashEntry* entry = table->entry(propertyName);
+    const HashEntry* entry = table->entry(exec, propertyName);
 
     if (!entry) // not found, forward to parent
       return thisObj->ParentImp::getOwnPropertySlot(exec, propertyName, slot);
@@ -154,7 +170,7 @@ namespace KJS {
   template <class ParentImp>
   inline bool getStaticFunctionSlot(ExecState* exec, const HashTable* table, JSObject* thisObj, const Identifier& propertyName, PropertySlot& slot)
   {
-    const HashEntry* entry = table->entry(propertyName);
+    const HashEntry* entry = table->entry(exec, propertyName);
 
     if (!entry) // not found, forward to parent
       return static_cast<ParentImp*>(thisObj)->ParentImp::getOwnPropertySlot(exec, propertyName, slot);
@@ -172,7 +188,7 @@ namespace KJS {
   template <class ThisImp, class ParentImp>
   inline bool getStaticValueSlot(ExecState* exec, const HashTable* table, ThisImp* thisObj, const Identifier& propertyName, PropertySlot& slot)
   {
-    const HashEntry* entry = table->entry(propertyName);
+    const HashEntry* entry = table->entry(exec, propertyName);
 
     if (!entry) // not found, forward to parent
       return thisObj->ParentImp::getOwnPropertySlot(exec, propertyName, slot);
@@ -191,7 +207,7 @@ namespace KJS {
   template <class ThisImp>
   inline bool lookupPut(ExecState* exec, const Identifier& propertyName, JSValue* value, const HashTable* table, ThisImp* thisObj)
   {
-    const HashEntry* entry = table->entry(propertyName);
+    const HashEntry* entry = table->entry(exec, propertyName);
 
     if (!entry)
       return false;
@@ -285,7 +301,7 @@ namespace KJS {
     const ClassInfo ClassPrototype::info = { ClassName"Prototype", 0, &ClassPrototype##Table, 0  }; \
     JSObject* ClassPrototype::self(ExecState* exec) \
     { \
-        return KJS::cacheGlobalObject<ClassPrototype>(exec, Identifier("[[" ClassName ".prototype]]")); \
+        return KJS::cacheGlobalObject<ClassPrototype>(exec, Identifier(exec, "[[" ClassName ".prototype]]")); \
     } \
     bool ClassPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) \
     { \
index 02c5fc4..49f4d5d 100644 (file)
@@ -286,7 +286,7 @@ RegisterID* StringNode::emitCode(CodeGenerator& generator, RegisterID* dst)
 RegisterID* RegExpNode::emitCode(CodeGenerator& generator, RegisterID* dst)
 {
     if (!m_regExp->isValid())
-        return emitThrowError(generator, SyntaxError, "Invalid regular expression: %s", m_regExp->errorMessage());
+        return emitThrowError(generator, SyntaxError, ("Invalid regular expression: " + UString(m_regExp->errorMessage())).UTF8String().c_str());
     return generator.emitNewRegExp(generator.finalDestination(dst), m_regExp.get());
 }
 
index c753949..a0c35ce 100644 (file)
@@ -69,7 +69,7 @@ JSValue* objectProtoFuncValueOf(ExecState*, JSObject* thisObj, const ArgList&)
 
 JSValue* objectProtoFuncHasOwnProperty(ExecState* exec, JSObject* thisObj, const ArgList& args)
 {
-    return jsBoolean(thisObj->hasOwnProperty(exec, Identifier(args[0]->toString(exec))));
+    return jsBoolean(thisObj->hasOwnProperty(exec, Identifier(exec, args[0]->toString(exec))));
 }
 
 JSValue* objectProtoFuncIsPrototypeOf(ExecState*, JSObject* thisObj, const ArgList& args)
@@ -93,7 +93,7 @@ JSValue* objectProtoFuncDefineGetter(ExecState* exec, JSObject* thisObj, const A
     if (!args[1]->isObject() || !static_cast<JSObject*>(args[1])->implementsCall())
         return throwError(exec, SyntaxError, "invalid getter usage");
 
-    thisObj->defineGetter(exec, Identifier(args[0]->toString(exec)), static_cast<JSObject *>(args[1]));
+    thisObj->defineGetter(exec, Identifier(exec, args[0]->toString(exec)), static_cast<JSObject *>(args[1]));
     return jsUndefined();
 }
 
@@ -102,23 +102,23 @@ JSValue* objectProtoFuncDefineSetter(ExecState* exec, JSObject* thisObj, const A
     if (!args[1]->isObject() || !static_cast<JSObject*>(args[1])->implementsCall())
         return throwError(exec, SyntaxError, "invalid setter usage");
 
-    thisObj->defineSetter(exec, Identifier(args[0]->toString(exec)), static_cast<JSObject *>(args[1]));
+    thisObj->defineSetter(exec, Identifier(exec, args[0]->toString(exec)), static_cast<JSObject *>(args[1]));
     return jsUndefined();
 }
 
 JSValue* objectProtoFuncLookupGetter(ExecState* exec, JSObject* thisObj, const ArgList& args)
 {
-    return thisObj->lookupGetter(exec, Identifier(args[0]->toString(exec)));
+    return thisObj->lookupGetter(exec, Identifier(exec, args[0]->toString(exec)));
 }
 
 JSValue* objectProtoFuncLookupSetter(ExecState* exec, JSObject* thisObj, const ArgList& args)
 {
-    return thisObj->lookupSetter(exec, Identifier(args[0]->toString(exec)));
+    return thisObj->lookupSetter(exec, Identifier(exec, args[0]->toString(exec)));
 }
 
 JSValue* objectProtoFuncPropertyIsEnumerable(ExecState* exec, JSObject* thisObj, const ArgList& args)
 {
-    return jsBoolean(thisObj->propertyIsEnumerable(exec, Identifier(args[0]->toString(exec))));
+    return jsBoolean(thisObj->propertyIsEnumerable(exec, Identifier(exec, args[0]->toString(exec))));
 }
 
 JSValue* objectProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const ArgList&)
@@ -134,7 +134,7 @@ JSValue* objectProtoFuncToString(ExecState*, JSObject* thisObj, const ArgList&)
 // ------------------------------ ObjectConstructor --------------------------------
 
 ObjectConstructor::ObjectConstructor(ExecState* exec, ObjectPrototype* objProto, FunctionPrototype* funcProto)
-  : InternalFunction(funcProto, "Object")
+  : InternalFunction(funcProto, Identifier(exec, "Object"))
 {
   // ECMA 15.2.3.1
   putDirect(exec->propertyNames().prototype, objProto, DontEnum|DontDelete|ReadOnly);
index 08406de..cf293aa 100644 (file)
@@ -69,7 +69,7 @@ bool StringObject::getOwnPropertySlot(ExecState* exec, unsigned propertyName, Pr
 {
     if (internalValue()->getStringPropertySlot(propertyName, slot))
         return true;    
-    return JSObject::getOwnPropertySlot(exec, Identifier::from(propertyName), slot);
+    return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
 }
 
 void StringObject::put(ExecState* exec, const Identifier& propertyName, JSValue* value)
@@ -90,7 +90,7 @@ void StringObject::getPropertyNames(ExecState* exec, PropertyNameArray& property
 {
   int size = internalValue()->getString().size();
   for (int i = 0; i < size; i++)
-    propertyNames.add(Identifier(UString::from(i)));
+    propertyNames.add(Identifier(exec, UString::from(i)));
   return JSObject::getPropertyNames(exec, propertyNames);
 }
 
@@ -930,7 +930,7 @@ JSValue* stringProtoFuncLink(ExecState* exec, JSObject* thisObj, const ArgList&
 // ------------------------------ StringConstructor ------------------------------
 
 StringConstructor::StringConstructor(ExecState* exec, FunctionPrototype* funcProto, StringPrototype* stringProto)
-  : InternalFunction(funcProto, stringProto->classInfo()->className)
+  : InternalFunction(funcProto, Identifier(exec, stringProto->classInfo()->className))
 {
   // ECMA 15.5.3.1 String.prototype
   putDirect(exec->propertyNames().prototype, stringProto, DontEnum|DontDelete|ReadOnly);
index f919fa3..c7ac48c 100644 (file)
@@ -1,3 +1,21 @@
+2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Geoff Garen.
+
+        Make Identifier construction use an explicitly passed IdentifierTable.
+
+        * JSUtils.cpp:
+        (CFStringToIdentifier):
+        (KJSValueToCFTypeInternal):
+        * JSUtils.h:
+        * JSValueWrapper.cpp:
+        (JSValueWrapper::JSObjectCopyPropertyNames):
+        (JSValueWrapper::JSObjectCopyProperty):
+        (JSValueWrapper::JSObjectSetProperty):
+        * UserObjectImp.cpp:
+        (UserObjectImp::getPropertyNames):
+        Pass ExecState or JSGlobalData everywhere.
+
 2008-06-15  Darin Adler  <darin@apple.com>
 
         - rename KJS::List to KJS::ArgList
index dbc370e..f659d4c 100644 (file)
@@ -80,9 +80,9 @@ CFStringRef UStringToCFString(const UString& inUString)
 // CFStringToIdentifier
 //--------------------------------------------------------------------------
 
-Identifier CFStringToIdentifier(CFStringRef inCFString)
+Identifier CFStringToIdentifier(CFStringRef inCFString, ExecState* exec)
 {
-    return Identifier(CFStringToUString(inCFString));
+    return Identifier(exec, CFStringToUString(inCFString));
 }
 
 
@@ -275,7 +275,7 @@ CFTypeRef KJSValueToCFTypeInternal(JSValue *inValue, ExecState *exec, ObjectImpL
                         isArray = true;
                         JSGlueGlobalObject* globalObject = static_cast<JSGlueGlobalObject*>(exec->dynamicGlobalObject());
                         if (globalObject && (globalObject->Flags() & kJSFlagConvertAssociativeArray)) {
-                            PropertyNameArray propNames;
+                            PropertyNameArray propNames(exec);
                             object->getPropertyNames(exec, propNames);
                             PropertyNameArray::const_iterator iter = propNames.begin();
                             PropertyNameArray::const_iterator end = propNames.end();
@@ -299,7 +299,7 @@ CFTypeRef KJSValueToCFTypeInternal(JSValue *inValue, ExecState *exec, ObjectImpL
                     if (isArray)
                     {
                         // This is an KJS array
-                        unsigned int length = object->get(exec, "length")->toUInt32(exec);
+                        unsigned int length = object->get(exec, Identifier(exec, "length"))->toUInt32(exec);
                         result = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
                         if (result)
                         {
@@ -314,7 +314,7 @@ CFTypeRef KJSValueToCFTypeInternal(JSValue *inValue, ExecState *exec, ObjectImpL
                     else
                     {
                         // Not an array, just treat it like a dictionary which contains (property name, property value) pairs
-                        PropertyNameArray propNames;
+                        PropertyNameArray propNames(exec);
                         object->getPropertyNames(exec, propNames);
                         {
                             result = CFDictionaryCreateMutable(0,
index a075501..f084a23 100644 (file)
@@ -52,7 +52,7 @@ class JSUserObjectImp;
 
 UString CFStringToUString(CFStringRef inCFString);
 CFStringRef UStringToCFString(const UString& inUString);
-Identifier CFStringToIdentifier(CFStringRef inCFString);
+Identifier CFStringToIdentifier(CFStringRef inCFString, ExecState*);
 CFStringRef IdentifierToCFString(const Identifier& inIdentifier);
 JSUserObject *KJSValueToJSObject(JSValue *inValue, ExecState *exec);
 CFTypeRef KJSValueToCFType(JSValue *inValue, ExecState *exec);
index c8ec5f8..27d28b2 100644 (file)
@@ -121,7 +121,7 @@ CFArrayRef JSValueWrapper::JSObjectCopyPropertyNames(void *data)
     {
         ExecState* exec = getThreadGlobalExecState();
         JSObject *object = ptr->GetValue()->toObject(exec);
-        PropertyNameArray propNames;
+        PropertyNameArray propNames(exec);
         object->getPropertyNames(exec, propNames);
         PropertyNameArray::const_iterator iterator = propNames.begin();
 
@@ -155,7 +155,7 @@ JSObjectRef JSValueWrapper::JSObjectCopyProperty(void *data, CFStringRef propert
     if (ptr)
     {
         ExecState* exec = getThreadGlobalExecState();
-        JSValue *propValue = ptr->GetValue()->toObject(exec)->get(exec, CFStringToIdentifier(propertyName));
+        JSValue *propValue = ptr->GetValue()->toObject(exec)->get(exec, CFStringToIdentifier(propertyName, exec));
         JSValueWrapper* wrapperValue = new JSValueWrapper(propValue);
 
         JSObjectCallBacks callBacks;
@@ -180,7 +180,7 @@ void JSValueWrapper::JSObjectSetProperty(void *data, CFStringRef propertyName, J
         ExecState* exec = getThreadGlobalExecState();
         JSValue *value = JSObjectKJSValue((JSUserObject*)jsValue);
         JSObject *objValue = ptr->GetValue()->toObject(exec);
-        objValue->put(exec, CFStringToIdentifier(propertyName), value);
+        objValue->put(exec, CFStringToIdentifier(propertyName, exec), value);
     }
 }
 
index bbb19e3..4f3f3dc 100644 (file)
@@ -101,7 +101,7 @@ void UserObjectImp::getPropertyNames(ExecState *exec, PropertyNameArray& propert
             CFIndex i;
             for (i = 0; i < count; i++) {
                 CFStringRef propertyName = (CFStringRef)CFArrayGetValueAtIndex(cfPropertyNames, i);
-                propertyNames.add(CFStringToIdentifier(propertyName));
+                propertyNames.add(CFStringToIdentifier(propertyName, exec));
             }
             CFRelease(cfPropertyNames);
         }
index 19b2208..d9104fb 100644 (file)
@@ -1,3 +1,96 @@
+2008-06-16  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Geoff Garen.
+
+        Make Identifier construction use an explicitly passed IdentifierTable.
+
+        * platform/text/AtomicString.cpp:
+        * platform/text/AtomicString.h:
+        * platform/text/PlatformString.h:
+        * platform/text/String.cpp:
+        Removed "operator KJS::Identifier".
+
+        * bindings/js/JSCustomSQLStatementCallback.cpp:
+        (WebCore::JSCustomSQLStatementCallback::handleEvent):
+        * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
+        (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
+        * bindings/js/JSCustomSQLTransactionCallback.cpp:
+        (WebCore::JSCustomSQLTransactionCallback::handleEvent):
+        * bindings/js/JSCustomSQLTransactionErrorCallback.cpp:
+        (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
+        * bindings/js/JSCustomVoidCallback.cpp:
+        (WebCore::JSCustomVoidCallback::handleEvent):
+        * bindings/js/JSCustomXPathNSResolver.cpp:
+        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::JSDOMWindowBase):
+        (WebCore::JSDOMWindowBase::updateDocument):
+        (WebCore::createWindow):
+        (WebCore::showModalDialog):
+        (WebCore::JSDOMWindowBase::getOwnPropertySlot):
+        (WebCore::JSDOMWindowBase::put):
+        (WebCore::JSDOMWindowBase::clear):
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::setLocation):
+        * bindings/js/JSDOMWindowCustom.h:
+        (WebCore::JSDOMWindow::customGetOwnPropertySlot):
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSAbstractEventListener::handleEvent):
+        (WebCore::JSLazyEventListener::parseCode):
+        * bindings/js/JSEventTargetBase.h:
+        (WebCore::JSEventTargetPrototype::self):
+        * bindings/js/JSHTMLCollectionCustom.cpp:
+        (WebCore::JSHTMLCollection::callAsFunction):
+        (WebCore::JSHTMLCollection::item):
+        (WebCore::JSHTMLCollection::namedItem):
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::JSHTMLDocument::all):
+        (WebCore::JSHTMLDocument::setAll):
+        (WebCore::JSHTMLDocument::open):
+        * bindings/js/JSHTMLInputElementBase.cpp:
+        (WebCore::JSHTMLInputElementBase::getOwnPropertySlot):
+        * bindings/js/JSHistoryCustom.cpp:
+        (WebCore::JSHistory::customGetOwnPropertySlot):
+        * bindings/js/JSLocationCustom.cpp:
+        (WebCore::JSLocation::customGetOwnPropertySlot):
+        (WebCore::JSLocation::customPut):
+        * bindings/js/JSNavigatorCustom.cpp:
+        (WebCore::needsYouTubeQuirk):
+        * bindings/js/JSSQLResultSetRowListCustom.cpp:
+        (WebCore::JSSQLResultSetRowList::item):
+        * bindings/js/JSStorageCustom.cpp:
+        (WebCore::JSStorage::customGetPropertyNames):
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::execute):
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::evaluate):
+        * bindings/objc/WebScriptObject.mm:
+        (WebCore::addExceptionToConsole):
+        (-[WebScriptObject callWebScriptMethod:withArguments:]):
+        (-[WebScriptObject setValue:forKey:]):
+        (-[WebScriptObject valueForKey:]):
+        (-[WebScriptObject removeWebScriptKey:]):
+        (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * bridge/NP_jsobject.cpp:
+        (_NPN_Enumerate):
+        * bridge/c/c_instance.cpp:
+        (KJS::Bindings::CInstance::getPropertyNames):
+        * bridge/c/c_utility.cpp:
+        (KJS::Bindings::identifierFromNPIdentifier):
+        * bridge/jni/jni_class.cpp:
+        (JavaClass::JavaClass):
+        * bridge/jni/jni_jsobject.mm:
+        (JavaJSObject::call):
+        (JavaJSObject::getMember):
+        (JavaJSObject::setMember):
+        (JavaJSObject::removeMember):
+        * bridge/runtime_method.cpp:
+        (RuntimeMethod::callAsFunction):
+        Adapted to JavaScriptCore changes by explicitly constructing Identifiers, and always passing
+        an ExecState or JSGlobalData pointer. Since WebCore is not a legacy client, this can use
+        JSGlobalData::threadInstance(), as performance permits.
+
 2008-06-16  Jonathon Jongsma  <jonathon.jongsma@collabora.co.uk>
 
         Reviewed by Dan Bernstein.
index 03c6083..78babac 100644 (file)
@@ -60,7 +60,7 @@ void JSCustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLR
         
     KJS::JSLock lock;
         
-    JSValue* handleEventFuncValue = m_callback->get(exec, "handleEvent");
+    JSValue* handleEventFuncValue = m_callback->get(exec, Identifier(exec, "handleEvent"));
     JSObject* handleEventFunc = 0;
     if (handleEventFuncValue->isObject()) {
         handleEventFunc = static_cast<JSObject*>(handleEventFuncValue);
@@ -89,8 +89,8 @@ void JSCustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLR
     if (exec->hadException()) {
         JSObject* exception = exec->exception()->toObject(exec);
         String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-        int lineNumber = exception->get(exec, "line")->toInt32(exec);
-        String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+        int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+        String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
         m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
         
         raisedException = true;
index aaa27bd..16bde2e 100644 (file)
@@ -60,7 +60,7 @@ bool JSCustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction,
         
     KJS::JSLock lock;
         
-    JSValue* handleEventFuncValue = m_callback->get(exec, "handleEvent");
+    JSValue* handleEventFuncValue = m_callback->get(exec, Identifier(exec, "handleEvent"));
     JSObject* handleEventFunc = 0;
     if (handleEventFuncValue->isObject()) {
         handleEventFunc = static_cast<JSObject*>(handleEventFuncValue);
@@ -90,8 +90,8 @@ bool JSCustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction,
     if (exec->hadException()) {
         JSObject* exception = exec->exception()->toObject(exec);
         String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-        int lineNumber = exception->get(exec, "line")->toInt32(exec);
-        String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+        int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+        String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
         m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
         exec->clearException();
             
index ba5b358..5029842 100644 (file)
@@ -114,7 +114,7 @@ void JSCustomSQLTransactionCallback::handleEvent(SQLTransaction* transaction, bo
         
     KJS::JSLock lock;
         
-    JSValue* handleEventFuncValue = m_data->callback()->get(exec, "handleEvent");
+    JSValue* handleEventFuncValue = m_data->callback()->get(exec, Identifier(exec, "handleEvent"));
     JSObject* handleEventFunc = 0;
     if (handleEventFuncValue->isObject()) {
         handleEventFunc = static_cast<JSObject*>(handleEventFuncValue);
@@ -142,8 +142,8 @@ void JSCustomSQLTransactionCallback::handleEvent(SQLTransaction* transaction, bo
     if (exec->hadException()) {
         JSObject* exception = exec->exception()->toObject(exec);
         String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-        int lineNumber = exception->get(exec, "line")->toInt32(exec);
-        String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+        int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+        String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
         m_data->frame()->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
         exec->clearException();
         
index ed85ee2..1229f59 100644 (file)
@@ -59,7 +59,7 @@ bool JSCustomSQLTransactionErrorCallback::handleEvent(SQLError* error)
         
     KJS::JSLock lock;
         
-    JSValue* handleEventFuncValue = m_callback->get(exec, "handleEvent");
+    JSValue* handleEventFuncValue = m_callback->get(exec, Identifier(exec, "handleEvent"));
     JSObject* handleEventFunc = 0;
     if (handleEventFuncValue->isObject()) {
         handleEventFunc = static_cast<JSObject*>(handleEventFuncValue);
@@ -88,8 +88,8 @@ bool JSCustomSQLTransactionErrorCallback::handleEvent(SQLError* error)
     if (exec->hadException()) {
         JSObject* exception = exec->exception()->toObject(exec);
         String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-        int lineNumber = exception->get(exec, "line")->toInt32(exec);
-        String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+        int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+        String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
         m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
         exec->clearException();
     }
index 76cb859..d7de956 100644 (file)
@@ -60,7 +60,7 @@ void JSCustomVoidCallback::handleEvent()
         
     KJS::JSLock lock;
         
-    JSValue* handleEventFuncValue = m_callback->get(exec, "handleEvent");
+    JSValue* handleEventFuncValue = m_callback->get(exec, Identifier(exec, "handleEvent"));
     JSObject* handleEventFunc = 0;
     if (handleEventFuncValue->isObject()) {
         handleEventFunc = static_cast<JSObject*>(handleEventFuncValue);
@@ -87,8 +87,8 @@ void JSCustomVoidCallback::handleEvent()
     if (exec->hadException()) {
         JSObject* exception = exec->exception()->toObject(exec);
         String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-        int lineNumber = exception->get(exec, "line")->toInt32(exec);
-        String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+        int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+        String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
         m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
         exec->clearException();            
     }
index 2dbff63..cf45ae7 100644 (file)
@@ -80,7 +80,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
     JSGlobalObject* globalObject = m_frame->script()->globalObject();
     ExecState* exec = globalObject->globalExec();
         
-    JSValue* lookupNamespaceURIFuncValue = m_customResolver->get(exec, "lookupNamespaceURI");
+    JSValue* lookupNamespaceURIFuncValue = m_customResolver->get(exec, Identifier(exec, "lookupNamespaceURI"));
     JSObject* lookupNamespaceURIFunc = 0;
     if (lookupNamespaceURIFuncValue->isObject()) {      
         lookupNamespaceURIFunc = static_cast<JSObject*>(lookupNamespaceURIFuncValue);
@@ -111,8 +111,8 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
     if (exec->hadException()) {
         JSObject* exception = exec->exception()->toObject(exec);
         String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-        int lineNumber = exception->get(exec, "line")->toInt32(exec);
-        String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+        int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+        String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
         m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
         exec->clearException();
     } else {
index 464b941..44f028f 100644 (file)
@@ -186,8 +186,8 @@ JSDOMWindowBase::JSDOMWindowBase(JSObject* prototype, DOMWindow* window, JSDOMWi
     setTimeoutTime(10000);
 
     GlobalPropertyInfo staticGlobals[] = {
-        GlobalPropertyInfo("document", jsNull(), DontDelete | ReadOnly),
-        GlobalPropertyInfo("window", d->m_shell, DontDelete | ReadOnly)
+        GlobalPropertyInfo(Identifier(globalExec(), "document"), jsNull(), DontDelete | ReadOnly),
+        GlobalPropertyInfo(Identifier(globalExec(), "window"), d->m_shell, DontDelete | ReadOnly)
     };
     
     addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
@@ -197,7 +197,7 @@ void JSDOMWindowBase::updateDocument()
 {
     ASSERT(m_impl->document());
     ExecState* exec = globalExec();
-    symbolTablePutWithAttributes("document", toJS(exec, m_impl->document()), DontDelete | ReadOnly);
+    symbolTablePutWithAttributes(Identifier(exec, "document"), toJS(exec, m_impl->document()), DontDelete | ReadOnly);
 }
 
 JSDOMWindowBase::~JSDOMWindowBase()
@@ -302,7 +302,7 @@ static Frame* createWindow(ExecState* exec, Frame* openerFrame, const String& ur
     JSDOMWindow* newWindow = toJSDOMWindow(newFrame);
 
     if (dialogArgs)
-        newWindow->putDirect("dialogArguments", dialogArgs);
+        newWindow->putDirect(Identifier(exec, "dialogArguments"), dialogArgs);
 
     if (!protocolIs(url, "javascript") || newWindow->allowsAccessFrom(exec)) {
         KURL completedURL = url.isEmpty() ? KURL("") : activeFrame->document()->completeURL(url);
@@ -401,7 +401,7 @@ static JSValue* showModalDialog(ExecState* exec, Frame* frame, const String& url
     // Either JSDOMWindowBase::clear was not called yet, or there was no return value,
     // and in that case, there's no harm in trying again (no benefit either).
     if (!returnValue)
-        returnValue = dialogWindow->getDirect("returnValue");
+        returnValue = dialogWindow->getDirect(Identifier(exec, "returnValue"));
 
     return returnValue ? returnValue : jsUndefined();
 }
@@ -548,7 +548,7 @@ bool JSDOMWindowBase::getOwnPropertySlot(ExecState* exec, const Identifier& prop
         return true;
     }
 
-    const HashEntry* entry = JSDOMWindowBaseTable.entry(propertyName);
+    const HashEntry* entry = JSDOMWindowBaseTable.entry(exec, propertyName);
     if (entry) {
         if (entry->attributes & Function) {
             if (entry->functionValue == windowProtoFuncShowModalDialog) {
@@ -606,7 +606,7 @@ bool JSDOMWindowBase::getOwnPropertySlot(ExecState* exec, const Identifier& prop
 
 void JSDOMWindowBase::put(ExecState* exec, const Identifier& propertyName, JSValue* value)
 {
-  const HashEntry* entry = JSDOMWindowBaseTable.entry(propertyName);
+  const HashEntry* entry = JSDOMWindowBaseTable.entry(exec, propertyName);
   if (entry) {
      if (entry->attributes & Function) {
        if (allowsAccessFrom(exec))
@@ -861,7 +861,7 @@ void JSDOMWindowBase::clear()
   JSLock lock;
 
   if (d->m_returnValueSlot && !*d->m_returnValueSlot)
-    *d->m_returnValueSlot = getDirect("returnValue");
+    *d->m_returnValueSlot = getDirect(Identifier(globalExec(), "returnValue"));
 
   clearAllTimeouts();
   clearHelperObjectProperties();
index d361095..7732a92 100644 (file)
@@ -98,7 +98,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue* value)
     if (Settings* settings = activeFrame->settings()) {
         if (settings->usesDashboardBackwardCompatibilityMode() && !activeFrame->tree()->parent()) {
             if (allowsAccessFrom(exec))
-                putDirect("location", value);
+                putDirect(Identifier(exec, "location"), value);
             return;
         }
     }
index 1dcbf31..944bf85 100644 (file)
@@ -67,12 +67,12 @@ ALWAYS_INLINE bool JSDOMWindow::customGetOwnPropertySlot(KJS::ExecState* exec, c
     if (!impl()->frame()) {
         // The following code is safe for cross-domain and same domain use.
         // It ignores any custom properties that might be set on the DOMWindow (including a custom prototype).
-        entry = s_info.propHashTable(exec)->entry(propertyName);
+        entry = s_info.propHashTable(exec)->entry(exec, propertyName);
         if (entry && !(entry->attributes & KJS::Function) && entry->integerValue == ClosedAttrNum) {
             slot.setStaticEntry(this, entry, KJS::staticValueGetter<JSDOMWindow>);
             return true;
         }
-        entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(propertyName);
+        entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
         if (entry && (entry->attributes & KJS::Function) && entry->functionValue == jsDOMWindowPrototypeFunctionClose) {
             slot.setStaticEntry(this, entry, nonCachingStaticFunctionGetter);
             return true;
@@ -100,7 +100,7 @@ ALWAYS_INLINE bool JSDOMWindow::customGetOwnPropertySlot(KJS::ExecState* exec, c
     // prototype due to the blanket same origin (allowsAccessFrom) check at the end of getOwnPropertySlot.
     // Also, it's important to get the implementation straight out of the DOMWindow prototype regardless of
     // what prototype is actually set on this object.
-    entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(propertyName);
+    entry = JSDOMWindowPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
     if (entry) {
         if ((entry->attributes & KJS::Function)
                 && (entry->functionValue == jsDOMWindowPrototypeFunctionBlur
index c302662..f3e836f 100644 (file)
@@ -62,7 +62,7 @@ void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
 
     ExecState* exec = window->globalExec();
 
-    JSValue* handleEventFuncValue = listener->get(exec, "handleEvent");
+    JSValue* handleEventFuncValue = listener->get(exec, Identifier(exec, "handleEvent"));
     JSObject* handleEventFunc = 0;
     if (handleEventFuncValue->isObject()) {
         handleEventFunc = static_cast<JSObject*>(handleEventFuncValue);
@@ -99,8 +99,8 @@ void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
         if (exec->hadException()) {
             JSObject* exception = exec->exception()->toObject(exec);
             String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-            int lineNumber = exception->get(exec, "line")->toInt32(exec);
-            String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+            int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+            String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
             frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
             exec->clearException();
         } else {
@@ -283,7 +283,7 @@ void JSLazyEventListener::parseCode() const
 
         // FIXME: Passing the document's URL to construct is not always correct, since this event listener might
         // have been added with setAttribute from a script, and we should pass String() in that case.
-        m_listener = constr->construct(exec, args, m_functionName, sourceURL, m_lineNumber); // FIXME: is globalExec ok ?
+        m_listener = constr->construct(exec, args, Identifier(exec, m_functionName), sourceURL, m_lineNumber); // FIXME: is globalExec ok ?
 
         JSFunction* listenerAsFunction = static_cast<JSFunction*>(m_listener.get());
 
index 29c8e1b..591c6a8 100644 (file)
@@ -123,7 +123,7 @@ namespace WebCore {
 
         static KJS::JSObject* self(KJS::ExecState* exec)
         {
-            static KJS::Identifier* prototypeName = new KJS::Identifier(JSEventTargetPrototypeInformation::prototypeClassName());
+            static KJS::Identifier* prototypeName = new KJS::Identifier(exec, JSEventTargetPrototypeInformation::prototypeClassName());
 
             KJS::JSGlobalObject* globalObject = exec->lexicalGlobalObject();
             if (KJS::JSValue* objectValue = globalObject->getDirect(*prototypeName)) {
index f1a5ab6..05bc08e 100644 (file)
@@ -70,7 +70,7 @@ JSValue* JSHTMLCollection::callAsFunction(ExecState* exec, JSObject*, const ArgL
             return toJS(exec, collection->item(index));
 
         // Support for document.images('<name>') etc.
-        return getNamedItems(exec, collection, Identifier(string));
+        return getNamedItems(exec, collection, Identifier(exec, string));
     }
 
     // The second arg, if set, is the index of the item we want
@@ -113,12 +113,12 @@ JSValue* JSHTMLCollection::item(ExecState* exec, const ArgList& args)
     uint32_t index = args[0]->toString(exec).toUInt32(&ok, false);
     if (ok)
         return toJS(exec, impl()->item(index));
-    return getNamedItems(exec, impl(), Identifier(args[0]->toString(exec)));
+    return getNamedItems(exec, impl(), Identifier(exec, args[0]->toString(exec)));
 }
 
 JSValue* JSHTMLCollection::namedItem(ExecState* exec, const ArgList& args)
 {
-    return getNamedItems(exec, impl(), Identifier(args[0]->toString(exec)));
+    return getNamedItems(exec, impl(), Identifier(exec, args[0]->toString(exec)));
 }
 
 JSValue* toJS(ExecState* exec, HTMLCollection* collection)
index 866d5a5..c135d02 100644 (file)
@@ -80,16 +80,16 @@ JSValue* JSHTMLDocument::nameGetter(ExecState* exec, const Identifier& propertyN
 JSValue* JSHTMLDocument::all(ExecState* exec) const
 {
     // If "all" has been overwritten, return the overwritten value
-    if (JSValue* v = getDirect("all"))
+    if (JSValue* v = getDirect(Identifier(exec, "all")))
         return v;
 
     return toJS(exec, static_cast<HTMLDocument*>(impl())->all().get());
 }
 
-void JSHTMLDocument::setAll(ExecState*, JSValue* value)
+void JSHTMLDocument::setAll(ExecState* exec, JSValue* value)
 {
     // Add "all" to the property map.
-    putDirect("all", value);
+    putDirect(Identifier(exec, "all"), value);
 }
 
 // Custom functions
@@ -102,7 +102,7 @@ JSValue* JSHTMLDocument::open(ExecState* exec, const ArgList& args)
         if (frame) {
             JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame);
             if (wrapper) {
-                JSObject* functionObject = wrapper->get(exec, "open")->getObject();
+                JSObject* functionObject = wrapper->get(exec, Identifier(exec, "open"))->getObject();
                 if (!functionObject || !functionObject->implementsCall())
                     return throwError(exec, TypeError);
                 return functionObject->callAsFunction(exec, wrapper, args);
index 0a5a87e..fcc3ec0 100644 (file)
@@ -65,7 +65,7 @@ bool JSHTMLInputElementBase::getOwnPropertySlot(ExecState* exec, const Identifie
         return JSHTMLElement::getOwnPropertySlot(exec, propertyName, slot);
     
     // otherwise, do our own function lookup on our function table
-    const HashEntry* entry = JSHTMLInputElementBaseFunctionTable.entry(propertyName);
+    const HashEntry* entry = JSHTMLInputElementBaseFunctionTable.entry(exec, propertyName);
     if (entry && (entry->attributes & KJS::Function) && entry->functionValue == jsHTMLInputElementBaseFunctionSetSelectionRange) {
         slot.setStaticEntry(this, entry, staticFunctionGetter);
         return true;
index 5cc8bba..631c9ca 100644 (file)
@@ -48,7 +48,7 @@ bool JSHistory::customGetOwnPropertySlot(ExecState* exec, const Identifier& prop
         return false;
 
     // Check for the few functions that we allow, even when called cross-domain.
-    const HashEntry* entry = JSHistoryPrototype::s_info.propHashTable(exec)->entry(propertyName);
+    const HashEntry* entry = JSHistoryPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
     if (entry) {
         // Allow access to back(), forward() and go() from any frame.
         if ((entry->attributes & Function)
index ad3bb47..c37b7c0 100644 (file)
@@ -54,7 +54,7 @@ bool JSLocation::customGetOwnPropertySlot(ExecState* exec, const Identifier& pro
         return false;
 
     // Check for the few functions that we allow, even when called cross-domain.
-    const HashEntry* entry = JSLocationPrototype::s_info.propHashTable(exec)->entry(propertyName);
+    const HashEntry* entry = JSLocationPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
     if (entry && (entry->attributes & Function)
             && (entry->functionValue == jsLocationPrototypeFunctionReplace
                 || entry->functionValue == jsLocationPrototypeFunctionReload
@@ -80,7 +80,7 @@ bool JSLocation::customPut(ExecState* exec, const Identifier& propertyName, JSVa
 
     bool sameDomainAccess = allowsAccessFromFrame(exec, frame);
 
-    const HashEntry* entry = JSLocation::s_info.propHashTable(exec)->entry(propertyName);
+    const HashEntry* entry = JSLocation::s_info.propHashTable(exec)->entry(exec, propertyName);
     if (!entry) {
         if (sameDomainAccess)
             JSObject::put(exec, propertyName, value);
index 88069f6..e6d8fd9 100644 (file)
@@ -54,7 +54,7 @@ static bool needsYouTubeQuirk(ExecState* exec, Frame* frame)
     JSFunction* function = exec->function();
     if (!function)
         return false;
-    static const Identifier& isWindowsFunctionName = *new Identifier("isWindows");
+    static const Identifier& isWindowsFunctionName = *new Identifier(exec, "isWindows");
     if (function->functionName() != isWindowsFunctionName)
         return false;
 
@@ -70,7 +70,7 @@ static bool needsYouTubeQuirk(ExecState* exec, Frame* frame)
     JSObject* thisObject = callingExec->thisValue();
     if (!thisObject)
         return false;
-    static const Identifier& isSafariFunctionName = *new Identifier("isSafari");
+    static const Identifier& isSafariFunctionName = *new Identifier(exec, "isSafari");
     JSValue* isSafariFunction = thisObject->getDirect(isSafariFunctionName);
     if (isSafariFunction != callingFunction)
         return false;
index 6d8f1ad..1ae57ef 100644 (file)
@@ -72,7 +72,7 @@ JSValue* JSSQLResultSetRowList::item(ExecState* exec, const ArgList& args)
               ASSERT_NOT_REACHED();
         }
 
-        object->putDirect(m_impl->columnNames()[i], jsValue, DontDelete | ReadOnly);
+        object->putDirect(Identifier(exec, m_impl->columnNames()[i]), jsValue, DontDelete | ReadOnly);
     }
 
     return object;
index 88fb047..3089460 100644 (file)
@@ -69,7 +69,7 @@ bool JSStorage::customGetPropertyNames(ExecState* exec, PropertyNameArray& prope
     ExceptionCode ec;
     unsigned length = m_impl->length();
     for (unsigned i = 0; i < length; ++i)
-        propertyNames.add(m_impl->key(i, ec));
+        propertyNames.add(Identifier(exec, m_impl->key(i, ec)));
         
     return false;
 }
index 4b1d106..781c5eb 100644 (file)
@@ -77,7 +77,7 @@ void ScheduledAction::execute(JSDOMWindowShell* windowShell)
                 JSObject* exception = exec->exception()->toObject(exec);
                 exec->clearException();
                 String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-                int lineNumber = exception->get(exec, "line")->toInt32(exec);
+                int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
                 frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, String());
             }
         }
index 4187f72..526b3a5 100644 (file)
@@ -96,8 +96,8 @@ JSValue* ScriptController::evaluate(const String& filename, int baseLine, const
 
     if (comp.complType() == Throw) {
         UString errorMessage = comp.value()->toString(exec);
-        int lineNumber = comp.value()->toObject(exec)->get(exec, "line")->toInt32(exec);
-        UString sourceURL = comp.value()->toObject(exec)->get(exec, "sourceURL")->toString(exec);
+        int lineNumber = comp.value()->toObject(exec)->get(exec, Identifier(exec, "line"))->toInt32(exec);
+        UString sourceURL = comp.value()->toObject(exec)->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
         m_frame->domWindow()->console()->addMessage(JSMessageSource, ErrorMessageLevel, errorMessage, lineNumber, sourceURL);
     }
 
index aeae541..d584df0 100644 (file)
@@ -91,8 +91,8 @@ static void addExceptionToConsole(ExecState* exec)
     if (!window || !exception)
         return;
     String message = exception->get(exec, exec->propertyNames().message)->toString(exec);
-    int lineNumber = exception->get(exec, "line")->toInt32(exec);
-    String sourceURL = exception->get(exec, "sourceURL")->toString(exec);
+    int lineNumber = exception->get(exec, Identifier(exec, "line"))->toInt32(exec);
+    String sourceURL = exception->get(exec, Identifier(exec, "sourceURL"))->toString(exec);
     window->impl()->console()->addMessage(JSMessageSource, ErrorMessageLevel, message, lineNumber, sourceURL);
 }
 
@@ -286,7 +286,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
 
     JSLock lock;
     
-    JSValue* func = [self _imp]->get(exec, String(name));
+    JSValue* func = [self _imp]->get(exec, Identifier(exec, String(name)));
 
     if (!func || !func->isObject())
         // Maybe throw an exception here?
@@ -366,7 +366,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     ASSERT(!exec->hadException());
 
     JSLock lock;
-    [self _imp]->put(exec, String(key), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]));
+    [self _imp]->put(exec, Identifier(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]));
 
     if (exec->hadException()) {
         addExceptionToConsole(exec);
@@ -391,7 +391,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
         // leaving the lock permanently held
         JSLock lock;
         
-        JSValue *result = [self _imp]->get(exec, String(key));
+        JSValue *result = [self _imp]->get(exec, Identifier(exec, String(key)));
         
         if (exec->hadException()) {
             addExceptionToConsole(exec);
@@ -420,7 +420,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     ASSERT(!exec->hadException());
 
     JSLock lock;
-    [self _imp]->deleteProperty(exec, String(key));
+    [self _imp]->deleteProperty(exec, Identifier(exec, String(key)));
 
     if (exec->hadException()) {
         addExceptionToConsole(exec);
@@ -514,7 +514,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
         JSLock lock;
         
         if (object->classInfo() != &RuntimeObjectImp::s_info) {
-            JSValue* runtimeObject = object->get(exec, "__apple_runtime_object");
+            JSValue* runtimeObject = object->get(exec, Identifier(exec, "__apple_runtime_object"));
             if (runtimeObject && runtimeObject->isObject())
                 object = static_cast<RuntimeObjectImp*>(runtimeObject);
         }
index b23a384..ae64453 100644 (file)
@@ -279,7 +279,7 @@ sub GenerateGetOwnPropertySlotBody
 
     my $requiresManualLookup = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"};
     if ($requiresManualLookup) {
-        push(@getOwnPropertySlotImpl, "    const ${namespaceMaybe}HashEntry* entry = ${className}Table.entry(propertyName);\n");
+        push(@getOwnPropertySlotImpl, "    const ${namespaceMaybe}HashEntry* entry = ${className}Table.entry(exec, propertyName);\n");
         push(@getOwnPropertySlotImpl, "    if (entry) {\n");
         push(@getOwnPropertySlotImpl, "        slot.setStaticEntry(this, entry, staticValueGetter<$className>);\n");
         push(@getOwnPropertySlotImpl, "        return true;\n");
@@ -846,7 +846,7 @@ sub GenerateImplementation
     } else {
         push(@implContent, "JSObject* ${className}Prototype::self(ExecState* exec)\n");
         push(@implContent, "{\n");
-        push(@implContent, "    static const Identifier* prototypeIdentifier = new Identifier(\"[[${className}.prototype]]\");\n");
+        push(@implContent, "    static const Identifier* prototypeIdentifier = new Identifier(exec, \"[[${className}.prototype]]\");\n");
         push(@implContent, "    return KJS::cacheGlobalObject<${className}Prototype>(exec, *prototypeIdentifier);\n");
         push(@implContent, "}\n\n");
     }
@@ -965,7 +965,7 @@ sub GenerateImplementation
             push(@implContent, "        slot.setCustomIndex(this, propertyName, indexGetter);\n");
             push(@implContent, "        return true;\n");
             push(@implContent, "    }\n");
-            push(@implContent, "    return getOwnPropertySlot(exec, Identifier::from(propertyName), slot);\n");
+            push(@implContent, "    return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);\n");
             push(@implContent, "}\n\n");
         }
         
@@ -1127,9 +1127,9 @@ sub GenerateImplementation
                             $constructorType =~ s/Constructor$//;
                             $implIncludes{"JS" . $constructorType . ".h"} = 1;
                             push(@implContent, "        // Shadowing a built-in constructor\n");
-                            push(@implContent, "        putDirect(\"$name\", value);\n");
+                            push(@implContent, "        putDirect(Identifier(exec, \"$name\"), value);\n");
                         } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) {
-                            push(@implContent, "        putDirect(\"$name\", value);\n");
+                            push(@implContent, "        putDirect(Identifier(exec, \"$name\"), value);\n");
                         } else {
                             if ($podType) {
                                 push(@implContent, "        $podType imp(*impl());\n");
@@ -1172,7 +1172,7 @@ sub GenerateImplementation
         }
         if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"}) {
             push(@implContent, "    for (unsigned i = 0; i < static_cast<${implClassName}*>(impl())->length(); ++i)\n");
-            push(@implContent, "        propertyNames.add(Identifier::from(i));\n");
+            push(@implContent, "        propertyNames.add(Identifier::from(exec, i));\n");
         }
         push(@implContent, "     Base::getPropertyNames(exec, propertyNames);\n");
         push(@implContent, "}\n\n");
@@ -1180,7 +1180,7 @@ sub GenerateImplementation
 
     if ($dataNode->extendedAttributes->{"GenerateConstructor"}) {
         push(@implContent, "JSValue* ${className}::getConstructor(ExecState* exec)\n{\n");
-        push(@implContent, "    static const Identifier* constructorIdentifier = new Identifier(\"[[${interfaceName}.constructor]]\");\n");
+        push(@implContent, "    static const Identifier* constructorIdentifier = new Identifier(exec, \"[[${interfaceName}.constructor]]\");\n");
         push(@implContent, "    return KJS::cacheGlobalObject<${className}Constructor>(exec, *constructorIdentifier);\n");
         push(@implContent, "}\n\n");
     }
index 9305618..1406c10 100644 (file)
@@ -378,7 +378,7 @@ bool _NPN_Enumerate(NPP, NPObject *o, NPIdentifier **identifier, uint32_t *count
         
         ExecState* exec = rootObject->globalObject()->globalExec();
         JSLock lock;
-        PropertyNameArray propertyNames;
+        PropertyNameArray propertyNames(exec);
 
         obj->imp->getPropertyNames(exec, propertyNames);
         unsigned size = static_cast<unsigned>(propertyNames.size());
index da61ca4..da20f94 100644 (file)
@@ -168,7 +168,7 @@ JSValue* CInstance::valueOf() const
     return stringValue();
 }
 
-void CInstance::getPropertyNames(ExecState*, PropertyNameArray& nameArray) 
+void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray) 
 {
     if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(_object->_class) ||
         !_object->_class->enumerate)
@@ -189,7 +189,7 @@ void CInstance::getPropertyNames(ExecState*, PropertyNameArray& nameArray)
         if (identifier->isString)
             nameArray.add(identifierFromNPIdentifier(identifier->value.string));
         else
-            nameArray.add(Identifier::from(identifier->value.number));
+            nameArray.add(Identifier::from(exec, identifier->value.number));
     }
          
     // FIXME: This should really call NPN_MemFree but that's in WebKit
index 4af869f..72dd04d 100644 (file)
@@ -146,7 +146,7 @@ String convertNPStringToUTF16(const NPString* string)
 
 Identifier identifierFromNPIdentifier(const NPUTF8* name)
 {
-    return convertUTF8ToUTF16WithLatin1Fallback(name, -1);
+    return Identifier(&JSGlobalData::threadInstance(), convertUTF8ToUTF16WithLatin1Fallback(name, -1));
 }
 
 } }
index 625a683..b914f39 100644 (file)
@@ -50,6 +50,8 @@ JavaClass::JavaClass(jobject anInstance)
 
     int i;
     JNIEnv *env = getJNIEnv();
+
+    JSGlobalData* globalData = &JSGlobalData::threadInstance();
     
     // Get the fields
     jarray fields = (jarray)callJNIMethod<jobject>(aClass, "getFields", "()[Ljava/lang/reflect/Field;");
@@ -59,11 +61,11 @@ JavaClass::JavaClass(jobject anInstance)
         Field *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor
         {
             JSLock lock;
-            _fields.set(Identifier(aField->name()).ustring().rep(), aField);
+            _fields.set(Identifier(globalData, UString(aField->name())).ustring().rep(), aField);
         }
         env->DeleteLocalRef(aJField);
     }
-    
+
     // Get the methods
     jarray methods = (jarray)callJNIMethod<jobject>(aClass, "getMethods", "()[Ljava/lang/reflect/Method;");
     int numMethods = env->GetArrayLength(methods);
@@ -74,10 +76,10 @@ JavaClass::JavaClass(jobject anInstance)
         {
             JSLock lock;
 
-            methodList = _methods.get(Identifier(aMethod->name()).ustring().rep());
+            methodList = _methods.get(Identifier(globalData, UString(aMethod->name())).ustring().rep());
             if (!methodList) {
                 methodList = new MethodList();
-                _methods.set(Identifier(aMethod->name()).ustring().rep(), methodList);
+                _methods.set(Identifier(globalData, UString(aMethod->name())).ustring().rep(), methodList);
             }
         }
         methodList->append(aMethod);
index 240d0e7..19140e5 100644 (file)
@@ -289,8 +289,8 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const
     ExecState* exec = rootObject->globalObject()->globalExec();
     JSLock lock;
     
-    Identifier identifier(JavaString(methodName).ustring());
-    JSValue *func = _imp->get (exec, identifier);
+    Identifier identifier(exec, JavaString(methodName).ustring());
+    JSValue* func = _imp->get(exec, identifier);
     if (func->isUndefinedOrNull())
         return 0;
 
@@ -344,7 +344,7 @@ jobject JavaJSObject::getMember(jstring memberName) const
     ExecState* exec = rootObject->globalObject()->globalExec();
     
     JSLock lock;
-    JSValue *result = _imp->get (exec, Identifier (JavaString(memberName).ustring()));
+    JSValue* result = _imp->get(exec, Identifier(exec, JavaString(memberName).ustring()));
 
     return convertValueToJObject(result);
 }
@@ -359,7 +359,7 @@ void JavaJSObject::setMember(jstring memberName, jobject value) const
 
     ExecState* exec = rootObject->globalObject()->globalExec();
     JSLock lock;
-    _imp->put(exec, Identifier (JavaString(memberName).ustring()), convertJObjectToValue(value));
+    _imp->put(exec, Identifier(exec, JavaString(memberName).ustring()), convertJObjectToValue(value));
 }
 
 
@@ -373,7 +373,7 @@ void JavaJSObject::removeMember(jstring memberName) const
 
     ExecState* exec = rootObject->globalObject()->globalExec();
     JSLock lock;
-    _imp->deleteProperty(exec, Identifier (JavaString(memberName).ustring()));
+    _imp->deleteProperty(exec, Identifier(exec, JavaString(memberName).ustring()));
 }
 
 
index 3905d2a..ba59e32 100644 (file)
@@ -73,7 +73,7 @@ JSValue *RuntimeMethod::callAsFunction(ExecState *exec, JSObject *thisObj, const
     } else {
         // If thisObj is the DOM object for a plugin, get the corresponding
         // runtime object from the DOM object.
-        JSValue* value = thisObj->get(exec, "__apple_runtime_object");
+        JSValue* value = thisObj->get(exec, Identifier(exec, "__apple_runtime_object"));
         if (value->isObject(&KJS::RuntimeObjectImp::s_info))    
             imp = static_cast<RuntimeObjectImp*>(value);
     }
index d908dca..999e3ab 100644 (file)
@@ -265,11 +265,6 @@ AtomicStringImpl* AtomicString::find(const KJS::Identifier& identifier)
     return static_cast<AtomicStringImpl*>(*iterator);
 }
 
-AtomicString::operator Identifier() const
-{
-    return m_string;
-}
-
 AtomicString::operator UString() const
 {
     return m_string;
index 94fb516..4dfdec0 100644 (file)
@@ -45,7 +45,6 @@ public:
     operator const String&() const { return m_string; }
     const String& string() const { return m_string; };
 
-    operator KJS::Identifier() const;
     operator KJS::UString() const;
 
     AtomicStringImpl* impl() const { return static_cast<AtomicStringImpl *>(m_string.impl()); }
index a81404e..a2bc213 100644 (file)
@@ -69,7 +69,6 @@ public:
     static String adopt(StringBuffer& buffer) { return StringImpl::adopt(buffer); }
     static String adopt(Vector<UChar>& vector) { return StringImpl::adopt(vector); }
 
-    operator KJS::Identifier() const;
     operator KJS::UString() const;
 
     unsigned length() const;
index 249d0cb..18d7407 100644 (file)
@@ -604,13 +604,6 @@ String::String(const UString& str)
     m_impl = StringImpl::create(str.data(), str.size());
 }
 
-String::operator Identifier() const
-{
-    if (!m_impl)
-        return Identifier();
-    return Identifier(m_impl->characters(), m_impl->length());
-}
-
 String::operator UString() const
 {
     if (!m_impl)