Roll out recent threading changes (r32807, r32810, r32819, r32822) to simplify
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 May 2008 07:12:31 +0000 (07:12 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 May 2008 07:12:31 +0000 (07:12 +0000)
        SquirrelFish merging.

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

133 files changed:
JavaScriptCore/API/JSBase.cpp
JavaScriptCore/API/JSCallbackObjectFunctions.h
JavaScriptCore/API/JSClassRef.cpp
JavaScriptCore/API/JSObjectRef.cpp
JavaScriptCore/API/JSValueRef.cpp
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/kjs/ExecState.h
JavaScriptCore/kjs/InitializeThreading.cpp
JavaScriptCore/kjs/JSGlobalObject.cpp
JavaScriptCore/kjs/JSGlobalObject.h
JavaScriptCore/kjs/JSLock.cpp
JavaScriptCore/kjs/JSLock.h
JavaScriptCore/kjs/array_instance.cpp
JavaScriptCore/kjs/array_object.cpp
JavaScriptCore/kjs/bool_object.cpp
JavaScriptCore/kjs/collector.cpp
JavaScriptCore/kjs/collector.h
JavaScriptCore/kjs/date_object.cpp
JavaScriptCore/kjs/error_object.cpp
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/function_object.cpp
JavaScriptCore/kjs/internal.cpp
JavaScriptCore/kjs/internal.h
JavaScriptCore/kjs/list.cpp
JavaScriptCore/kjs/list.h
JavaScriptCore/kjs/lookup.h
JavaScriptCore/kjs/math_object.cpp
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/nodes.h
JavaScriptCore/kjs/number_object.cpp
JavaScriptCore/kjs/object.cpp
JavaScriptCore/kjs/object.h
JavaScriptCore/kjs/object_object.cpp
JavaScriptCore/kjs/property_map.h
JavaScriptCore/kjs/protect.h
JavaScriptCore/kjs/regexp_object.cpp
JavaScriptCore/kjs/regexp_object.h
JavaScriptCore/kjs/string_object.cpp
JavaScriptCore/kjs/string_object.h
JavaScriptCore/kjs/testkjs.cpp
JavaScriptCore/kjs/ustring.h
JavaScriptCore/kjs/value.cpp
JavaScriptCore/kjs/value.h
JavaScriptCore/wtf/ThreadSpecific.h
JavaScriptGlue/ChangeLog
JavaScriptGlue/JSUtils.cpp
JavaScriptGlue/JSUtils.h
JavaScriptGlue/JSValueWrapper.cpp
JavaScriptGlue/JavaScriptGlue.cpp
JavaScriptGlue/UserObjectImp.cpp
WebCore/ChangeLog
WebCore/bindings/js/GCController.cpp
WebCore/bindings/js/JSAudioConstructor.cpp
WebCore/bindings/js/JSCSSRuleCustom.cpp
WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
WebCore/bindings/js/JSCSSValueCustom.cpp
WebCore/bindings/js/JSCanvasPixelArrayCustom.cpp
WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
WebCore/bindings/js/JSClipboardCustom.cpp
WebCore/bindings/js/JSCustomXPathNSResolver.cpp
WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSDOMWindowBase.h
WebCore/bindings/js/JSDOMWindowShell.cpp
WebCore/bindings/js/JSDOMWindowShell.h
WebCore/bindings/js/JSDocumentCustom.cpp
WebCore/bindings/js/JSEventCustom.cpp
WebCore/bindings/js/JSEventTargetBase.cpp
WebCore/bindings/js/JSEventTargetBase.h
WebCore/bindings/js/JSEventTargetNode.cpp
WebCore/bindings/js/JSHTMLCollectionCustom.cpp
WebCore/bindings/js/JSHTMLElementWrapperFactory.cpp
WebCore/bindings/js/JSHTMLFormElementCustom.cpp
WebCore/bindings/js/JSHTMLInputElementBase.cpp
WebCore/bindings/js/JSHTMLOptionElementConstructor.cpp
WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
WebCore/bindings/js/JSInspectedObjectWrapper.cpp
WebCore/bindings/js/JSInspectorCallbackWrapper.cpp
WebCore/bindings/js/JSLocationCustom.cpp
WebCore/bindings/js/JSNamedNodesCollection.cpp
WebCore/bindings/js/JSNavigatorCustom.cpp
WebCore/bindings/js/JSNodeCustom.cpp
WebCore/bindings/js/JSNodeFilterCustom.cpp
WebCore/bindings/js/JSRGBColor.cpp
WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
WebCore/bindings/js/JSSVGElementWrapperFactory.cpp
WebCore/bindings/js/JSSVGLazyEventListener.cpp
WebCore/bindings/js/JSStorageCustom.cpp
WebCore/bindings/js/JSStyleSheetCustom.cpp
WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp
WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
WebCore/bindings/js/JSXSLTProcessorConstructor.cpp
WebCore/bindings/js/JSXSLTProcessorCustom.cpp
WebCore/bindings/js/kjs_binding.cpp
WebCore/bindings/js/kjs_binding.h
WebCore/bindings/js/kjs_events.cpp
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bridge/c/c_instance.cpp
WebCore/bridge/c/c_instance.h
WebCore/bridge/c/c_utility.cpp
WebCore/bridge/jni/jni_instance.cpp
WebCore/bridge/jni/jni_instance.h
WebCore/bridge/jni/jni_jsobject.h
WebCore/bridge/jni/jni_jsobject.mm
WebCore/bridge/jni/jni_objc.mm
WebCore/bridge/jni/jni_runtime.cpp
WebCore/bridge/jni/jni_utility.h
WebCore/bridge/objc/objc_class.mm
WebCore/bridge/objc/objc_instance.h
WebCore/bridge/objc/objc_instance.mm
WebCore/bridge/objc/objc_utility.h
WebCore/bridge/objc/objc_utility.mm
WebCore/bridge/qt/qt_class.cpp
WebCore/bridge/qt/qt_instance.cpp
WebCore/bridge/qt/qt_instance.h
WebCore/bridge/qt/qt_runtime.cpp
WebCore/bridge/runtime.cpp
WebCore/bridge/runtime.h
WebCore/bridge/runtime_array.cpp
WebCore/bridge/runtime_method.cpp
WebCore/bridge/runtime_object.cpp
WebCore/xml/XMLHttpRequest.cpp
WebKit/mac/ChangeLog
WebKit/mac/Misc/WebCoreStatistics.mm
WebKit/mac/WebView/WebScriptDebugDelegate.mm
WebKit/qt/Api/qwebframe.cpp
WebKit/qt/ChangeLog
WebKit/win/ChangeLog
WebKit/win/WebCoreStatistics.cpp
WebKit/win/WebJavaScriptCollector.cpp
WebKit/win/WebScriptCallFrame.cpp

index 143b8d1..d154e97 100644 (file)
@@ -84,12 +84,8 @@ void JSGarbageCollect(JSContextRef ctx)
         initializeThreading();
 
     JSLock lock;
-
-    // It might seem that we have a context passed to this function, and can use toJS(ctx)->heap(), but the parameter is likely to be NULL.
-    // The performance difference should be negligible anyway.
-    Heap* heap = Heap::threadHeap();
-    if (!heap->isBusy())
-        heap->collect();
+    if (!Collector::isBusy())
+        Collector::collect();
     // FIXME: Perhaps we should trigger a second mark and sweep
     // once the garbage collector is done if this is called when
     // the collector is busy.
index 66eeb72..b51d41a 100644 (file)
@@ -466,7 +466,7 @@ JSValue* JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSObject*
         if (OpaqueJSClass::StaticFunctionsTable* staticFunctions = jsClass->staticFunctions) {
             if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) {
                 if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
-                    JSObject* o = new (exec) JSCallbackFunction(exec, callAsFunction, propertyName);
+                    JSObject* o = new JSCallbackFunction(exec, callAsFunction, propertyName);
                     thisObj->putDirect(propertyName, o, entry->attributes);
                     return o;
                 }
index 8ffeb8c..ee1717c 100644 (file)
@@ -162,7 +162,7 @@ JSObject* OpaqueJSClass::prototype(JSContextRef ctx)
             parentPrototype = parentClass->prototype(ctx); // can be null
         if (!parentPrototype)
             parentPrototype = exec->dynamicGlobalObject()->objectPrototype();
-        cachedPrototype = new (exec) JSCallbackObject<JSObject>(exec, prototypeClass, parentPrototype, this); // set ourself as the object's private data, so it can clear our reference on destruction
+        cachedPrototype = new JSCallbackObject<JSObject>(exec, prototypeClass, parentPrototype, this); // set ourself as the object's private data, so it can clear our reference on destruction
     }
     return cachedPrototype;
 }
index 80dcf57..e9c12aa 100644 (file)
@@ -74,13 +74,13 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data)
     ExecState* exec = toJS(ctx);
 
     if (!jsClass)
-        return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype())); // slightly more efficient
+        return toRef(new JSObject(exec->lexicalGlobalObject()->objectPrototype())); // slightly more efficient
 
     JSValue* jsPrototype = jsClass->prototype(ctx);
     if (!jsPrototype)
         jsPrototype = exec->lexicalGlobalObject()->objectPrototype();
 
-    return toRef(new (exec) JSCallbackObject<JSObject>(exec, jsClass, jsPrototype, data));
+    return toRef(new JSCallbackObject<JSObject>(exec, jsClass, jsPrototype, data));
 }
 
 JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction)
@@ -89,7 +89,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name,
     ExecState* exec = toJS(ctx);
     Identifier nameID = name ? Identifier(toJS(name)) : Identifier("anonymous");
     
-    return toRef(new (exec) JSCallbackFunction(exec, callAsFunction, nameID));
+    return toRef(new JSCallbackFunction(exec, callAsFunction, nameID));
 }
 
 JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor)
@@ -101,7 +101,7 @@ JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObje
         ? jsClass->prototype(ctx)
         : exec->dynamicGlobalObject()->objectPrototype();
     
-    JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec, jsClass, callAsConstructor);
+    JSCallbackConstructor* constructor = new JSCallbackConstructor(exec, jsClass, callAsConstructor);
     constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
     return toRef(constructor);
 }
@@ -118,8 +118,8 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa
     
     List args;
     for (unsigned i = 0; i < parameterCount; i++)
-        args.append(jsString(exec, UString(toJS(parameterNames[i]))));
-    args.append(jsString(exec, UString(bodyRep)));
+        args.append(jsString(UString(toJS(parameterNames[i]))));
+    args.append(jsString(UString(bodyRep)));
 
     JSObject* result = exec->dynamicGlobalObject()->functionConstructor()->construct(exec, args, nameID, UString(sourceURLRep), startingLineNumber);
     if (exec->hadException()) {
index 6ae9a16..468a2d1 100644 (file)
@@ -176,17 +176,17 @@ JSValueRef JSValueMakeBoolean(JSContextRef, bool value)
     return toRef(jsBoolean(value));
 }
 
-JSValueRef JSValueMakeNumber(JSContextRef ctx, double value)
+JSValueRef JSValueMakeNumber(JSContextRef, double value)
 {
     JSLock lock;
-    return toRef(jsNumber(toJS(ctx), value));
+    return toRef(jsNumber(value));
 }
 
-JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string)
+JSValueRef JSValueMakeString(JSContextRef, JSStringRef string)
 {
     JSLock lock;
     UString::Rep* rep = toJS(string);
-    return toRef(jsString(toJS(ctx), UString(rep)));
+    return toRef(jsString(UString(rep)));
 }
 
 bool JSValueToBoolean(JSContextRef ctx, JSValueRef value)
index f425842..9bd4dd3 100644 (file)
@@ -1,3 +1,387 @@
+2008-05-12  Alexey Proskuryakov  <ap@webkit.org>
+
+        Roll out recent  threading changes (r32807, r32810, r32819, r32822) to simplify
+        SquirrelFish merging.
+
+        * API/JSBase.cpp:
+        (JSGarbageCollect):
+        * API/JSCallbackObjectFunctions.h:
+        (KJS::::staticFunctionGetter):
+        * API/JSClassRef.cpp:
+        (OpaqueJSClass::prototype):
+        * API/JSObjectRef.cpp:
+        (JSObjectMake):
+        (JSObjectMakeFunctionWithCallback):
+        (JSObjectMakeConstructor):
+        (JSObjectMakeFunction):
+        * API/JSValueRef.cpp:
+        (JSValueMakeNumber):
+        (JSValueMakeString):
+        * JavaScriptCore.exp:
+        * kjs/ExecState.h:
+        * kjs/InitializeThreading.cpp:
+        (KJS::initializeThreadingOnce):
+        * kjs/JSGlobalObject.cpp:
+        (KJS::JSGlobalObject::~JSGlobalObject):
+        (KJS::JSGlobalObject::init):
+        (KJS::JSGlobalObject::put):
+        (KJS::JSGlobalObject::reset):
+        (KJS::JSGlobalObject::tearOffActivation):
+        * kjs/JSGlobalObject.h:
+        (KJS::JSGlobalObject::head):
+        (KJS::JSGlobalObject::perThreadData):
+        * kjs/JSLock.cpp:
+        (KJS::JSLock::registerThread):
+        * kjs/JSLock.h:
+        (KJS::JSLock::JSLock):
+        * kjs/array_instance.cpp:
+        (KJS::ArrayInstance::ArrayInstance):
+        (KJS::ArrayInstance::lengthGetter):
+        * kjs/array_object.cpp:
+        (KJS::arrayProtoFuncToString):
+        (KJS::arrayProtoFuncToLocaleString):
+        (KJS::arrayProtoFuncJoin):
+        (KJS::arrayProtoFuncConcat):
+        (KJS::arrayProtoFuncPop):
+        (KJS::arrayProtoFuncPush):
+        (KJS::arrayProtoFuncShift):
+        (KJS::arrayProtoFuncSlice):
+        (KJS::arrayProtoFuncSplice):
+        (KJS::arrayProtoFuncUnShift):
+        (KJS::arrayProtoFuncFilter):
+        (KJS::arrayProtoFuncMap):
+        (KJS::arrayProtoFuncEvery):
+        (KJS::arrayProtoFuncForEach):
+        (KJS::arrayProtoFuncSome):
+        (KJS::arrayProtoFuncIndexOf):
+        (KJS::arrayProtoFuncLastIndexOf):
+        (KJS::ArrayObjectImp::ArrayObjectImp):
+        (KJS::ArrayObjectImp::construct):
+        * kjs/bool_object.cpp:
+        (KJS::BooleanPrototype::BooleanPrototype):
+        (KJS::booleanProtoFuncToString):
+        (KJS::BooleanObjectImp::BooleanObjectImp):
+        (KJS::BooleanObjectImp::construct):
+        * kjs/collector.cpp:
+        (KJS::):
+        (KJS::allocateBlock):
+        (KJS::Collector::recordExtraCost):
+        (KJS::Collector::heapAllocate):
+        (KJS::Collector::allocate):
+        (KJS::Collector::allocateNumber):
+        (KJS::Collector::registerAsMainThread):
+        (KJS::onMainThread):
+        (KJS::PlatformThread::PlatformThread):
+        (KJS::getCurrentPlatformThread):
+        (KJS::Collector::Thread::Thread):
+        (KJS::destroyRegisteredThread):
+        (KJS::initializeRegisteredThreadKey):
+        (KJS::Collector::registerThread):
+        (KJS::Collector::markStackObjectsConservatively):
+        (KJS::Collector::markCurrentThreadConservativelyInternal):
+        (KJS::Collector::markCurrentThreadConservatively):
+        (KJS::suspendThread):
+        (KJS::resumeThread):
+        (KJS::getPlatformThreadRegisters):
+        (KJS::otherThreadStackPointer):
+        (KJS::Collector::markOtherThreadConservatively):
+        (KJS::protectedValues):
+        (KJS::Collector::protect):
+        (KJS::Collector::unprotect):
+        (KJS::Collector::collectOnMainThreadOnly):
+        (KJS::Collector::markProtectedObjects):
+        (KJS::Collector::markMainThreadOnlyObjects):
+        (KJS::Collector::sweep):
+        (KJS::Collector::collect):
+        (KJS::Collector::size):
+        (KJS::Collector::globalObjectCount):
+        (KJS::Collector::protectedGlobalObjectCount):
+        (KJS::Collector::protectedObjectCount):
+        (KJS::Collector::protectedObjectTypeCounts):
+        (KJS::Collector::isBusy):
+        (KJS::Collector::reportOutOfMemoryToAllExecStates):
+        * kjs/collector.h:
+        (KJS::):
+        (KJS::Collector::cellBlock):
+        (KJS::Collector::cellOffset):
+        (KJS::Collector::isCellMarked):
+        (KJS::Collector::markCell):
+        (KJS::Collector::reportExtraMemoryCost):
+        * kjs/date_object.cpp:
+        (KJS::formatLocaleDate):
+        (KJS::DatePrototype::DatePrototype):
+        (KJS::DateObjectImp::DateObjectImp):
+        (KJS::DateObjectImp::construct):
+        (KJS::DateObjectImp::callAsFunction):
+        (KJS::DateObjectFuncImp::DateObjectFuncImp):
+        (KJS::DateObjectFuncImp::callAsFunction):
+        (KJS::dateProtoFuncToString):
+        (KJS::dateProtoFuncToUTCString):
+        (KJS::dateProtoFuncToDateString):
+        (KJS::dateProtoFuncToTimeString):
+        (KJS::dateProtoFuncToLocaleString):
+        (KJS::dateProtoFuncToLocaleDateString):
+        (KJS::dateProtoFuncToLocaleTimeString):
+        (KJS::dateProtoFuncValueOf):
+        (KJS::dateProtoFuncGetTime):
+        (KJS::dateProtoFuncGetFullYear):
+        (KJS::dateProtoFuncGetUTCFullYear):
+        (KJS::dateProtoFuncToGMTString):
+        (KJS::dateProtoFuncGetMonth):
+        (KJS::dateProtoFuncGetUTCMonth):
+        (KJS::dateProtoFuncGetDate):
+        (KJS::dateProtoFuncGetUTCDate):
+        (KJS::dateProtoFuncGetDay):
+        (KJS::dateProtoFuncGetUTCDay):
+        (KJS::dateProtoFuncGetHours):
+        (KJS::dateProtoFuncGetUTCHours):
+        (KJS::dateProtoFuncGetMinutes):
+        (KJS::dateProtoFuncGetUTCMinutes):
+        (KJS::dateProtoFuncGetSeconds):
+        (KJS::dateProtoFuncGetUTCSeconds):
+        (KJS::dateProtoFuncGetMilliSeconds):
+        (KJS::dateProtoFuncGetUTCMilliseconds):
+        (KJS::dateProtoFuncGetTimezoneOffset):
+        (KJS::dateProtoFuncSetTime):
+        (KJS::setNewValueFromTimeArgs):
+        (KJS::setNewValueFromDateArgs):
+        (KJS::dateProtoFuncSetYear):
+        (KJS::dateProtoFuncGetYear):
+        * kjs/error_object.cpp:
+        (KJS::ErrorPrototype::ErrorPrototype):
+        (KJS::errorProtoFuncToString):
+        (KJS::ErrorObjectImp::ErrorObjectImp):
+        (KJS::ErrorObjectImp::construct):
+        (KJS::NativeErrorPrototype::NativeErrorPrototype):
+        (KJS::NativeErrorImp::NativeErrorImp):
+        (KJS::NativeErrorImp::construct):
+        * kjs/function.cpp:
+        (KJS::FunctionImp::lengthGetter):
+        (KJS::FunctionImp::construct):
+        (KJS::Arguments::Arguments):
+        (KJS::ActivationImp::createArgumentsObject):
+        (KJS::encode):
+        (KJS::decode):
+        (KJS::globalFuncParseInt):
+        (KJS::globalFuncParseFloat):
+        (KJS::globalFuncEscape):
+        (KJS::globalFuncUnescape):
+        (KJS::PrototypeFunction::PrototypeFunction):
+        (KJS::PrototypeReflexiveFunction::PrototypeReflexiveFunction):
+        * kjs/function_object.cpp:
+        (KJS::FunctionPrototype::FunctionPrototype):
+        (KJS::functionProtoFuncToString):
+        (KJS::FunctionObjectImp::FunctionObjectImp):
+        (KJS::FunctionObjectImp::construct):
+        * kjs/internal.cpp:
+        (KJS::StringImp::toObject):
+        * kjs/internal.h:
+        (KJS::StringImp::StringImp):
+        (KJS::NumberImp::operator new):
+        * kjs/list.cpp:
+        (KJS::List::markSet):
+        (KJS::List::markProtectedListsSlowCase):
+        (KJS::List::expandAndAppend):
+        * kjs/list.h:
+        (KJS::List::List):
+        (KJS::List::~List):
+        (KJS::List::markProtectedLists):
+        * kjs/lookup.h:
+        (KJS::staticFunctionGetter):
+        (KJS::cacheGlobalObject):
+        * kjs/math_object.cpp:
+        (KJS::MathObjectImp::getValueProperty):
+        (KJS::mathProtoFuncAbs):
+        (KJS::mathProtoFuncACos):
+        (KJS::mathProtoFuncASin):
+        (KJS::mathProtoFuncATan):
+        (KJS::mathProtoFuncATan2):
+        (KJS::mathProtoFuncCeil):
+        (KJS::mathProtoFuncCos):
+        (KJS::mathProtoFuncExp):
+        (KJS::mathProtoFuncFloor):
+        (KJS::mathProtoFuncLog):
+        (KJS::mathProtoFuncMax):
+        (KJS::mathProtoFuncMin):
+        (KJS::mathProtoFuncPow):
+        (KJS::mathProtoFuncRandom):
+        (KJS::mathProtoFuncRound):
+        (KJS::mathProtoFuncSin):
+        (KJS::mathProtoFuncSqrt):
+        (KJS::mathProtoFuncTan):
+        * kjs/nodes.cpp:
+        (KJS::ParserRefCounted::ParserRefCounted):
+        (KJS::ParserRefCounted::ref):
+        (KJS::ParserRefCounted::deref):
+        (KJS::ParserRefCounted::refcount):
+        (KJS::ParserRefCounted::deleteNewObjects):
+        (KJS::Node::handleException):
+        (KJS::NumberNode::evaluate):
+        (KJS::StringNode::evaluate):
+        (KJS::ArrayNode::evaluate):
+        (KJS::PostIncResolveNode::evaluate):
+        (KJS::PostIncLocalVarNode::evaluate):
+        (KJS::PostDecResolveNode::evaluate):
+        (KJS::PostDecLocalVarNode::evaluate):
+        (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
+        (KJS::PostIncBracketNode::evaluate):
+        (KJS::PostDecBracketNode::evaluate):
+        (KJS::PostIncDotNode::evaluate):
+        (KJS::PostDecDotNode::evaluate):
+        (KJS::typeStringForValue):
+        (KJS::LocalVarTypeOfNode::evaluate):
+        (KJS::TypeOfResolveNode::evaluate):
+        (KJS::TypeOfValueNode::evaluate):
+        (KJS::PreIncLocalVarNode::evaluate):
+        (KJS::PreIncResolveNode::evaluate):
+        (KJS::PreDecLocalVarNode::evaluate):
+        (KJS::PreDecResolveNode::evaluate):
+        (KJS::PreIncConstNode::evaluate):
+        (KJS::PreDecConstNode::evaluate):
+        (KJS::PostIncConstNode::evaluate):
+        (KJS::PostDecConstNode::evaluate):
+        (KJS::PreIncBracketNode::evaluate):
+        (KJS::PreDecBracketNode::evaluate):
+        (KJS::PreIncDotNode::evaluate):
+        (KJS::PreDecDotNode::evaluate):
+        (KJS::NegateNode::evaluate):
+        (KJS::BitwiseNotNode::evaluate):
+        (KJS::MultNode::evaluate):
+        (KJS::DivNode::evaluate):
+        (KJS::ModNode::evaluate):
+        (KJS::addSlowCase):
+        (KJS::add):
+        (KJS::AddNumbersNode::evaluate):
+        (KJS::AddStringsNode::evaluate):
+        (KJS::AddStringLeftNode::evaluate):
+        (KJS::AddStringRightNode::evaluate):
+        (KJS::SubNode::evaluate):
+        (KJS::LeftShiftNode::evaluate):
+        (KJS::RightShiftNode::evaluate):
+        (KJS::UnsignedRightShiftNode::evaluate):
+        (KJS::BitXOrNode::evaluate):
+        (KJS::BitOrNode::evaluate):
+        (KJS::valueForReadModifyAssignment):
+        (KJS::ForInNode::execute):
+        (KJS::TryNode::execute):
+        (KJS::FuncDeclNode::makeFunction):
+        (KJS::FuncExprNode::evaluate):
+        * kjs/nodes.h:
+        * kjs/number_object.cpp:
+        (KJS::NumberPrototype::NumberPrototype):
+        (KJS::numberProtoFuncToString):
+        (KJS::numberProtoFuncToLocaleString):
+        (KJS::numberProtoFuncToFixed):
+        (KJS::numberProtoFuncToExponential):
+        (KJS::numberProtoFuncToPrecision):
+        (KJS::NumberObjectImp::NumberObjectImp):
+        (KJS::NumberObjectImp::getValueProperty):
+        (KJS::NumberObjectImp::construct):
+        (KJS::NumberObjectImp::callAsFunction):
+        * kjs/object.cpp:
+        (KJS::JSObject::call):
+        (KJS::JSObject::get):
+        (KJS::JSObject::put):
+        (KJS::JSObject::defineGetter):
+        (KJS::JSObject::defineSetter):
+        (KJS::JSObject::putDirect):
+        (KJS::Error::create):
+        * kjs/object.h:
+        * kjs/object_object.cpp:
+        (KJS::ObjectPrototype::ObjectPrototype):
+        (KJS::objectProtoFuncToLocaleString):
+        (KJS::objectProtoFuncToString):
+        (KJS::ObjectObjectImp::ObjectObjectImp):
+        (KJS::ObjectObjectImp::construct):
+        * kjs/property_map.h:
+        (KJS::SavedProperty::SavedProperty):
+        (KJS::SavedProperty::init):
+        (KJS::SavedProperty::~SavedProperty):
+        (KJS::SavedProperty::name):
+        (KJS::SavedProperty::value):
+        (KJS::SavedProperty::attributes):
+        * kjs/protect.h:
+        (KJS::gcProtect):
+        (KJS::gcUnprotect):
+        * kjs/regexp_object.cpp:
+        (KJS::RegExpPrototype::RegExpPrototype):
+        (KJS::regExpProtoFuncToString):
+        (KJS::RegExpImp::getValueProperty):
+        (KJS::RegExpObjectImp::RegExpObjectImp):
+        (KJS::RegExpObjectImp::arrayOfMatches):
+        (KJS::RegExpObjectImp::getBackref):
+        (KJS::RegExpObjectImp::getLastParen):
+        (KJS::RegExpObjectImp::getLeftContext):
+        (KJS::RegExpObjectImp::getRightContext):
+        (KJS::RegExpObjectImp::getValueProperty):
+        (KJS::RegExpObjectImp::createRegExpImp):
+        * kjs/regexp_object.h:
+        * kjs/string_object.cpp:
+        (KJS::StringInstance::StringInstance):
+        (KJS::StringInstance::lengthGetter):
+        (KJS::StringInstance::indexGetter):
+        (KJS::stringInstanceNumericPropertyGetter):
+        (KJS::StringPrototype::StringPrototype):
+        (KJS::replace):
+        (KJS::stringProtoFuncCharAt):
+        (KJS::stringProtoFuncCharCodeAt):
+        (KJS::stringProtoFuncConcat):
+        (KJS::stringProtoFuncIndexOf):
+        (KJS::stringProtoFuncLastIndexOf):
+        (KJS::stringProtoFuncMatch):
+        (KJS::stringProtoFuncSearch):
+        (KJS::stringProtoFuncReplace):
+        (KJS::stringProtoFuncSlice):
+        (KJS::stringProtoFuncSplit):
+        (KJS::stringProtoFuncSubstr):
+        (KJS::stringProtoFuncSubstring):
+        (KJS::stringProtoFuncToLowerCase):
+        (KJS::stringProtoFuncToUpperCase):
+        (KJS::stringProtoFuncToLocaleLowerCase):
+        (KJS::stringProtoFuncToLocaleUpperCase):
+        (KJS::stringProtoFuncLocaleCompare):
+        (KJS::stringProtoFuncBig):
+        (KJS::stringProtoFuncSmall):
+        (KJS::stringProtoFuncBlink):
+        (KJS::stringProtoFuncBold):
+        (KJS::stringProtoFuncFixed):
+        (KJS::stringProtoFuncItalics):
+        (KJS::stringProtoFuncStrike):
+        (KJS::stringProtoFuncSub):
+        (KJS::stringProtoFuncSup):
+        (KJS::stringProtoFuncFontcolor):
+        (KJS::stringProtoFuncFontsize):
+        (KJS::stringProtoFuncAnchor):
+        (KJS::stringProtoFuncLink):
+        (KJS::StringObjectImp::StringObjectImp):
+        (KJS::StringObjectImp::construct):
+        (KJS::StringObjectImp::callAsFunction):
+        (KJS::StringObjectFuncImp::StringObjectFuncImp):
+        (KJS::StringObjectFuncImp::callAsFunction):
+        * kjs/string_object.h:
+        (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
+        * kjs/testkjs.cpp:
+        (GlobalObject::GlobalObject):
+        (functionGC):
+        (functionRun):
+        (functionReadline):
+        (kjsmain):
+        * kjs/ustring.h:
+        * kjs/value.cpp:
+        (KJS::JSCell::operator new):
+        (KJS::jsString):
+        (KJS::jsOwnedString):
+        (KJS::jsNumberCell):
+        * kjs/value.h:
+        (KJS::jsNaN):
+        (KJS::jsNumber):
+        (KJS::jsNumberFromAnd):
+        (KJS::JSCell::marked):
+        (KJS::JSCell::mark):
+        (KJS::JSValue::toJSNumber):
+        * wtf/ThreadSpecific.h:
+        (WTF::T):
+
 2008-05-10  Julien Chaffraix  <jchaffraix@webkit.org>
 
         Qt & wx build fix.
index db459f5..7ac3f9f 100644 (file)
@@ -1,3 +1,78 @@
+_JSCheckScriptSyntax
+_JSClassCreate
+_JSClassRelease
+_JSClassRetain
+_JSContextGetGlobalObject
+_JSEvaluateScript
+_JSGarbageCollect
+_JSGlobalContextCreate
+_JSGlobalContextRelease
+_JSGlobalContextRetain
+_JSObjectCallAsConstructor
+_JSObjectCallAsFunction
+_JSObjectCopyPropertyNames
+_JSObjectDeleteProperty
+_JSObjectGetPrivate
+_JSObjectGetProperty
+_JSObjectGetPropertyAtIndex
+_JSObjectGetPrototype
+_JSObjectHasProperty
+_JSObjectIsConstructor
+_JSObjectIsFunction
+_JSObjectMake
+_JSObjectMakeConstructor
+_JSObjectMakeFunction
+_JSObjectMakeFunctionWithCallback
+_JSObjectSetPrivate
+_JSObjectSetProperty
+_JSObjectSetPropertyAtIndex
+_JSObjectSetPrototype
+_JSPropertyNameAccumulatorAddName
+_JSPropertyNameArrayGetCount
+_JSPropertyNameArrayGetNameAtIndex
+_JSPropertyNameArrayRelease
+_JSPropertyNameArrayRetain
+_JSStringCopyCFString
+_JSStringCreateWithCFString
+_JSStringCreateWithCharacters
+_JSStringCreateWithUTF8CString
+_JSStringGetCharactersPtr
+_JSStringGetLength
+_JSStringGetMaximumUTF8CStringSize
+_JSStringGetUTF8CString
+_JSStringIsEqual
+_JSStringIsEqualToUTF8CString
+_JSStringRelease
+_JSStringRetain
+_JSValueGetType
+_JSValueIsBoolean
+_JSValueIsEqual
+_JSValueIsInstanceOfConstructor
+_JSValueIsNull
+_JSValueIsNumber
+_JSValueIsObject
+_JSValueIsObjectOfClass
+_JSValueIsStrictEqual
+_JSValueIsString
+_JSValueIsUndefined
+_JSValueMakeBoolean
+_JSValueMakeNull
+_JSValueMakeNumber
+_JSValueMakeString
+_JSValueMakeUndefined
+_JSValueProtect
+_JSValueToBoolean
+_JSValueToNumber
+_JSValueToObject
+_JSValueToStringCopy
+_JSValueUnprotect
+_WTFLog
+_WTFLogVerbose
+_WTFReportArgumentAssertionFailure
+_WTFReportAssertionFailure
+_WTFReportAssertionFailureWithMessage
+_WTFReportError
+_WTFReportFatalError
 __Z12jsRegExpFreeP8JSRegExp
 __Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
 __Z15jsRegExpExecutePK8JSRegExpPKtiiPii
@@ -21,11 +96,11 @@ __ZN3KJS11PropertyMap11getLocationERKNS_10IdentifierE
 __ZN3KJS11PropertyMap5clearEv
 __ZN3KJS11PropertyMapD1Ev
 __ZN3KJS12DateInstance4infoE
-__ZN3KJS12jsNumberCellEPNS_9ExecStateEd
 __ZN3KJS12PropertySlot15undefinedGetterEPNS_9ExecStateEPNS_8JSObjectERKNS_10IdentifierERKS0_
+__ZN3KJS12jsNumberCellEd
 __ZN3KJS13ArrayInstance4infoE
-__ZN3KJS13jsOwnedStringEPNS_9ExecStateERKNS_7UStringE
 __ZN3KJS13StatementNode6setLocEii
+__ZN3KJS13jsOwnedStringERKNS_7UStringE
 __ZN3KJS14JSGlobalObject10globalExecEv
 __ZN3KJS14JSGlobalObject16stopTimeoutCheckEv
 __ZN3KJS14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
@@ -36,14 +111,14 @@ __ZN3KJS14JSGlobalObject4initEPNS_8JSObjectE
 __ZN3KJS14JSGlobalObject4markEv
 __ZN3KJS14JSGlobalObject5resetEPNS_7JSValueE
 __ZN3KJS14JSGlobalObjectD2Ev
-__ZN3KJS14JSGlobalObjectnwEm
 __ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
 __ZN3KJS14StringInstance16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
-__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
 __ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
 __ZN3KJS14StringInstance3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
 __ZN3KJS14StringInstance4infoE
-__ZN3KJS14StringInstanceC2EPNS_9ExecStateEPNS_8JSObjectERKNS_7UStringE
+__ZN3KJS14StringInstanceC1EPNS_8JSObjectERKNS_7UStringE
+__ZN3KJS14StringInstanceC2EPNS_8JSObjectERKNS_7UStringE
 __ZN3KJS15GlobalExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectE
 __ZN3KJS15GlobalExecStateD1Ev
 __ZN3KJS15JSWrapperObject4markEv
@@ -52,47 +127,37 @@ __ZN3KJS16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameAr
 __ZN3KJS16ParserRefCounted3refEv
 __ZN3KJS16ParserRefCounted5derefEv
 __ZN3KJS17PropertyNameArray3addEPNS_7UString3RepE
-__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
 __ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
-__ZN3KJS19initializeThreadingEv
+__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
 __ZN3KJS19InternalFunctionImp4infoE
 __ZN3KJS19InternalFunctionImpC2EPNS_17FunctionPrototypeERKNS_10IdentifierE
+__ZN3KJS19initializeThreadingEv
 __ZN3KJS23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectERKNS_4ListE
-__ZN3KJS4Heap10threadHeapEv
-__ZN3KJS4Heap15recordExtraCostEm
-__ZN3KJS4Heap17globalObjectCountEv
-__ZN3KJS4Heap20protectedObjectCountEv
-__ZN3KJS4Heap25protectedObjectTypeCountsEv
-__ZN3KJS4Heap26protectedGlobalObjectCountEv
-__ZN3KJS4Heap4heapEPKNS_7JSValueE
-__ZN3KJS4Heap4sizeEv
-__ZN3KJS4Heap7collectEv
-__ZN3KJS4Heap7protectEPNS_7JSValueE
-__ZN3KJS4Heap8allocateEm
-__ZN3KJS4Heap9unprotectEPNS_7JSValueE
 __ZN3KJS4List15expandAndAppendEPNS_7JSValueE
+__ZN3KJS4List7markSetEv
 __ZN3KJS6JSCell9getObjectEv
-__ZN3KJS6JSCellnwEmPNS_9ExecStateE
+__ZN3KJS6JSCellnwEm
 __ZN3KJS6JSLock12DropAllLocksC1Ev
 __ZN3KJS6JSLock12DropAllLocksD1Ev
+__ZN3KJS6JSLock14registerThreadEv
 __ZN3KJS6JSLock4lockEv
 __ZN3KJS6JSLock6unlockEv
 __ZN3KJS6JSLock9lockCountEv
 __ZN3KJS6Parser5parseEiPKtjPiS3_PNS_7UStringE
 __ZN3KJS6parserEv
 __ZN3KJS6strtodEPKcPPc
-__ZN3KJS7CStringaSERKS0_
 __ZN3KJS7CStringD1Ev
+__ZN3KJS7CStringaSERKS0_
 __ZN3KJS7UString3Rep11computeHashEPKti
 __ZN3KJS7UString3Rep4nullE
 __ZN3KJS7UString3Rep7destroyEv
 __ZN3KJS7UString4fromEj
 __ZN3KJS7UString6appendEPKc
 __ZN3KJS7UString6appendERKS0_
-__ZN3KJS7UStringaSEPKc
 __ZN3KJS7UStringC1EPKc
 __ZN3KJS7UStringC1EPKti
 __ZN3KJS7UStringC1ERKS0_S2_
+__ZN3KJS7UStringaSEPKc
 __ZN3KJS8Debugger12sourceUnusedEPNS_9ExecStateEi
 __ZN3KJS8Debugger6attachEPNS_14JSGlobalObjectE
 __ZN3KJS8Debugger6detachEPNS_14JSGlobalObjectE
@@ -106,27 +171,38 @@ __ZN3KJS8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
 __ZN3KJS8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE
 __ZN3KJS8JSObject12removeDirectERKNS_10IdentifierE
 __ZN3KJS8JSObject14callAsFunctionEPNS_9ExecStateEPS0_RKNS_4ListE
-__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
 __ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
 __ZN3KJS8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
 __ZN3KJS8JSObject17putDirectFunctionEPNS_19InternalFunctionImpEi
-__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
 __ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
+__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
 __ZN3KJS8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
 __ZN3KJS8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRPNS_7JSValueE
 __ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
-__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
 __ZN3KJS8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
+__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
 __ZN3KJS8JSObject4callEPNS_9ExecStateEPS0_RKNS_4ListE
 __ZN3KJS8JSObject4markEv
 __ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListE
 __ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListERKNS_10IdentifierERKNS_7UStringEi
 __ZN3KJS8JSObject9putDirectERKNS_10IdentifierEPNS_7JSValueEi
-__ZN3KJS8jsStringEPNS_9ExecStateEPKc
-__ZN3KJS8jsStringEPNS_9ExecStateERKNS_7UStringE
+__ZN3KJS8JSObject9putDirectERKNS_10IdentifierEii
 __ZN3KJS8Profiler13stopProfilingEv
 __ZN3KJS8Profiler14startProfilingEjRKNS_7UStringE
 __ZN3KJS8Profiler8profilerEv
+__ZN3KJS8jsStringEPKc
+__ZN3KJS8jsStringERKNS_7UStringE
+__ZN3KJS9Collector15recordExtraCostEm
+__ZN3KJS9Collector17globalObjectCountEv
+__ZN3KJS9Collector20protectedObjectCountEv
+__ZN3KJS9Collector23collectOnMainThreadOnlyEPNS_7JSValueE
+__ZN3KJS9Collector25protectedObjectTypeCountsEv
+__ZN3KJS9Collector26protectedGlobalObjectCountEv
+__ZN3KJS9Collector4sizeEv
+__ZN3KJS9Collector7collectEv
+__ZN3KJS9Collector7protectEPNS_7JSValueE
+__ZN3KJS9Collector9unprotectEPNS_7JSValueE
 __ZN3KJSeqERKNS_7UStringEPKc
 __ZN3WTF10fastCallocEmm
 __ZN3WTF10fastMallocEm
@@ -184,8 +260,8 @@ __ZNK3KJS7UString5asciiEv
 __ZNK3KJS7UString6is8BitEv
 __ZNK3KJS7UString8toUInt32EPb
 __ZNK3KJS7UString8toUInt32EPbb
-__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
 __ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
 __ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
 __ZNK3KJS8JSObject12toThisObjectEPNS_9ExecStateE
 __ZNK3KJS8JSObject14implementsCallEv
@@ -193,8 +269,8 @@ __ZNK3KJS8JSObject14toGlobalObjectEPNS_9ExecStateE
 __ZNK3KJS8JSObject19implementsConstructEv
 __ZNK3KJS8JSObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
 __ZNK3KJS8JSObject21implementsHasInstanceEv
-__ZNK3KJS8JSObject3getEPNS_9ExecStateEj
 __ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE
+__ZNK3KJS8JSObject3getEPNS_9ExecStateEj
 __ZNK3KJS8JSObject4typeEv
 __ZNK3KJS8JSObject8toNumberEPNS_9ExecStateE
 __ZNK3KJS8JSObject8toObjectEPNS_9ExecStateE
@@ -212,81 +288,6 @@ __ZTVN3KJS15JSWrapperObjectE
 __ZTVN3KJS16JSVariableObjectE
 __ZTVN3KJS19InternalFunctionImpE
 __ZTVN3KJS8JSObjectE
-_JSCheckScriptSyntax
-_JSClassCreate
-_JSClassRelease
-_JSClassRetain
-_JSContextGetGlobalObject
 _jscore_collector_introspection
 _jscore_fastmalloc_introspection
-_JSEvaluateScript
-_JSGarbageCollect
-_JSGlobalContextCreate
-_JSGlobalContextRelease
-_JSGlobalContextRetain
-_JSObjectCallAsConstructor
-_JSObjectCallAsFunction
-_JSObjectCopyPropertyNames
-_JSObjectDeleteProperty
-_JSObjectGetPrivate
-_JSObjectGetProperty
-_JSObjectGetPropertyAtIndex
-_JSObjectGetPrototype
-_JSObjectHasProperty
-_JSObjectIsConstructor
-_JSObjectIsFunction
-_JSObjectMake
-_JSObjectMakeConstructor
-_JSObjectMakeFunction
-_JSObjectMakeFunctionWithCallback
-_JSObjectSetPrivate
-_JSObjectSetProperty
-_JSObjectSetPropertyAtIndex
-_JSObjectSetPrototype
-_JSPropertyNameAccumulatorAddName
-_JSPropertyNameArrayGetCount
-_JSPropertyNameArrayGetNameAtIndex
-_JSPropertyNameArrayRelease
-_JSPropertyNameArrayRetain
-_JSStringCopyCFString
-_JSStringCreateWithCFString
-_JSStringCreateWithCharacters
-_JSStringCreateWithUTF8CString
-_JSStringGetCharactersPtr
-_JSStringGetLength
-_JSStringGetMaximumUTF8CStringSize
-_JSStringGetUTF8CString
-_JSStringIsEqual
-_JSStringIsEqualToUTF8CString
-_JSStringRelease
-_JSStringRetain
-_JSValueGetType
-_JSValueIsBoolean
-_JSValueIsEqual
-_JSValueIsInstanceOfConstructor
-_JSValueIsNull
-_JSValueIsNumber
-_JSValueIsObject
-_JSValueIsObjectOfClass
-_JSValueIsStrictEqual
-_JSValueIsString
-_JSValueIsUndefined
-_JSValueMakeBoolean
-_JSValueMakeNull
-_JSValueMakeNumber
-_JSValueMakeString
-_JSValueMakeUndefined
-_JSValueProtect
-_JSValueToBoolean
-_JSValueToNumber
-_JSValueToObject
-_JSValueToStringCopy
-_JSValueUnprotect
 _kJSClassDefinitionEmpty
-_WTFLog
-_WTFLogVerbose
-_WTFReportArgumentAssertionFailure
-_WTFReportAssertionFailure
-_WTFReportAssertionFailureWithMessage
-_WTFReportError
-_WTFReportFatalError
index 6855ec3..0947703 100644 (file)
@@ -58,10 +58,6 @@ namespace KJS  {
 
         CommonIdentifiers* propertyNames;
         List emptyList;
-        
-        Heap* heap;
-
-        unsigned functionCallDepth;
     };
 
     // Represents the current state of script execution.
@@ -124,10 +120,6 @@ namespace KJS  {
         static const HashTable* RegExpObjectImpTable(ExecState* exec) { return exec->m_perThreadData->RegExpObjectImpTable; }
         static const HashTable* stringTable(ExecState* exec) { return exec->m_perThreadData->stringTable; }
 
-        Heap* heap() const { return m_perThreadData->heap; }
-
-        unsigned& functionCallDepth() { return m_perThreadData->functionCallDepth; }
-
         LocalStorage& localStorage() { return *m_localStorage; }
         void setLocalStorage(LocalStorage* s) { m_localStorage = s; }
 
@@ -208,7 +200,7 @@ namespace KJS  {
 
         ExecState* m_callingExec;
 
-        PerThreadData* m_perThreadData;
+        const PerThreadData* m_perThreadData;
 
         ScopeNode* m_scopeNode;
         
index ce4ca6b..f69a21a 100644 (file)
@@ -35,7 +35,6 @@
 #include "identifier.h"
 #include "JSGlobalObject.h"
 #include "lexer.h"
-#include "nodes.h"
 #include "Parser.h"
 #include "ustring.h"
 #include <wtf/Threading.h>
@@ -51,7 +50,9 @@ static void initializeThreadingOnce()
     WTF::initializeThreading();
 #if USE(MULTIPLE_THREADS)
     s_dtoaP5Mutex = new Mutex;
-    Heap::threadHeap();
+#if !PLATFORM(DARWIN) // Darwin has pthread_main_np(), and doesn't need registerAsMainThread() called.
+    Collector::registerAsMainThread();
+#endif
     UString::null();
     Identifier::initializeIdentifierThreading();
     CommonIdentifiers::shared();
@@ -59,7 +60,6 @@ static void initializeThreadingOnce()
     initDateMath();
     JSGlobalObject::threadClassInfoHashTables();
     JSGlobalObject::head();
-    initializeNodesThreading();
 #endif
 }
 
index c0037b8..37ebdcd 100644 (file)
@@ -102,6 +102,8 @@ static inline unsigned getCurrentTime()
 #endif
 }
 
+JSGlobalObject* JSGlobalObject::s_head = 0;
+
 void JSGlobalObject::deleteActivationStack()
 {
     ActivationStackNode* prevNode = 0;
@@ -120,11 +122,9 @@ JSGlobalObject::~JSGlobalObject()
 
     d()->next->d()->prev = d()->prev;
     d()->prev->d()->next = d()->next;
-    JSGlobalObject*& headObject = head();
-    if (headObject == this)
-        headObject = d()->next;
-    if (headObject == this)
-        headObject = 0;
+    s_head = d()->next;
+    if (s_head == this)
+        s_head = 0;
     
     deleteActivationStack();
     
@@ -186,28 +186,17 @@ ThreadClassInfoHashTables* JSGlobalObject::threadClassInfoHashTables()
 #endif
 }
 
-JSGlobalObject*& JSGlobalObject::head()
-{
-#if USE(MULTIPLE_THREADS)
-    static ThreadSpecific<JSGlobalObject*> sharedInstance;
-    return *sharedInstance;
-#else
-    static JSGlobalObject* sharedInstance;
-    return sharedInstance;
-#endif
-}
-
 void JSGlobalObject::init(JSObject* thisValue)
 {
     ASSERT(JSLock::currentThreadIsHoldingLock());
 
-    if (JSGlobalObject*& headObject = head()) {
-        d()->prev = headObject;
-        d()->next = headObject->d()->next;
-        headObject->d()->next->d()->prev = this;
-        headObject->d()->next = this;
+    if (s_head) {
+        d()->prev = s_head;
+        d()->next = s_head->d()->next;
+        s_head->d()->next->d()->prev = this;
+        s_head->d()->next = this;
     } else
-        headObject = d()->next = d()->prev = this;
+        s_head = d()->next = d()->prev = this;
 
     resetTimeoutCheck();
     d()->timeoutTime = 0;
@@ -229,8 +218,6 @@ void JSGlobalObject::init(JSObject* thisValue)
     d()->perThreadData.RegExpObjectImpTable = &threadClassInfoHashTables()->RegExpObjectImpTable;
     d()->perThreadData.stringTable = &threadClassInfoHashTables()->stringTable;
     d()->perThreadData.propertyNames = CommonIdentifiers::shared();
-    d()->perThreadData.heap = Heap::threadHeap();
-    d()->perThreadData.functionCallDepth = 0;
 
     d()->globalExec.set(new GlobalExecState(this, thisValue));
 
@@ -248,8 +235,6 @@ bool JSGlobalObject::getOwnPropertySlot(ExecState* exec, const Identifier& prope
 
 void JSGlobalObject::put(ExecState* exec, const Identifier& propertyName, JSValue* value)
 {
-    ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
-
     if (symbolTablePut(propertyName, value))
         return;
     return JSVariableObject::put(exec, propertyName, value);
@@ -328,42 +313,42 @@ void JSGlobalObject::reset(JSValue* prototype)
     ExecState* exec = d()->globalExec.get();
 
     // Prototypes
-    d()->functionPrototype = new (exec) FunctionPrototype(exec);
-    d()->objectPrototype = new (exec) ObjectPrototype(exec, d()->functionPrototype);
+    d()->functionPrototype = new FunctionPrototype(exec);
+    d()->objectPrototype = new ObjectPrototype(exec, d()->functionPrototype);
     d()->functionPrototype->setPrototype(d()->objectPrototype);
 
-    d()->arrayPrototype = new (exec) ArrayPrototype(exec, d()->objectPrototype);
-    d()->stringPrototype = new (exec) StringPrototype(exec, d()->objectPrototype);
-    d()->booleanPrototype = new (exec) BooleanPrototype(exec, d()->objectPrototype, d()->functionPrototype);
-    d()->numberPrototype = new (exec) NumberPrototype(exec, d()->objectPrototype, d()->functionPrototype);
-    d()->datePrototype = new (exec) DatePrototype(exec, d()->objectPrototype);
-    d()->regExpPrototype = new (exec) RegExpPrototype(exec, d()->objectPrototype, d()->functionPrototype);
-    d()->errorPrototype = new (exec) ErrorPrototype(exec, d()->objectPrototype, d()->functionPrototype);
+    d()->arrayPrototype = new ArrayPrototype(exec, d()->objectPrototype);
+    d()->stringPrototype = new StringPrototype(exec, d()->objectPrototype);
+    d()->booleanPrototype = new BooleanPrototype(exec, d()->objectPrototype, d()->functionPrototype);
+    d()->numberPrototype = new NumberPrototype(exec, d()->objectPrototype, d()->functionPrototype);
+    d()->datePrototype = new DatePrototype(exec, d()->objectPrototype);
+    d()->regExpPrototype = new RegExpPrototype(exec, d()->objectPrototype, d()->functionPrototype);
+    d()->errorPrototype = new ErrorPrototype(exec, d()->objectPrototype, d()->functionPrototype);
     
-    d()->evalErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "EvalError", "EvalError");
-    d()->rangeErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "RangeError", "RangeError");
-    d()->referenceErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "ReferenceError", "ReferenceError");
-    d()->syntaxErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "SyntaxError", "SyntaxError");
-    d()->typeErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "TypeError", "TypeError");
-    d()->URIErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "URIError", "URIError");
+    d()->evalErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "EvalError", "EvalError");
+    d()->rangeErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "RangeError", "RangeError");
+    d()->referenceErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "ReferenceError", "ReferenceError");
+    d()->syntaxErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "SyntaxError", "SyntaxError");
+    d()->typeErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "TypeError", "TypeError");
+    d()->URIErrorPrototype = new NativeErrorPrototype(exec, d()->errorPrototype, "URIError", "URIError");
 
     // Constructors
-    d()->objectConstructor = new (exec) ObjectObjectImp(exec, d()->objectPrototype, d()->functionPrototype);
-    d()->functionConstructor = new (exec) FunctionObjectImp(exec, d()->functionPrototype);
-    d()->arrayConstructor = new (exec) ArrayObjectImp(exec, d()->functionPrototype, d()->arrayPrototype);
-    d()->stringConstructor = new (exec) StringObjectImp(exec, d()->functionPrototype, d()->stringPrototype);
-    d()->booleanConstructor = new (exec) BooleanObjectImp(exec, d()->functionPrototype, d()->booleanPrototype);
-    d()->numberConstructor = new (exec) NumberObjectImp(exec, d()->functionPrototype, d()->numberPrototype);
-    d()->dateConstructor = new (exec) DateObjectImp(exec, d()->functionPrototype, d()->datePrototype);
-    d()->regExpConstructor = new (exec) RegExpObjectImp(exec, d()->functionPrototype, d()->regExpPrototype);
-    d()->errorConstructor = new (exec) ErrorObjectImp(exec, d()->functionPrototype, d()->errorPrototype);
+    d()->objectConstructor = new ObjectObjectImp(exec, d()->objectPrototype, d()->functionPrototype);
+    d()->functionConstructor = new FunctionObjectImp(exec, d()->functionPrototype);
+    d()->arrayConstructor = new ArrayObjectImp(exec, d()->functionPrototype, d()->arrayPrototype);
+    d()->stringConstructor = new StringObjectImp(exec, d()->functionPrototype, d()->stringPrototype);
+    d()->booleanConstructor = new BooleanObjectImp(exec, d()->functionPrototype, d()->booleanPrototype);
+    d()->numberConstructor = new NumberObjectImp(exec, d()->functionPrototype, d()->numberPrototype);
+    d()->dateConstructor = new DateObjectImp(exec, d()->functionPrototype, d()->datePrototype);
+    d()->regExpConstructor = new RegExpObjectImp(exec, d()->functionPrototype, d()->regExpPrototype);
+    d()->errorConstructor = new ErrorObjectImp(exec, d()->functionPrototype, d()->errorPrototype);
     
-    d()->evalErrorConstructor = new (exec) NativeErrorImp(exec, d()->functionPrototype, d()->evalErrorPrototype);
-    d()->rangeErrorConstructor = new (exec) NativeErrorImp(exec, d()->functionPrototype, d()->rangeErrorPrototype);
-    d()->referenceErrorConstructor = new (exec) NativeErrorImp(exec, d()->functionPrototype, d()->referenceErrorPrototype);
-    d()->syntaxErrorConstructor = new (exec) NativeErrorImp(exec, d()->functionPrototype, d()->syntaxErrorPrototype);
-    d()->typeErrorConstructor = new (exec) NativeErrorImp(exec, d()->functionPrototype, d()->typeErrorPrototype);
-    d()->URIErrorConstructor = new (exec) NativeErrorImp(exec, d()->functionPrototype, d()->URIErrorPrototype);
+    d()->evalErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->evalErrorPrototype);
+    d()->rangeErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->rangeErrorPrototype);
+    d()->referenceErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->referenceErrorPrototype);
+    d()->syntaxErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->syntaxErrorPrototype);
+    d()->typeErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->typeErrorPrototype);
+    d()->URIErrorConstructor = new NativeErrorImp(exec, d()->functionPrototype, d()->URIErrorPrototype);
     
     d()->functionPrototype->putDirect(exec->propertyNames().constructor, d()->functionConstructor, DontEnum);
 
@@ -405,15 +390,15 @@ void JSGlobalObject::reset(JSValue* prototype)
 
     // Set global values.
     Identifier mathIdent = "Math";
-    JSValue* mathObject = new (exec) MathObjectImp(exec, d()->objectPrototype);
+    JSValue* mathObject = new MathObjectImp(exec, d()->objectPrototype);
     symbolTableInsert(mathIdent, mathObject, DontEnum | DontDelete);
     
     Identifier nanIdent = "NaN";
-    JSValue* nanValue = jsNaN(exec);
+    JSValue* nanValue = jsNaN();
     symbolTableInsert(nanIdent, nanValue, DontEnum | DontDelete);
     
     Identifier infinityIdent = "Infinity";
-    JSValue* infinityValue = jsNumber(exec, Inf);
+    JSValue* infinityValue = jsNumber(Inf);
     symbolTableInsert(infinityIdent, infinityValue, DontEnum | DontDelete);
     
     Identifier undefinedIdent = "undefined";
@@ -422,20 +407,20 @@ void JSGlobalObject::reset(JSValue* prototype)
 
     // Set global functions.
 
-    d()->evalFunction = new (exec) PrototypeReflexiveFunction(exec, d()->functionPrototype, 1, exec->propertyNames().eval, globalFuncEval, this);
+    d()->evalFunction = new PrototypeReflexiveFunction(exec, d()->functionPrototype, 1, exec->propertyNames().eval, globalFuncEval, this);
     putDirectFunction(d()->evalFunction, DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 2, "parseInt", globalFuncParseInt), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "parseFloat", globalFuncParseFloat), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "isNaN", globalFuncIsNaN), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "isFinite", globalFuncIsFinite), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "escape", globalFuncEscape), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "unescape", globalFuncUnescape), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "decodeURI", globalFuncDecodeURI), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "decodeURIComponent", globalFuncDecodeURIComponent), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "encodeURI", globalFuncEncodeURI), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "encodeURIComponent", globalFuncEncodeURIComponent), 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);
 #ifndef NDEBUG
-    putDirectFunction(new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, "kjsprint", globalFuncKJSPrint), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, d()->functionPrototype, 1, "kjsprint", globalFuncKJSPrint), DontEnum);
 #endif
 
     // Set prototype, and also insert the object prototype at the end of the chain.
@@ -566,7 +551,7 @@ void JSGlobalObject::tearOffActivation(ExecState* exec, bool leaveRelic)
         return;
 
     ASSERT(exec->codeType() == FunctionCode);
-    ActivationImp* newActivation = new (exec) ActivationImp(*oldActivation->d(), leaveRelic);
+    ActivationImp* newActivation = new ActivationImp(*oldActivation->d(), leaveRelic);
     
     if (!leaveRelic) {
         checkActivationCount();
@@ -586,9 +571,5 @@ bool JSGlobalObject::isDynamicScope() const
     return true;
 }
 
-void* JSGlobalObject::operator new(size_t size)
-{
-    return Heap::threadHeap()->allocate(size);
-}
 
 } // namespace KJS
index ec300ca..dbfe3f9 100644 (file)
@@ -166,8 +166,8 @@ namespace KJS {
         virtual void put(ExecState*, const Identifier&, JSValue*);
         virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue* value, unsigned attributes);
 
-        // Per-thread linked list of all global objects.
-        static JSGlobalObject*& head();
+        // Linked list of all global objects.
+        static JSGlobalObject* head() { return s_head; }
         JSGlobalObject* next() { return d()->next; }
 
         // Resets the global object to contain only built-in properties, sets
@@ -250,13 +250,11 @@ namespace KJS {
         HashSet<JSObject*>& arrayVisitedElements() { if (!d()->arrayVisitedElements) d()->arrayVisitedElements.set(new HashSet<JSObject*>); return *d()->arrayVisitedElements; }
 
         // Per-thread hash tables, cached on the global object for faster access.
-        PerThreadData* perThreadData() { return &d()->perThreadData; }
+        const PerThreadData* perThreadData() const { return &d()->perThreadData; }
 
         // Initialize and/or retrieve per-thread hash tables - use perThreadData() for faster access instead.
         static ThreadClassInfoHashTables* threadClassInfoHashTables();
 
-        void* operator new(size_t);
-
     private:
         void init(JSObject* thisValue);
         
@@ -267,6 +265,8 @@ namespace KJS {
 
         void deleteActivationStack();
         void checkActivationCount();
+
+        static JSGlobalObject* s_head;
     };
 
     inline bool JSGlobalObject::timedOut()
index de9840c..9d51ca9 100644 (file)
@@ -80,6 +80,11 @@ bool JSLock::currentThreadIsHoldingLock()
     return !!pthread_getspecific(didLockJSMutex);
 }
 
+void JSLock::registerThread()
+{
+    Collector::registerThread();
+}
+
 JSLock::DropAllLocks::DropAllLocks()
     : m_lockCount(0)
 {
@@ -116,6 +121,10 @@ void JSLock::unlock()
 {
 }
 
+void JSLock::registerThread()
+{
+}
+
 JSLock::DropAllLocks::DropAllLocks()
 {
 }
index e6bb48f..f6cda5d 100644 (file)
@@ -51,6 +51,7 @@ namespace KJS {
         JSLock()
         {
             lock();
+            registerThread();
         }
 
         ~JSLock() 
@@ -63,6 +64,8 @@ namespace KJS {
         static int lockCount();
         static bool currentThreadIsHoldingLock();
 
+        static void registerThread();
+
         class DropAllLocks : Noncopyable {
         public:
             DropAllLocks();
index 895da5a..cf30dd5 100644 (file)
@@ -76,7 +76,7 @@ ArrayInstance::ArrayInstance(JSObject* prototype, unsigned initialLength)
     m_vectorLength = initialCapacity;
     m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity)));
 
-    Heap::heap(this)->reportExtraMemoryCost(initialCapacity * sizeof(JSValue*));
+    Collector::reportExtraMemoryCost(initialCapacity * sizeof(JSValue*));
 }
 
 ArrayInstance::ArrayInstance(JSObject* prototype, const List& list)
@@ -128,9 +128,9 @@ JSValue* ArrayInstance::getItem(unsigned i) const
     return value ? value : jsUndefined();
 }
 
-JSValue* ArrayInstance::lengthGetter(ExecState* exec, JSObject*, const Identifier&, const PropertySlot& slot)
+JSValue* ArrayInstance::lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot)
 {
-    return jsNumber(exec, static_cast<ArrayInstance*>(slot.slotBase())->m_length);
+    return jsNumber(static_cast<ArrayInstance*>(slot.slotBase())->m_length);
 }
 
 ALWAYS_INLINE bool ArrayInstance::inlineGetOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot)
index bf1ecf4..26b877d 100644 (file)
@@ -95,7 +95,7 @@ JSValue* arrayProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&)
     bool alreadyVisited = !exec->dynamicGlobalObject()->arrayVisitedElements().add(thisObj).second;
     Vector<UChar, 256> strBuffer;
     if (alreadyVisited)
-        return jsString(exec, UString(0, 0)); // return an empty string, avoding infinite recursion.
+        return jsString(UString(0, 0)); // return an empty string, avoding infinite recursion.
 
     unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
     for (unsigned k = 0; k < length; k++) {
@@ -123,7 +123,7 @@ JSValue* arrayProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&)
             break;
     }
     exec->dynamicGlobalObject()->arrayVisitedElements().remove(thisObj);
-    return jsString(exec, UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
+    return jsString(UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
 }
 
 JSValue* arrayProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const List&)
@@ -134,7 +134,7 @@ JSValue* arrayProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const
     bool alreadyVisited = !exec->dynamicGlobalObject()->arrayVisitedElements().add(thisObj).second;
     Vector<UChar, 256> strBuffer;
     if (alreadyVisited)
-        return jsString(exec, UString(0, 0)); // return an empty string, avoding infinite recursion.
+        return jsString(UString(0, 0)); // return an empty string, avoding infinite recursion.
 
     unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
     for (unsigned k = 0; k < length; k++) {
@@ -168,7 +168,7 @@ JSValue* arrayProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const
             break;
     }
     exec->dynamicGlobalObject()->arrayVisitedElements().remove(thisObj);
-    return jsString(exec, UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
+    return jsString(UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
 }
 
 JSValue* arrayProtoFuncJoin(ExecState* exec, JSObject* thisObj, const List& args)
@@ -176,7 +176,7 @@ JSValue* arrayProtoFuncJoin(ExecState* exec, JSObject* thisObj, const List& args
     bool alreadyVisited = !exec->dynamicGlobalObject()->arrayVisitedElements().add(thisObj).second;
     Vector<UChar, 256> strBuffer;
     if (alreadyVisited)
-        return jsString(exec, UString(0, 0)); // return an empty string, avoding infinite recursion.
+        return jsString(UString(0, 0)); // return an empty string, avoding infinite recursion.
 
     UChar comma = ',';
     UString separator = args[0]->isUndefined() ? UString(&comma, 1) : args[0]->toString(exec);
@@ -207,7 +207,7 @@ JSValue* arrayProtoFuncJoin(ExecState* exec, JSObject* thisObj, const List& args
             break;
     }
     exec->dynamicGlobalObject()->arrayVisitedElements().remove(thisObj);
-    return jsString(exec, UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
+    return jsString(UString(strBuffer.data(), strBuffer.data() ? strBuffer.size() : 0));
 }
 
 JSValue* arrayProtoFuncConcat(ExecState* exec, JSObject* thisObj, const List& args)
@@ -240,7 +240,7 @@ JSValue* arrayProtoFuncConcat(ExecState* exec, JSObject* thisObj, const List& ar
         curObj = static_cast<JSObject*>(curArg); // may be 0
         ++it;
     }
-    arr->put(exec, exec->propertyNames().length, jsNumber(exec, n));
+    arr->put(exec, exec->propertyNames().length, jsNumber(n));
     return arr;
 }
 
@@ -249,12 +249,12 @@ JSValue* arrayProtoFuncPop(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* result = 0;
     unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
     if (length == 0) {
-        thisObj->put(exec, exec->propertyNames().length, jsNumber(exec, length));
+        thisObj->put(exec, exec->propertyNames().length, jsNumber(length));
         result = jsUndefined();
     } else {
         result = thisObj->get(exec, length - 1);
         thisObj->deleteProperty(exec, length - 1);
-        thisObj->put(exec, exec->propertyNames().length, jsNumber(exec, length - 1));
+        thisObj->put(exec, exec->propertyNames().length, jsNumber(length - 1));
     }
     return result;
 }
@@ -265,8 +265,8 @@ JSValue* arrayProtoFuncPush(ExecState* exec, JSObject* thisObj, const List& args
     for (unsigned n = 0; n < args.size(); n++)
         thisObj->put(exec, length + n, args[n]);
     length += args.size();
-    thisObj->put(exec, exec->propertyNames().length, jsNumber(exec, length));
-    return jsNumber(exec, length);
+    thisObj->put(exec, exec->propertyNames().length, jsNumber(length));
+    return jsNumber(length);
 }
 
 JSValue* arrayProtoFuncReverse(ExecState* exec, JSObject* thisObj, const List&)
@@ -298,7 +298,7 @@ JSValue* arrayProtoFuncShift(ExecState* exec, JSObject* thisObj, const List&)
 
     unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
     if (length == 0) {
-        thisObj->put(exec, exec->propertyNames().length, jsNumber(exec, length));
+        thisObj->put(exec, exec->propertyNames().length, jsNumber(length));
         result = jsUndefined();
     } else {
         result = thisObj->get(exec, 0);
@@ -309,7 +309,7 @@ JSValue* arrayProtoFuncShift(ExecState* exec, JSObject* thisObj, const List&)
                 thisObj->deleteProperty(exec, k - 1);
         }
         thisObj->deleteProperty(exec, length - 1);
-        thisObj->put(exec, exec->propertyNames().length, jsNumber(exec, length - 1));
+        thisObj->put(exec, exec->propertyNames().length, jsNumber(length - 1));
     }
     return result;
 }
@@ -353,7 +353,7 @@ JSValue* arrayProtoFuncSlice(ExecState* exec, JSObject* thisObj, const List& arg
         if (JSValue* v = getProperty(exec, thisObj, k))
             resObj->put(exec, n, v);
     }
-    resObj->put(exec, exec->propertyNames().length, jsNumber(exec, n));
+    resObj->put(exec, exec->propertyNames().length, jsNumber(n));
     return result;
 }
 
@@ -438,7 +438,7 @@ JSValue* arrayProtoFuncSplice(ExecState* exec, JSObject* thisObj, const List& ar
         if (JSValue* v = getProperty(exec, thisObj, k + begin))
             resObj->put(exec, k, v);
     }
-    resObj->put(exec, exec->propertyNames().length, jsNumber(exec, deleteCount));
+    resObj->put(exec, exec->propertyNames().length, jsNumber(deleteCount));
 
     unsigned additionalArgs = std::max<int>(args.size() - 2, 0);
     if (additionalArgs != deleteCount) {
@@ -463,7 +463,7 @@ JSValue* arrayProtoFuncSplice(ExecState* exec, JSObject* thisObj, const List& ar
     for (unsigned k = 0; k < additionalArgs; ++k)
         thisObj->put(exec, k + begin, args[k + 2]);
 
-    thisObj->put(exec, exec->propertyNames().length, jsNumber(exec, length - deleteCount + additionalArgs));
+    thisObj->put(exec, exec->propertyNames().length, jsNumber(length - deleteCount + additionalArgs));
     return result;
 }
 
@@ -482,7 +482,7 @@ JSValue* arrayProtoFuncUnShift(ExecState* exec, JSObject* thisObj, const List& a
     }
     for (unsigned k = 0; k < nrArgs; ++k)
         thisObj->put(exec, k, args[k]);
-    JSValue* result = jsNumber(exec, length + nrArgs);
+    JSValue* result = jsNumber(length + nrArgs);
     thisObj->put(exec, exec->propertyNames().length, result);
     return result;
 }
@@ -510,7 +510,7 @@ JSValue* arrayProtoFuncFilter(ExecState* exec, JSObject* thisObj, const List& ar
         List eachArguments;
 
         eachArguments.append(v);
-        eachArguments.append(jsNumber(exec, k));
+        eachArguments.append(jsNumber(k));
         eachArguments.append(thisObj);
 
         JSValue* result = eachFunction->call(exec, applyThis, eachArguments);
@@ -532,7 +532,7 @@ JSValue* arrayProtoFuncMap(ExecState* exec, JSObject* thisObj, const List& args)
     unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec);
 
     List mapArgs;
-    mapArgs.append(jsNumber(exec, length));
+    mapArgs.append(jsNumber(length));
     JSObject* resultArray = static_cast<JSObject*>(exec->lexicalGlobalObject()->arrayConstructor()->construct(exec, mapArgs));
 
     for (unsigned k = 0; k < length && !exec->hadException(); ++k) {
@@ -545,7 +545,7 @@ JSValue* arrayProtoFuncMap(ExecState* exec, JSObject* thisObj, const List& args)
         List eachArguments;
 
         eachArguments.append(v);
-        eachArguments.append(jsNumber(exec, k));
+        eachArguments.append(jsNumber(k));
         eachArguments.append(thisObj);
 
         JSValue* result = eachFunction->call(exec, applyThis, eachArguments);
@@ -581,7 +581,7 @@ JSValue* arrayProtoFuncEvery(ExecState* exec, JSObject* thisObj, const List& arg
         List eachArguments;
 
         eachArguments.append(slot.getValue(exec, thisObj, k));
-        eachArguments.append(jsNumber(exec, k));
+        eachArguments.append(jsNumber(k));
         eachArguments.append(thisObj);
 
         bool predicateResult = eachFunction->call(exec, applyThis, eachArguments)->toBoolean(exec);
@@ -612,7 +612,7 @@ JSValue* arrayProtoFuncForEach(ExecState* exec, JSObject* thisObj, const List& a
 
         List eachArguments;
         eachArguments.append(slot.getValue(exec, thisObj, k));
-        eachArguments.append(jsNumber(exec, k));
+        eachArguments.append(jsNumber(k));
         eachArguments.append(thisObj);
 
         eachFunction->call(exec, applyThis, eachArguments);
@@ -639,7 +639,7 @@ JSValue* arrayProtoFuncSome(ExecState* exec, JSObject* thisObj, const List& args
 
         List eachArguments;
         eachArguments.append(slot.getValue(exec, thisObj, k));
-        eachArguments.append(jsNumber(exec, k));
+        eachArguments.append(jsNumber(k));
         eachArguments.append(thisObj);
 
         bool predicateResult = eachFunction->call(exec, applyThis, eachArguments)->toBoolean(exec);
@@ -675,10 +675,10 @@ JSValue* arrayProtoFuncIndexOf(ExecState* exec, JSObject* thisObj, const List& a
         if (!e)
             continue;
         if (strictEqual(exec, searchElement, e))
-            return jsNumber(exec, index);
+            return jsNumber(index);
     }
 
-    return jsNumber(exec, -1);
+    return jsNumber(-1);
 }
 
 JSValue* arrayProtoFuncLastIndexOf(ExecState* exec, JSObject* thisObj, const List& args)
@@ -693,7 +693,7 @@ JSValue* arrayProtoFuncLastIndexOf(ExecState* exec, JSObject* thisObj, const Lis
     if (d < 0) {
         d += length;
         if (d < 0)
-            return jsNumber(exec, -1);
+            return jsNumber(-1);
     }
     if (d < length)
         index = static_cast<int>(d);
@@ -704,10 +704,10 @@ JSValue* arrayProtoFuncLastIndexOf(ExecState* exec, JSObject* thisObj, const Lis
         if (!e)
             continue;
         if (strictEqual(exec, searchElement, e))
-            return jsNumber(exec, index);
+            return jsNumber(index);
     }
 
-    return jsNumber(exec, -1);
+    return jsNumber(-1);
 }
 
 // ------------------------------ ArrayObjectImp -------------------------------
@@ -719,7 +719,7 @@ ArrayObjectImp::ArrayObjectImp(ExecState* exec, FunctionPrototype* funcProto, Ar
     putDirect(exec->propertyNames().prototype, arrayProto, DontEnum|DontDelete|ReadOnly);
 
     // no. of arguments for constructor
-    putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
 }
 
 bool ArrayObjectImp::implementsConstruct() const
@@ -735,11 +735,11 @@ JSObject* ArrayObjectImp::construct(ExecState* exec, const List& args)
         uint32_t n = args[0]->toUInt32(exec);
         if (n != args[0]->toNumber(exec))
             return throwError(exec, RangeError, "Array size is not a small enough positive integer.");
-        return new (exec) ArrayInstance(exec->lexicalGlobalObject()->arrayPrototype(), n);
+        return new ArrayInstance(exec->lexicalGlobalObject()->arrayPrototype(), n);
     }
 
     // otherwise the array is constructed with the arguments in it
-    return new (exec) ArrayInstance(exec->lexicalGlobalObject()->arrayPrototype(), args);
+    return new ArrayInstance(exec->lexicalGlobalObject()->arrayPrototype(), args);
 }
 
 // ECMA 15.6.1
index 9f2f00f..2d770ee 100644 (file)
@@ -50,8 +50,8 @@ BooleanPrototype::BooleanPrototype(ExecState* exec, ObjectPrototype* objectProto
 {
     setInternalValue(jsBoolean(false));
 
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);
 }
 
 
@@ -67,7 +67,7 @@ JSValue* booleanProtoFuncToString(ExecState* exec, JSObject* thisObj, const List
     JSValue* v = static_cast<BooleanInstance*>(thisObj)->internalValue();
     ASSERT(v);
 
-    return jsString(exec, v->toString(exec));
+    return jsString(v->toString(exec));
 }
 JSValue* booleanProtoFuncValueOf(ExecState* exec, JSObject* thisObj, const List&)
 {
@@ -90,7 +90,7 @@ BooleanObjectImp::BooleanObjectImp(ExecState* exec, FunctionPrototype* functionP
     putDirect(exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
 
     // no. of arguments for constructor
-    putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
 }
 
 bool BooleanObjectImp::implementsConstruct() const
@@ -101,7 +101,7 @@ bool BooleanObjectImp::implementsConstruct() const
 // ECMA 15.6.2
 JSObject* BooleanObjectImp::construct(ExecState* exec, const List& args)
 {
-    BooleanInstance* obj(new (exec) BooleanInstance(exec->lexicalGlobalObject()->booleanPrototype()));
+    BooleanInstance* obj(new BooleanInstance(exec->lexicalGlobalObject()->booleanPrototype()));
     obj->setInternalValue(jsBoolean(args[0]->toBoolean(exec)));
     return obj;
 }
index 13d0432..41a0c27 100644 (file)
@@ -36,7 +36,6 @@
 
 #if USE(MULTIPLE_THREADS)
 #include <pthread.h>
-#include <wtf/ThreadSpecific.h>
 #endif
 
 #if PLATFORM(DARWIN)
 #define COLLECT_ON_EVERY_ALLOCATION 0
 
 using std::max;
-using namespace WTF;
 
 namespace KJS {
 
 // tunable parameters
 
-#define SPARE_EMPTY_BLOCKS 2UL
-#define MIN_ARRAY_SIZE 14UL
-#define GROWTH_FACTOR 2UL
-#define LOW_WATER_FACTOR 4UL
-#define ALLOCATIONS_PER_COLLECTION 4000UL
+const size_t SPARE_EMPTY_BLOCKS = 2;
+const size_t MIN_ARRAY_SIZE = 14;
+const size_t GROWTH_FACTOR = 2;
+const size_t LOW_WATER_FACTOR = 4;
+const size_t ALLOCATIONS_PER_COLLECTION = 4000;
 
-Heap::Heap()
-{
-    memset(this, 0, sizeof(Heap));
-}
+static CollectorHeap primaryHeap = { 0, 0, 0, 0, 0, 0, 0, NoOperation };
+static CollectorHeap numberHeap = { 0, 0, 0, 0, 0, 0, 0, NoOperation };
 
-Heap* Heap::threadHeap()
-{
-#if USE(MULTIPLE_THREADS)
-    static ThreadSpecific<Heap> sharedInstance;
-    return sharedInstance;
-#else
-    static Heap sharedInstance;
-    return &sharedInstance;
-#endif
-}
+// FIXME: I don't think this needs to be a static data member of the Collector class.
+// Just a private global like "heap" above would be fine.
+size_t Collector::mainThreadOnlyObjectCount = 0;
 
-static NEVER_INLINE CollectorBlock* allocateBlock()
+static CollectorBlock* allocateBlock()
 {
 #if PLATFORM(DARWIN)    
     vm_address_t address = 0;
@@ -155,7 +144,7 @@ static void freeBlock(CollectorBlock* block)
 #endif
 }
 
-void Heap::recordExtraCost(size_t cost)
+void Collector::recordExtraCost(size_t cost)
 {
     // Our frequency of garbage collection tries to balance memory use against speed
     // by collecting based on the number of newly created values. However, for values
@@ -172,9 +161,9 @@ void Heap::recordExtraCost(size_t cost)
     primaryHeap.extraCost += cost;
 }
 
-template <Heap::HeapType heapType> struct HeapConstants;
+template <Collector::HeapType heapType> struct HeapConstants;
 
-template <> struct HeapConstants<Heap::PrimaryHeap> {
+template <> struct HeapConstants<Collector::PrimaryHeap> {
     static const size_t cellSize = CELL_SIZE;
     static const size_t cellsPerBlock = CELLS_PER_BLOCK;
     static const size_t bitmapShift = 0;
@@ -182,7 +171,7 @@ template <> struct HeapConstants<Heap::PrimaryHeap> {
     typedef CollectorBlock Block;
 };
 
-template <> struct HeapConstants<Heap::NumberHeap> {
+template <> struct HeapConstants<Collector::NumberHeap> {
     static const size_t cellSize = SMALL_CELL_SIZE;
     static const size_t cellsPerBlock = SMALL_CELLS_PER_BLOCK;
     static const size_t bitmapShift = 1;
@@ -190,7 +179,7 @@ template <> struct HeapConstants<Heap::NumberHeap> {
     typedef SmallCellCollectorBlock Block;
 };
 
-template <Heap::HeapType heapType> void* Heap::heapAllocate(size_t s)
+template <Collector::HeapType heapType> void* Collector::heapAllocate(size_t s)
 {
   typedef typename HeapConstants<heapType>::Block Block;
   typedef typename HeapConstants<heapType>::Cell Cell;
@@ -198,7 +187,6 @@ template <Heap::HeapType heapType> void* Heap::heapAllocate(size_t s)
   CollectorHeap& heap = heapType == PrimaryHeap ? primaryHeap : numberHeap;
   ASSERT(JSLock::lockCount() > 0);
   ASSERT(JSLock::currentThreadIsHoldingLock());
-  ASSERT(this == threadHeap());
   ASSERT(s <= HeapConstants<heapType>::cellSize);
   UNUSED_PARAM(s); // s is now only used for the above assert
 
@@ -281,7 +269,6 @@ collect:
 
     targetBlock = (Block*)allocateBlock();
     targetBlock->freeList = targetBlock->cells;
-    targetBlock->heap = this;
     targetBlockUsedCells = 0;
     heap.blocks[usedBlocks] = (CollectorBlock*)targetBlock;
     heap.usedBlocks = usedBlocks + 1;
@@ -305,12 +292,12 @@ collect:
   return newCell;
 }
 
-void* Heap::allocate(size_t s) 
+void* Collector::allocate(size_t s) 
 {
     return heapAllocate<PrimaryHeap>(s);
 }
 
-void* Heap::allocateNumber(size_t s) 
+void* Collector::allocateNumber(size_t s) 
 {
     return heapAllocate<NumberHeap>(s);
 }
@@ -371,12 +358,128 @@ static inline void* currentThreadStackBase()
 #endif
 }
 
+#if USE(MULTIPLE_THREADS)
+static pthread_t mainThread;
+#endif
+
+void Collector::registerAsMainThread()
+{
+#if USE(MULTIPLE_THREADS)
+    mainThread = pthread_self();
+#endif
+}
+
+static inline bool onMainThread()
+{
+#if USE(MULTIPLE_THREADS)
+#if PLATFORM(DARWIN)
+    return pthread_main_np();
+#else
+    return !!pthread_equal(pthread_self(), mainThread);
+#endif
+#else
+    return true;
+#endif
+}
+
+#if USE(MULTIPLE_THREADS)
+
+#if PLATFORM(DARWIN)
+typedef mach_port_t PlatformThread;
+#elif PLATFORM(WIN_OS)
+struct PlatformThread {
+    PlatformThread(DWORD _id, HANDLE _handle) : id(_id), handle(_handle) {}
+    DWORD id;
+    HANDLE handle;
+};
+#endif
+
+static inline PlatformThread getCurrentPlatformThread()
+{
+#if PLATFORM(DARWIN)
+    return pthread_mach_thread_np(pthread_self());
+#elif PLATFORM(WIN_OS)
+    HANDLE threadHandle = pthread_getw32threadhandle_np(pthread_self());
+    return PlatformThread(GetCurrentThreadId(), threadHandle);
+#endif
+}
+
+class Collector::Thread {
+public:
+  Thread(pthread_t pthread, const PlatformThread& platThread, void* base) 
+  : posixThread(pthread), platformThread(platThread), stackBase(base) {}
+  Thread* next;
+  pthread_t posixThread;
+  PlatformThread platformThread;
+  void* stackBase;
+};
+
+pthread_key_t registeredThreadKey;
+pthread_once_t registeredThreadKeyOnce = PTHREAD_ONCE_INIT;
+Collector::Thread* registeredThreads;
+
+static void destroyRegisteredThread(void* data) 
+{
+  Collector::Thread* thread = (Collector::Thread*)data;
+
+  // Can't use JSLock convenience object here because we don't want to re-register
+  // an exiting thread.
+  JSLock::lock();
+  
+  if (registeredThreads == thread) {
+    registeredThreads = registeredThreads->next;
+  } else {
+    Collector::Thread *last = registeredThreads;
+    Collector::Thread *t;
+    for (t = registeredThreads->next; t != NULL; t = t->next) {
+      if (t == thread) {          
+          last->next = t->next;
+          break;
+      }
+      last = t;
+    }
+    ASSERT(t); // If t is NULL, we never found ourselves in the list.
+  }
+
+  JSLock::unlock();
+
+  delete thread;
+}
+
+static void initializeRegisteredThreadKey()
+{
+  pthread_key_create(&registeredThreadKey, destroyRegisteredThread);
+}
+
+void Collector::registerThread()
+{
+  ASSERT(JSLock::lockCount() > 0);
+  ASSERT(JSLock::currentThreadIsHoldingLock());
+  
+  pthread_once(&registeredThreadKeyOnce, initializeRegisteredThreadKey);
+
+  if (!pthread_getspecific(registeredThreadKey)) {
+#if PLATFORM(DARWIN)
+      if (onMainThread())
+          CollectorHeapIntrospector::init(&primaryHeap, &numberHeap);
+#endif
+
+    Collector::Thread *thread = new Collector::Thread(pthread_self(), getCurrentPlatformThread(), currentThreadStackBase());
+
+    thread->next = registeredThreads;
+    registeredThreads = thread;
+    pthread_setspecific(registeredThreadKey, thread);
+  }
+}
+
+#endif
+
 #define IS_POINTER_ALIGNED(p) (((intptr_t)(p) & (sizeof(char *) - 1)) == 0)
 
 // cell size needs to be a power of two for this to be valid
 #define IS_HALF_CELL_ALIGNED(p) (((intptr_t)(p) & (CELL_MASK >> 1)) == 0)
 
-void Heap::markStackObjectsConservatively(void *start, void *end)
+void Collector::markStackObjectsConservatively(void *start, void *end)
 {
   if (start > end) {
     void* tmp = start;
@@ -408,7 +511,7 @@ void Heap::markStackObjectsConservatively(void *start, void *end)
           // Mark the the number heap, we can mark these Cells directly to avoid the virtual call cost
           for (size_t block = 0; block < usedNumberBlocks; block++) {
               if ((numberBlocks[block] == blockAddr) & (offset <= lastCellOffset)) {
-                  Heap::markCell(reinterpret_cast<JSCell*>(xAsBits));
+                  Collector::markCell(reinterpret_cast<JSCell*>(xAsBits));
                   goto endMarkLoop;
               }
           }
@@ -430,7 +533,7 @@ void Heap::markStackObjectsConservatively(void *start, void *end)
   }
 }
 
-void NEVER_INLINE Heap::markStackObjectsConservativelyInternal()
+void NEVER_INLINE Collector::markCurrentThreadConservativelyInternal()
 {
     void* dummy;
     void* stackPointer = &dummy;
@@ -438,7 +541,7 @@ void NEVER_INLINE Heap::markStackObjectsConservativelyInternal()
     markStackObjectsConservatively(stackPointer, stackBase);
 }
 
-void Heap::markStackObjectsConservatively()
+void Collector::markCurrentThreadConservatively()
 {
     // setjmp forces volatile registers onto the stack
     jmp_buf registers;
@@ -451,10 +554,171 @@ void Heap::markStackObjectsConservatively()
 #pragma warning(pop)
 #endif
 
-    markStackObjectsConservativelyInternal();
+    markCurrentThreadConservativelyInternal();
 }
 
-void Heap::protect(JSValue *k)
+#if USE(MULTIPLE_THREADS)
+
+static inline void suspendThread(const PlatformThread& platformThread)
+{
+#if PLATFORM(DARWIN)
+  thread_suspend(platformThread);
+#elif PLATFORM(WIN_OS)
+  SuspendThread(platformThread.handle);
+#else
+#error Need a way to suspend threads on this platform
+#endif
+}
+
+static inline void resumeThread(const PlatformThread& platformThread)
+{
+#if PLATFORM(DARWIN)
+  thread_resume(platformThread);
+#elif PLATFORM(WIN_OS)
+  ResumeThread(platformThread.handle);
+#else
+#error Need a way to resume threads on this platform
+#endif
+}
+
+typedef unsigned long usword_t; // word size, assumed to be either 32 or 64 bit
+
+#if PLATFORM(DARWIN)
+
+#if     PLATFORM(X86)
+typedef i386_thread_state_t PlatformThreadRegisters;
+#elif   PLATFORM(X86_64)
+typedef x86_thread_state64_t PlatformThreadRegisters;
+#elif   PLATFORM(PPC)
+typedef ppc_thread_state_t PlatformThreadRegisters;
+#elif   PLATFORM(PPC64)
+typedef ppc_thread_state64_t PlatformThreadRegisters;
+#else
+#error Unknown Architecture
+#endif
+
+#elif PLATFORM(WIN_OS)&& PLATFORM(X86)
+typedef CONTEXT PlatformThreadRegisters;
+#else
+#error Need a thread register struct for this platform
+#endif
+
+size_t getPlatformThreadRegisters(const PlatformThread& platformThread, PlatformThreadRegisters& regs)
+{
+#if PLATFORM(DARWIN)
+
+#if     PLATFORM(X86)
+  unsigned user_count = sizeof(regs)/sizeof(int);
+  thread_state_flavor_t flavor = i386_THREAD_STATE;
+#elif   PLATFORM(X86_64)
+  unsigned user_count = x86_THREAD_STATE64_COUNT;
+  thread_state_flavor_t flavor = x86_THREAD_STATE64;
+#elif   PLATFORM(PPC) 
+  unsigned user_count = PPC_THREAD_STATE_COUNT;
+  thread_state_flavor_t flavor = PPC_THREAD_STATE;
+#elif   PLATFORM(PPC64)
+  unsigned user_count = PPC_THREAD_STATE64_COUNT;
+  thread_state_flavor_t flavor = PPC_THREAD_STATE64;
+#else
+#error Unknown Architecture
+#endif
+
+  kern_return_t result = thread_get_state(platformThread, flavor, (thread_state_t)&regs, &user_count);
+  if (result != KERN_SUCCESS) {
+    WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 
+                        "JavaScript garbage collection failed because thread_get_state returned an error (%d). This is probably the result of running inside Rosetta, which is not supported.", result);
+    CRASH();
+  }
+  return user_count * sizeof(usword_t);
+// end PLATFORM(DARWIN)
+
+#elif PLATFORM(WIN_OS) && PLATFORM(X86)
+  regs.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL | CONTEXT_SEGMENTS;
+  GetThreadContext(platformThread.handle, &regs);
+  return sizeof(CONTEXT);
+#else
+#error Need a way to get thread registers on this platform
+#endif
+}
+
+static inline void* otherThreadStackPointer(const PlatformThreadRegisters& regs)
+{
+#if PLATFORM(DARWIN)
+
+#if __DARWIN_UNIX03
+
+#if PLATFORM(X86)
+  return (void*)regs.__esp;
+#elif PLATFORM(X86_64)
+  return (void*)regs.__rsp;
+#elif PLATFORM(PPC) || PLATFORM(PPC64)
+  return (void*)regs.__r1;
+#else
+#error Unknown Architecture
+#endif
+
+#else // !__DARWIN_UNIX03
+
+#if PLATFORM(X86)
+  return (void*)regs.esp;
+#elif PLATFORM(X86_64)
+  return (void*)regs.rsp;
+#elif (PLATFORM(PPC) || PLATFORM(PPC64))
+  return (void*)regs.r1;
+#else
+#error Unknown Architecture
+#endif
+
+#endif // __DARWIN_UNIX03
+
+// end PLATFORM(DARWIN)
+#elif PLATFORM(X86) && PLATFORM(WIN_OS)
+  return (void*)(uintptr_t)regs.Esp;
+#else
+#error Need a way to get the stack pointer for another thread on this platform
+#endif
+}
+
+void Collector::markOtherThreadConservatively(Thread* thread)
+{
+  suspendThread(thread->platformThread);
+
+  PlatformThreadRegisters regs;
+  size_t regSize = getPlatformThreadRegisters(thread->platformThread, regs);
+
+  // mark the thread's registers
+  markStackObjectsConservatively((void*)&regs, (void*)((char*)&regs + regSize));
+  void* stackPointer = otherThreadStackPointer(regs);
+  markStackObjectsConservatively(stackPointer, thread->stackBase);
+
+  resumeThread(thread->platformThread);
+}
+
+#endif
+
+void Collector::markStackObjectsConservatively()
+{
+  markCurrentThreadConservatively();
+
+#if USE(MULTIPLE_THREADS)
+  for (Thread *thread = registeredThreads; thread != NULL; thread = thread->next) {
+    if (!pthread_equal(thread->posixThread, pthread_self())) {
+      markOtherThreadConservatively(thread);
+    }
+  }
+#endif
+}
+
+typedef HashCountedSet<JSCell*> ProtectCountSet;
+
+static ProtectCountSet& protectedValues()
+{
+    static ProtectCountSet staticProtectCountSet;
+    return staticProtectCountSet;
+}
+
+void Collector::protect(JSValue *k)
 {
     ASSERT(k);
     ASSERT(JSLock::lockCount() > 0);
@@ -463,10 +727,10 @@ void Heap::protect(JSValue *k)
     if (JSImmediate::isImmediate(k))
       return;
 
-    protectedValues.add(k->asCell());
+    protectedValues().add(k->asCell());
 }
 
-void Heap::unprotect(JSValue *k)
+void Collector::unprotect(JSValue *k)
 {
     ASSERT(k);
     ASSERT(JSLock::lockCount() > 0);
@@ -475,35 +739,84 @@ void Heap::unprotect(JSValue *k)
     if (JSImmediate::isImmediate(k))
       return;
 
-    protectedValues.remove(k->asCell());
+    protectedValues().remove(k->asCell());
 }
 
-Heap* Heap::heap(const JSValue* v)
+void Collector::collectOnMainThreadOnly(JSValue* value)
 {
-    if (JSImmediate::isImmediate(v))
-        return 0;
-    // FIXME: should assert that the result equals threadHeap(), but currently, this fails as database code uses gcUnprotect from a different thread.
-    // That's a race condition and should be fixed.
-    return Heap::cellBlock(v->asCell())->heap;
+    ASSERT(value);
+    ASSERT(JSLock::lockCount() > 0);
+    ASSERT(JSLock::currentThreadIsHoldingLock());
+
+    if (JSImmediate::isImmediate(value))
+      return;
+
+    JSCell* cell = value->asCell();
+    cellBlock(cell)->collectOnMainThreadOnly.set(cellOffset(cell));
+    ++mainThreadOnlyObjectCount;
 }
 
-void Heap::markProtectedObjects()
+void Collector::markProtectedObjects()
 {
-  HashCountedSet<JSCell*>::iterator end = protectedValues.end();
-  for (HashCountedSet<JSCell*>::iterator it = protectedValues.begin(); it != end; ++it) {
+  ProtectCountSet& protectedValues = KJS::protectedValues();
+  ProtectCountSet::iterator end = protectedValues.end();
+  for (ProtectCountSet::iterator it = protectedValues.begin(); it != end; ++it) {
     JSCell *val = it->first;
     if (!val->marked())
       val->mark();
   }
 }
 
-template <Heap::HeapType heapType> size_t Heap::sweep()
+void Collector::markMainThreadOnlyObjects()
+{
+#if USE(MULTIPLE_THREADS)
+    ASSERT(!onMainThread());
+#endif
+
+    // Optimization for clients that never register "main thread only" objects.
+    if (!mainThreadOnlyObjectCount)
+        return;
+
+    // FIXME: We can optimize this marking algorithm by keeping an exact set of 
+    // "main thread only" objects when the "main thread only" object count is 
+    // small. We don't want to keep an exact set all the time, because WebCore 
+    // tends to create lots of "main thread only" objects, and all that set 
+    // thrashing can be expensive.
+    
+    size_t count = 0;
+    
+    // We don't look at the numberHeap as primitive values can never be marked as main thread only
+    for (size_t block = 0; block < primaryHeap.usedBlocks; block++) {
+        ASSERT(count < mainThreadOnlyObjectCount);
+        
+        CollectorBlock* curBlock = primaryHeap.blocks[block];
+        size_t minimumCellsToProcess = curBlock->usedCells;
+        for (size_t i = 0; (i < minimumCellsToProcess) & (i < CELLS_PER_BLOCK); i++) {
+            CollectorCell* cell = curBlock->cells + i;
+            if (cell->u.freeCell.zeroIfFree == 0)
+                ++minimumCellsToProcess;
+            else {
+                if (curBlock->collectOnMainThreadOnly.get(i)) {
+                    if (!curBlock->marked.get(i)) {
+                        JSCell* imp = reinterpret_cast<JSCell*>(cell);
+                        imp->mark();
+                    }
+                    if (++count == mainThreadOnlyObjectCount)
+                        return;
+                }
+            }
+        }
+    }
+}
+
+template <Collector::HeapType heapType> size_t Collector::sweep(bool currentThreadIsMainThread)
 {
     typedef typename HeapConstants<heapType>::Block Block;
     typedef typename HeapConstants<heapType>::Cell Cell;
 
+    UNUSED_PARAM(currentThreadIsMainThread); // currentThreadIsMainThread is only used in ASSERTs
     // SWEEP: delete everything with a zero refcount (garbage) and unmark everything else
-    CollectorHeap& heap = heapType == Heap::PrimaryHeap ? primaryHeap : numberHeap;
+    CollectorHeap& heap = heapType == Collector::PrimaryHeap ? primaryHeap : numberHeap;
     
     size_t emptyBlocks = 0;
     size_t numLiveObjects = heap.numLiveObjects;
@@ -520,7 +833,7 @@ template <Heap::HeapType heapType> size_t Heap::sweep()
                 if (!curBlock->marked.get(i >> HeapConstants<heapType>::bitmapShift)) {
                     Cell* cell = curBlock->cells + i;
                     
-                    if (heapType != Heap::NumberHeap) {
+                    if (heapType != Collector::NumberHeap) {
                         JSCell* imp = reinterpret_cast<JSCell*>(cell);
                         // special case for allocated but uninitialized object
                         // (We don't need this check earlier because nothing prior this point 
@@ -528,6 +841,11 @@ template <Heap::HeapType heapType> size_t Heap::sweep()
                         if (cell->u.freeCell.zeroIfFree == 0)
                             continue;
                         
+                        ASSERT(currentThreadIsMainThread || !curBlock->collectOnMainThreadOnly.get(i));
+                        if (curBlock->collectOnMainThreadOnly.get(i)) {
+                            curBlock->collectOnMainThreadOnly.clear(i);
+                            --Collector::mainThreadOnlyObjectCount;
+                        }
                         imp->~JSCell();
                     }
                     
@@ -548,8 +866,13 @@ template <Heap::HeapType heapType> size_t Heap::sweep()
                     ++minimumCellsToProcess;
                 } else {
                     if (!curBlock->marked.get(i >> HeapConstants<heapType>::bitmapShift)) {
-                        if (heapType != Heap::NumberHeap) {
+                        if (heapType != Collector::NumberHeap) {
                             JSCell *imp = reinterpret_cast<JSCell*>(cell);
+                            ASSERT(currentThreadIsMainThread || !curBlock->collectOnMainThreadOnly.get(i));
+                            if (curBlock->collectOnMainThreadOnly.get(i)) {
+                                curBlock->collectOnMainThreadOnly.clear(i);
+                                --Collector::mainThreadOnlyObjectCount;
+                            }
                             imp->~JSCell();
                         }
                         --usedCells;
@@ -596,11 +919,10 @@ template <Heap::HeapType heapType> size_t Heap::sweep()
     return numLiveObjects;
 }
     
-bool Heap::collect()
+bool Collector::collect()
 {
   ASSERT(JSLock::lockCount() > 0);
   ASSERT(JSLock::currentThreadIsHoldingLock());
-  ASSERT(this == threadHeap());
 
   ASSERT((primaryHeap.operationInProgress == NoOperation) | (numberHeap.operationInProgress == NoOperation));
   if ((primaryHeap.operationInProgress != NoOperation) | (numberHeap.operationInProgress != NoOperation))
@@ -609,6 +931,8 @@ bool Heap::collect()
   primaryHeap.operationInProgress = Collection;
   numberHeap.operationInProgress = Collection;
 
+  bool currentThreadIsMainThread = onMainThread();
+
   // MARK: first mark all referenced objects recursively starting out from the set of root objects
 
 #ifndef NDEBUG
@@ -620,16 +944,19 @@ bool Heap::collect()
 
   markStackObjectsConservatively();
   markProtectedObjects();
-  if (m_markListSet.size())
-    List::markProtectedLists(m_markListSet);
+  List::markProtectedLists();
+#if USE(MULTIPLE_THREADS)
+  if (!currentThreadIsMainThread)
+    markMainThreadOnlyObjects();
+#endif
 
 #ifndef NDEBUG
   fastMallocAllow();
 #endif
     
   size_t originalLiveObjects = primaryHeap.numLiveObjects + numberHeap.numLiveObjects;
-  size_t numLiveObjects = sweep<PrimaryHeap>();
-  numLiveObjects += sweep<NumberHeap>();
+  size_t numLiveObjects = sweep<PrimaryHeap>(currentThreadIsMainThread);
+  numLiveObjects += sweep<NumberHeap>(currentThreadIsMainThread);
   
   primaryHeap.operationInProgress = NoOperation;
   numberHeap.operationInProgress = NoOperation;
@@ -637,12 +964,12 @@ bool Heap::collect()
   return numLiveObjects < originalLiveObjects;
 }
 
-size_t Heap::size() 
+size_t Collector::size() 
 {
   return primaryHeap.numLiveObjects + numberHeap.numLiveObjects; 
 }
 
-size_t Heap::globalObjectCount()
+size_t Collector::globalObjectCount()
 {
   size_t count = 0;
   if (JSGlobalObject::head()) {
@@ -655,13 +982,13 @@ size_t Heap::globalObjectCount()
   return count;
 }
 
-size_t Heap::protectedGlobalObjectCount()
+size_t Collector::protectedGlobalObjectCount()
 {
   size_t count = 0;
   if (JSGlobalObject::head()) {
     JSGlobalObject* o = JSGlobalObject::head();
     do {
-      if (protectedValues.contains(o))
+      if (protectedValues().contains(o))
         ++count;
       o = o->next();
     } while (o != JSGlobalObject::head());
@@ -669,9 +996,9 @@ size_t Heap::protectedGlobalObjectCount()
   return count;
 }
 
-size_t Heap::protectedObjectCount()
+size_t Collector::protectedObjectCount()
 {
-  return protectedValues.size();
+  return protectedValues().size();
 }
 
 static const char *typeName(JSCell *val)
@@ -707,23 +1034,24 @@ static const char *typeName(JSCell *val)
   return name;
 }
 
-HashCountedSet<const char*>* Heap::protectedObjectTypeCounts()
+HashCountedSet<const char*>* Collector::protectedObjectTypeCounts()
 {
     HashCountedSet<const char*>* counts = new HashCountedSet<const char*>;
 
-    HashCountedSet<JSCell*>::iterator end = protectedValues.end();
-    for (HashCountedSet<JSCell*>::iterator it = protectedValues.begin(); it != end; ++it)
+    ProtectCountSet& protectedValues = KJS::protectedValues();
+    ProtectCountSet::iterator end = protectedValues.end();
+    for (ProtectCountSet::iterator it = protectedValues.begin(); it != end; ++it)
         counts->add(typeName(it->first));
 
     return counts;
 }
 
-bool Heap::isBusy()
+bool Collector::isBusy()
 {
     return (primaryHeap.operationInProgress != NoOperation) | (numberHeap.operationInProgress != NoOperation);
 }
 
-void Heap::reportOutOfMemoryToAllExecStates()
+void Collector::reportOutOfMemoryToAllExecStates()
 {
     if (!JSGlobalObject::head())
         return;
index 7c81d0f..70db6b5 100644 (file)
 
 #include <string.h>
 #include <wtf/HashCountedSet.h>
-#include <wtf/HashSet.h>
-
-namespace WTF {
-  template<typename T> class ThreadSpecific;
-}
 
 namespace KJS {
 
-  class CollectorBlock;
   class JSCell;
   class JSValue;
-  class List;
-
-  enum OperationInProgress { NoOperation, Allocation, Collection };
-
-  struct CollectorHeap {
-    CollectorBlock** blocks;
-    size_t numBlocks;
-    size_t usedBlocks;
-    size_t firstBlockWithPossibleSpace;
-
-    size_t numLiveObjects;
-    size_t numLiveObjectsAtLastCollect;
-    size_t extraCost;
-
-    OperationInProgress operationInProgress;
-  };
+  class CollectorBlock;
 
-  class Heap {
+  class Collector {
   public:
-    static Heap* threadHeap();
-
-    void* allocate(size_t s);
-    void* allocateNumber(size_t s);
-    bool collect();
-    bool isBusy(); // true if an allocation or collection is in progress
+    static void* allocate(size_t s);
+    static void* allocateNumber(size_t s);
+    static bool collect();
+    static bool isBusy(); // true if an allocation or collection is in progress
 
     static const size_t minExtraCostSize = 256;
 
-    void reportExtraMemoryCost(size_t cost);
+    static void reportExtraMemoryCost(size_t cost);
 
-    size_t size();
+    static size_t size();
 
-    void protect(JSValue*);
-    void unprotect(JSValue*);
+    static void protect(JSValue*);
+    static void unprotect(JSValue*);
     
-    static Heap* heap(const JSValue*); // 0 for immediate values
+    static void collectOnMainThreadOnly(JSValue*);
 
-    size_t globalObjectCount();
-    size_t protectedObjectCount();
-    size_t protectedGlobalObjectCount();
-    HashCountedSet<const char*>* protectedObjectTypeCounts();
+    static size_t globalObjectCount();
+    static size_t protectedObjectCount();
+    static size_t protectedGlobalObjectCount();
+    static HashCountedSet<const char*>* protectedObjectTypeCounts();
+
+    class Thread;
+    static void registerThread();
+    
+    static void registerAsMainThread();
 
     static bool isCellMarked(const JSCell*);
     static void markCell(JSCell*);
 
-    HashSet<List*>& markListSet() { return m_markListSet; }
     enum HeapType { PrimaryHeap, NumberHeap };
 
   private:
-    friend class WTF::ThreadSpecific<Heap>;
-
-    Heap();
-    Heap(const Heap&);
-
-    template <Heap::HeapType heapType> void* heapAllocate(size_t s);
-    template <Heap::HeapType heapType> size_t sweep();
+    template <Collector::HeapType heapType> static void* heapAllocate(size_t s);
+    template <Collector::HeapType heapType> static size_t sweep(bool);
     static const CollectorBlock* cellBlock(const JSCell*);
     static CollectorBlock* cellBlock(JSCell*);
     static size_t cellOffset(const JSCell*);
 
-    void recordExtraCost(size_t);
-    void markProtectedObjects();
-    void markStackObjectsConservativelyInternal();
-    void markStackObjectsConservatively();
-    void markStackObjectsConservatively(void* start, void* end);
+    Collector();
 
-    bool memoryFull;
-    void reportOutOfMemoryToAllExecStates();
+    static void recordExtraCost(size_t);
+    static void markProtectedObjects();
+    static void markMainThreadOnlyObjects();
+    static void markCurrentThreadConservatively();
+    static void markCurrentThreadConservativelyInternal();
+    static void markOtherThreadConservatively(Thread*);
+    static void markStackObjectsConservatively();
+    static void markStackObjectsConservatively(void* start, void* end);
 
-    CollectorHeap primaryHeap;
-    CollectorHeap numberHeap;
-    HashCountedSet<JSCell*> protectedValues;
-    HashSet<List*> m_markListSet;
+    static size_t mainThreadOnlyObjectCount;
+    static bool memoryFull;
+    static void reportOutOfMemoryToAllExecStates();
   };
 
   // tunable parameters
@@ -168,7 +145,7 @@ namespace KJS {
     uint32_t usedCells;
     CollectorCell* freeList;
     CollectorBitmap marked;
-    Heap* heap;
+    CollectorBitmap collectOnMainThreadOnly;
   };
 
   class SmallCellCollectorBlock {
@@ -177,35 +154,50 @@ namespace KJS {
     uint32_t usedCells;
     SmallCollectorCell* freeList;
     CollectorBitmap marked;
-    Heap* heap;
+    CollectorBitmap collectOnMainThreadOnly;
+  };
+
+  enum OperationInProgress { NoOperation, Allocation, Collection };
+
+  struct CollectorHeap {
+    CollectorBlock** blocks;
+    size_t numBlocks;
+    size_t usedBlocks;
+    size_t firstBlockWithPossibleSpace;
+
+    size_t numLiveObjects;
+    size_t numLiveObjectsAtLastCollect;
+    size_t extraCost;
+
+    OperationInProgress operationInProgress;
   };
 
-  inline const CollectorBlock* Heap::cellBlock(const JSCell* cell)
+  inline const CollectorBlock* Collector::cellBlock(const JSCell* cell)
   {
     return reinterpret_cast<const CollectorBlock*>(reinterpret_cast<uintptr_t>(cell) & BLOCK_MASK);
   }
 
-  inline CollectorBlock* Heap::cellBlock(JSCell* cell)
+  inline CollectorBlock* Collector::cellBlock(JSCell* cell)
   {
     return const_cast<CollectorBlock*>(cellBlock(const_cast<const JSCell*>(cell)));
   }
 
-  inline size_t Heap::cellOffset(const JSCell* cell)
+  inline size_t Collector::cellOffset(const JSCell* cell)
   {
     return (reinterpret_cast<uintptr_t>(cell) & BLOCK_OFFSET_MASK) / CELL_SIZE;
   }
 
-  inline bool Heap::isCellMarked(const JSCell* cell)
+  inline bool Collector::isCellMarked(const JSCell* cell)
   {
     return cellBlock(cell)->marked.get(cellOffset(cell));
   }
 
-  inline void Heap::markCell(JSCell* cell)
+  inline void Collector::markCell(JSCell* cell)
   {
     cellBlock(cell)->marked.set(cellOffset(cell));
   }
 
-  inline void Heap::reportExtraMemoryCost(size_t cost)
+  inline void Collector::reportExtraMemoryCost(size_t cost)
   { 
     if (cost > minExtraCostSize) 
       recordExtraCost(cost / (CELL_SIZE * 2)); 
index a6c6adc..5de0747 100644 (file)
@@ -170,7 +170,7 @@ static UString formatLocaleDate(ExecState *exec, double time, bool includeDate,
 
 enum LocaleDateTimeFormat { LocaleDateAndTime, LocaleDate, LocaleTime };
  
-static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, const LocaleDateTimeFormat format)
+static JSCell* formatLocaleDate(const GregorianDateTime& gdt, const LocaleDateTimeFormat format)
 {
     static const char* formatStrings[] = {"%#c", "%#x", "%X"};
  
@@ -188,7 +188,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, c
     size_t ret = strftime(timebuffer, bufsize, formatStrings[format], &localTM);
  
     if ( ret == 0 )
-        return jsString(exec, "");
+        return jsString("");
  
     // Copy original into the buffer
     if (yearNeedsOffset && format != LocaleTime) {
@@ -202,7 +202,7 @@ static JSCell* formatLocaleDate(ExecState* exec, const GregorianDateTime& gdt, c
         strncpy(yearLocation, yearString, yearLen - 1);
     }
  
-    return jsString(exec, timebuffer);
+    return jsString(timebuffer);
 }
 
 #endif // PLATFORM(WIN_OS)
@@ -469,10 +469,10 @@ const ClassInfo DatePrototype::info = {"Date", &DateInstance::info, 0, ExecState
 */
 // ECMA 15.9.4
 
-DatePrototype::DatePrototype(ExecState* exec, ObjectPrototype *objectProto)
+DatePrototype::DatePrototype(ExecState *, ObjectPrototype *objectProto)
   : DateInstance(objectProto)
 {
-    setInternalValue(jsNaN(exec));
+    setInternalValue(jsNaN());
     // The constructor will be added later, after DateObjectImp has been built.
 }
 
@@ -489,9 +489,9 @@ DateObjectImp::DateObjectImp(ExecState* exec, FunctionPrototype* funcProto, Date
   : InternalFunctionImp(funcProto, dateProto->classInfo()->className)
 {
   putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly);
-  putDirectFunction(new (exec) DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, exec->propertyNames().parse), DontEnum);
-  putDirectFunction(new (exec) DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, exec->propertyNames().UTC), DontEnum);
-  putDirect(exec, exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum);
+  putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::Parse, 1, exec->propertyNames().parse), DontEnum);
+  putDirectFunction(new DateObjectFuncImp(exec, funcProto, DateObjectFuncImp::UTC, 7, exec->propertyNames().UTC), DontEnum);
+  putDirect(exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum);
 }
 
 bool DateObjectImp::implementsConstruct() const
@@ -542,19 +542,19 @@ JSObject *DateObjectImp::construct(ExecState *exec, const List &args)
     }
   }
   
-  DateInstance* ret = new (exec) DateInstance(exec->lexicalGlobalObject()->datePrototype());
-  ret->setInternalValue(jsNumber(exec, timeClip(value)));
+  DateInstance *ret = new DateInstance(exec->lexicalGlobalObject()->datePrototype());
+  ret->setInternalValue(jsNumber(timeClip(value)));
   return ret;
 }
 
 // ECMA 15.9.2
-JSValue* DateObjectImp::callAsFunction(ExecState* exec, JSObject* /*thisObj*/, const List& /*args*/)
+JSValue *DateObjectImp::callAsFunction(ExecState * /*exec*/, JSObject * /*thisObj*/, const List &/*args*/)
 {
     time_t localTime = time(0);
     tm localTM;
     getLocalTime(&localTime, &localTM);
     GregorianDateTime ts(localTM);
-    return jsString(exec, formatDate(ts) + " " + formatTime(ts, false));
+    return jsString(formatDate(ts) + " " + formatTime(ts, false));
 }
 
 // ------------------------------ DateObjectFuncImp ----------------------------
@@ -562,14 +562,14 @@ JSValue* DateObjectImp::callAsFunction(ExecState* exec, JSObject* /*thisObj*/, c
 DateObjectFuncImp::DateObjectFuncImp(ExecState* exec, FunctionPrototype* funcProto, int i, int len, const Identifier& name)
     : InternalFunctionImp(funcProto, name), id(i)
 {
-    putDirect(exec, exec->propertyNames().length, len, DontDelete|ReadOnly|DontEnum);
+    putDirect(exec->propertyNames().length, len, DontDelete|ReadOnly|DontEnum);
 }
 
 // ECMA 15.9.4.2 - 3
 JSValue *DateObjectFuncImp::callAsFunction(ExecState* exec, JSObject*, const List& args)
 {
   if (id == Parse) {
-    return jsNumber(exec, parseDate(args[0]->toString(exec)));
+    return jsNumber(parseDate(args[0]->toString(exec)));
   }
   else { // UTC
     int n = args.size();
@@ -580,7 +580,7 @@ JSValue *DateObjectFuncImp::callAsFunction(ExecState* exec, JSObject*, const Lis
         || (n >= 5 && isnan(args[4]->toNumber(exec)))
         || (n >= 6 && isnan(args[5]->toNumber(exec)))
         || (n >= 7 && isnan(args[6]->toNumber(exec)))) {
-      return jsNaN(exec);
+      return jsNaN();
     }
 
     GregorianDateTime t;
@@ -592,7 +592,7 @@ JSValue *DateObjectFuncImp::callAsFunction(ExecState* exec, JSObject*, const Lis
     t.minute = args[4]->toInt32(exec);
     t.second = args[5]->toInt32(exec);
     double ms = (n >= 7) ? args[6]->toNumber(exec) : 0;
-    return jsNumber(exec, gregorianDateTimeToMS(t, ms, true));
+    return jsNumber(gregorianDateTimeToMS(t, ms, true));
   }
 }
 
@@ -987,11 +987,11 @@ JSValue* dateProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsString(exec, formatDate(t) + " " + formatTime(t, utc));
+    return jsString(formatDate(t) + " " + formatTime(t, utc));
 }
 
 JSValue* dateProtoFuncToUTCString(ExecState* exec, JSObject* thisObj, const List&)
@@ -1005,11 +1005,11 @@ JSValue* dateProtoFuncToUTCString(ExecState* exec, JSObject* thisObj, const List
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc));
+    return jsString(formatDateUTCVariant(t) + " " + formatTime(t, utc));
 }
 
 JSValue* dateProtoFuncToDateString(ExecState* exec, JSObject* thisObj, const List&)
@@ -1023,11 +1023,11 @@ JSValue* dateProtoFuncToDateString(ExecState* exec, JSObject* thisObj, const Lis
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsString(exec, formatDate(t));
+    return jsString(formatDate(t));
 }
 
 JSValue* dateProtoFuncToTimeString(ExecState* exec, JSObject* thisObj, const List&)
@@ -1041,11 +1041,11 @@ JSValue* dateProtoFuncToTimeString(ExecState* exec, JSObject* thisObj, const Lis
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsString(exec, formatTime(t, utc));
+    return jsString(formatTime(t, utc));
 }
 
 JSValue* dateProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const List& args)
@@ -1057,11 +1057,11 @@ JSValue* dateProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const L
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
 #if PLATFORM(MAC)
     double secs = floor(milli / msPerSecond);
-    return jsString(exec, formatLocaleDate(exec, secs, true, true, args));
+    return jsString(formatLocaleDate(exec, secs, true, true, args));
 #else
     UNUSED_PARAM(args);
 
@@ -1069,7 +1069,7 @@ JSValue* dateProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const L
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return formatLocaleDate(exec, t, LocaleDateAndTime);
+    return formatLocaleDate(t, LocaleDateAndTime);
 #endif
 }
 
@@ -1082,11 +1082,11 @@ JSValue* dateProtoFuncToLocaleDateString(ExecState* exec, JSObject* thisObj, con
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
 #if PLATFORM(MAC)
     double secs = floor(milli / msPerSecond);
-    return jsString(exec, formatLocaleDate(exec, secs, true, false, args));
+    return jsString(formatLocaleDate(exec, secs, true, false, args));
 #else
     UNUSED_PARAM(args);
 
@@ -1094,7 +1094,7 @@ JSValue* dateProtoFuncToLocaleDateString(ExecState* exec, JSObject* thisObj, con
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return formatLocaleDate(exec, t, LocaleDate);
+    return formatLocaleDate(t, LocaleDate);
 #endif
 }
 
@@ -1107,11 +1107,11 @@ JSValue* dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject* thisObj, con
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
 #if PLATFORM(MAC)
     double secs = floor(milli / msPerSecond);
-    return jsString(exec, formatLocaleDate(exec, secs, false, true, args));
+    return jsString(formatLocaleDate(exec, secs, false, true, args));
 #else
     UNUSED_PARAM(args);
 
@@ -1119,7 +1119,7 @@ JSValue* dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject* thisObj, con
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return formatLocaleDate(exec, t, LocaleTime);
+    return formatLocaleDate(t, LocaleTime);
 #endif
 }
 
@@ -1132,9 +1132,9 @@ JSValue* dateProtoFuncValueOf(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
-    return jsNumber(exec, milli);
+    return jsNumber(milli);
 }
 
 JSValue* dateProtoFuncGetTime(ExecState* exec, JSObject* thisObj, const List&)
@@ -1146,9 +1146,9 @@ JSValue* dateProtoFuncGetTime(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
-    return jsNumber(exec, milli);
+    return jsNumber(milli);
 }
 
 JSValue* dateProtoFuncGetFullYear(ExecState* exec, JSObject* thisObj, const List&)
@@ -1162,11 +1162,11 @@ JSValue* dateProtoFuncGetFullYear(ExecState* exec, JSObject* thisObj, const List
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, 1900 + t.year);
+    return jsNumber(1900 + t.year);
 }
 
 JSValue* dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject* thisObj, const List&)
@@ -1180,11 +1180,11 @@ JSValue* dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject* thisObj, const L
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, 1900 + t.year);
+    return jsNumber(1900 + t.year);
 }
 
 JSValue* dateProtoFuncToGMTString(ExecState* exec, JSObject* thisObj, const List&)
@@ -1198,11 +1198,11 @@ JSValue* dateProtoFuncToGMTString(ExecState* exec, JSObject* thisObj, const List
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsString(exec, "Invalid Date");
+        return jsString("Invalid Date");
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsString(exec, formatDateUTCVariant(t) + " " + formatTime(t, utc));
+    return jsString(formatDateUTCVariant(t) + " " + formatTime(t, utc));
 }
 
 JSValue* dateProtoFuncGetMonth(ExecState* exec, JSObject* thisObj, const List&)
@@ -1216,11 +1216,11 @@ JSValue* dateProtoFuncGetMonth(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.month);
+    return jsNumber(t.month);
 }
 
 JSValue* dateProtoFuncGetUTCMonth(ExecState* exec, JSObject* thisObj, const List&)
@@ -1234,11 +1234,11 @@ JSValue* dateProtoFuncGetUTCMonth(ExecState* exec, JSObject* thisObj, const List
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.month);
+    return jsNumber(t.month);
 }
 
 JSValue* dateProtoFuncGetDate(ExecState* exec, JSObject* thisObj, const List&)
@@ -1252,11 +1252,11 @@ JSValue* dateProtoFuncGetDate(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.monthDay);
+    return jsNumber(t.monthDay);
 }
 
 JSValue* dateProtoFuncGetUTCDate(ExecState* exec, JSObject* thisObj, const List&)
@@ -1270,11 +1270,11 @@ JSValue* dateProtoFuncGetUTCDate(ExecState* exec, JSObject* thisObj, const List&
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.monthDay);
+    return jsNumber(t.monthDay);
 }
 
 JSValue* dateProtoFuncGetDay(ExecState* exec, JSObject* thisObj, const List&)
@@ -1288,11 +1288,11 @@ JSValue* dateProtoFuncGetDay(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.weekDay);
+    return jsNumber(t.weekDay);
 }
 
 JSValue* dateProtoFuncGetUTCDay(ExecState* exec, JSObject* thisObj, const List&)
@@ -1306,11 +1306,11 @@ JSValue* dateProtoFuncGetUTCDay(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.weekDay);
+    return jsNumber(t.weekDay);
 }
 
 JSValue* dateProtoFuncGetHours(ExecState* exec, JSObject* thisObj, const List&)
@@ -1324,11 +1324,11 @@ JSValue* dateProtoFuncGetHours(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.hour);
+    return jsNumber(t.hour);
 }
 
 JSValue* dateProtoFuncGetUTCHours(ExecState* exec, JSObject* thisObj, const List&)
@@ -1342,11 +1342,11 @@ JSValue* dateProtoFuncGetUTCHours(ExecState* exec, JSObject* thisObj, const List
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.hour);
+    return jsNumber(t.hour);
 }
 
 JSValue* dateProtoFuncGetMinutes(ExecState* exec, JSObject* thisObj, const List&)
@@ -1360,11 +1360,11 @@ JSValue* dateProtoFuncGetMinutes(ExecState* exec, JSObject* thisObj, const List&
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.minute);
+    return jsNumber(t.minute);
 }
 
 JSValue* dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject* thisObj, const List&)
@@ -1378,11 +1378,11 @@ JSValue* dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject* thisObj, const Li
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.minute);
+    return jsNumber(t.minute);
 }
 
 JSValue* dateProtoFuncGetSeconds(ExecState* exec, JSObject* thisObj, const List&)
@@ -1396,11 +1396,11 @@ JSValue* dateProtoFuncGetSeconds(ExecState* exec, JSObject* thisObj, const List&
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.second);
+    return jsNumber(t.second);
 }
 
 JSValue* dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject* thisObj, const List&)
@@ -1414,11 +1414,11 @@ JSValue* dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject* thisObj, const Li
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, t.second);
+    return jsNumber(t.second);
 }
 
 JSValue* dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject* thisObj, const List&)
@@ -1430,11 +1430,11 @@ JSValue* dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject* thisObj, const
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     double secs = floor(milli / msPerSecond);
     double ms = milli - secs * msPerSecond;
-    return jsNumber(exec, ms);
+    return jsNumber(ms);
 }
 
 JSValue* dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject* thisObj, const List&)
@@ -1446,11 +1446,11 @@ JSValue* dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject* thisObj, con
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     double secs = floor(milli / msPerSecond);
     double ms = milli - secs * msPerSecond;
-    return jsNumber(exec, ms);
+    return jsNumber(ms);
 }
 
 JSValue* dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject* thisObj, const List&)
@@ -1464,11 +1464,11 @@ JSValue* dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject* thisObj, cons
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
-    return jsNumber(exec, -gmtoffset(t) / minutesPerHour);
+    return jsNumber(-gmtoffset(t) / minutesPerHour);
 }
 
 JSValue* dateProtoFuncSetTime(ExecState* exec, JSObject* thisObj, const List& args)
@@ -1479,7 +1479,7 @@ JSValue* dateProtoFuncSetTime(ExecState* exec, JSObject* thisObj, const List& ar
     DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 
 
     double milli = timeClip(args[0]->toNumber(exec));
-    JSValue* result = jsNumber(exec, milli);
+    JSValue* result = jsNumber(milli);
     thisDateObj->setInternalValue(result);
     return result;
 }
@@ -1494,7 +1494,7 @@ static JSValue* setNewValueFromTimeArgs(ExecState* exec, JSObject* thisObj, cons
     double milli = v->toNumber(exec);
     
     if (args.isEmpty() || isnan(milli)) {
-        JSValue* result = jsNaN(exec);
+        JSValue* result = jsNaN();
         thisDateObj->setInternalValue(result);
         return result;
     }
@@ -1506,12 +1506,12 @@ static JSValue* setNewValueFromTimeArgs(ExecState* exec, JSObject* thisObj, cons
     thisDateObj->msToGregorianDateTime(milli, inputIsUTC, t);
 
     if (!fillStructuresUsingTimeArgs(exec, args, numArgsToUse, &ms, &t)) {
-        JSValue* result = jsNaN(exec);
+        JSValue* result = jsNaN();
         thisDateObj->setInternalValue(result);
         return result;
     } 
     
-    JSValue* result = jsNumber(exec, gregorianDateTimeToMS(t, ms, inputIsUTC));
+    JSValue* result = jsNumber(gregorianDateTimeToMS(t, ms, inputIsUTC));
     thisDateObj->setInternalValue(result);
     return result;
 }
@@ -1523,7 +1523,7 @@ static JSValue* setNewValueFromDateArgs(ExecState* exec, JSObject* thisObj, cons
 
     DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj);
     if (args.isEmpty()) {
-        JSValue* result = jsNaN(exec);
+        JSValue* result = jsNaN();
         thisDateObj->setInternalValue(result);
         return result;
     }      
@@ -1544,12 +1544,12 @@ static JSValue* setNewValueFromDateArgs(ExecState* exec, JSObject* thisObj, cons
     }
     
     if (!fillStructuresUsingDateArgs(exec, args, numArgsToUse, &ms, &t)) {
-        JSValue* result = jsNaN(exec);
+        JSValue* result = jsNaN();
         thisDateObj->setInternalValue(result);
         return result;
     } 
            
-    JSValue* result = jsNumber(exec, gregorianDateTimeToMS(t, ms, inputIsUTC));
+    JSValue* result = jsNumber(gregorianDateTimeToMS(t, ms, inputIsUTC));
     thisDateObj->setInternalValue(result);
     return result;
 }
@@ -1647,7 +1647,7 @@ JSValue* dateProtoFuncSetYear(ExecState* exec, JSObject* thisObj, const List& ar
 
     DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj);     
     if (args.isEmpty()) { 
-        JSValue* result = jsNaN(exec);
+        JSValue* result = jsNaN();
         thisDateObj->setInternalValue(result);
         return result;
     }
@@ -1670,13 +1670,13 @@ JSValue* dateProtoFuncSetYear(ExecState* exec, JSObject* thisObj, const List& ar
     bool ok = true;
     int32_t year = args[0]->toInt32(exec, ok);
     if (!ok) {
-        JSValue* result = jsNaN(exec);
+        JSValue* result = jsNaN();
         thisDateObj->setInternalValue(result);
         return result;
     }
             
     t.year = (year > 99 || year < 0) ? year - 1900 : year;
-    JSValue* result = jsNumber(exec, gregorianDateTimeToMS(t, ms, utc));
+    JSValue* result = jsNumber(gregorianDateTimeToMS(t, ms, utc));
     thisDateObj->setInternalValue(result);
     return result;
 }
@@ -1692,13 +1692,13 @@ JSValue* dateProtoFuncGetYear(ExecState* exec, JSObject* thisObj, const List&)
     JSValue* v = thisDateObj->internalValue();
     double milli = v->toNumber(exec);
     if (isnan(milli))
-        return jsNaN(exec);
+        return jsNaN();
 
     GregorianDateTime t;
     thisDateObj->msToGregorianDateTime(milli, utc, t);
 
     // NOTE: IE returns the full year even in getYear.
-    return jsNumber(exec, t.year);
+    return jsNumber(t.year);
 }
 
 } // namespace KJS
index 0e3d11e..ac773b6 100644 (file)
@@ -46,10 +46,10 @@ ErrorPrototype::ErrorPrototype(ExecState* exec, ObjectPrototype* objectPrototype
 {
     // The constructor will be added later in ErrorObjectImp's constructor
 
-    putDirect(exec->propertyNames().name, jsString(exec, "Error"), DontEnum);
-    putDirect(exec->propertyNames().message, jsString(exec, "Unknown error"), DontEnum);
+    putDirect(exec->propertyNames().name, jsString("Error"), DontEnum);
+    putDirect(exec->propertyNames().message, jsString("Unknown error"), DontEnum);
 
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);
 }
 
 JSValue* errorProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&)
@@ -65,7 +65,7 @@ JSValue* errorProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&)
         // Mozilla compatible format
         s += ": " + v->toString(exec);
 
-    return jsString(exec, s);
+    return jsString(s);
 }
 
 // ------------------------------ ErrorObjectImp -------------------------------
@@ -75,7 +75,7 @@ ErrorObjectImp::ErrorObjectImp(ExecState* exec, FunctionPrototype* funcProto, Er
 {
     // ECMA 15.11.3.1 Error.prototype
     putDirect(exec->propertyNames().prototype, errorProto, DontEnum|DontDelete|ReadOnly);
-    putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete|ReadOnly|DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(1), DontDelete|ReadOnly|DontEnum);
 }
 
 bool ErrorObjectImp::implementsConstruct() const
@@ -87,11 +87,11 @@ bool ErrorObjectImp::implementsConstruct() const
 JSObject* ErrorObjectImp::construct(ExecState* exec, const List& args)
 {
     JSObject* proto = static_cast<JSObject*>(exec->lexicalGlobalObject()->errorPrototype());
-    JSObject* imp = new (exec) ErrorInstance(proto);
+    JSObject* imp = new ErrorInstance(proto);
     JSObject* obj(imp);
 
     if (!args[0]->isUndefined())
-        imp->putDirect(exec->propertyNames().message, jsString(exec, args[0]->toString(exec)));
+        imp->putDirect(exec->propertyNames().message, jsString(args[0]->toString(exec)));
 
     return obj;
 }
@@ -108,8 +108,8 @@ JSValue* ErrorObjectImp::callAsFunction(ExecState* exec, JSObject* /*thisObj*/,
 NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, ErrorPrototype* errorProto, const UString& name, const UString& message)
     : JSObject(errorProto)
 {
-    putDirect(exec->propertyNames().name, jsString(exec, name), 0);
-    putDirect(exec->propertyNames().message, jsString(exec, message), 0);
+    putDirect(exec->propertyNames().name, jsString(name), 0);
+    putDirect(exec->propertyNames().message, jsString(message), 0);
 }
 
 // ------------------------------ NativeErrorImp -------------------------------
@@ -120,7 +120,7 @@ NativeErrorImp::NativeErrorImp(ExecState* exec, FunctionPrototype* funcProto, Na
     : InternalFunctionImp(funcProto, Identifier(prot->getDirect(exec->propertyNames().name)->getString()))
     , proto(prot)
 {
-    putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete|ReadOnly|DontEnum); // ECMA 15.11.7.5
+    putDirect(exec->propertyNames().length, jsNumber(1), DontDelete|ReadOnly|DontEnum); // ECMA 15.11.7.5
     putDirect(exec->propertyNames().prototype, proto, DontDelete|ReadOnly|DontEnum);
 }
 
@@ -131,10 +131,10 @@ bool NativeErrorImp::implementsConstruct() const
 
 JSObject* NativeErrorImp::construct(ExecState* exec, const List& args)
 {
-    JSObject* imp = new (exec) ErrorInstance(proto);
+    JSObject* imp = new ErrorInstance(proto);
     JSObject* obj(imp);
     if (!args[0]->isUndefined())
-        imp->putDirect(exec->propertyNames().message, jsString(exec, args[0]->toString(exec)));
+        imp->putDirect(exec->propertyNames().message, jsString(args[0]->toString(exec)));
     return obj;
 }
 
index af9efcf..fe2458c 100644 (file)
@@ -122,10 +122,10 @@ JSValue* FunctionImp::callerGetter(ExecState* exec, JSObject*, const Identifier&
     return callingFunction;
 }
 
-JSValue* FunctionImp::lengthGetter(ExecState* exec, JSObject*, const Identifier&, const PropertySlot& slot)
+JSValue* FunctionImp::lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot)
 {
     FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());
-    return jsNumber(exec, thisObj->body->parameters().size());
+    return jsNumber(thisObj->body->parameters().size());
 }
 
 bool FunctionImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -199,7 +199,7 @@ JSObject* FunctionImp::construct(ExecState* exec, const List& args)
   else
     proto = exec->lexicalGlobalObject()->objectPrototype();
 
-  JSObject* obj(new (exec) JSObject(proto));
+  JSObject* obj(new JSObject(proto));
 
   JSValue* res = call(exec,obj,args);
 
@@ -288,7 +288,7 @@ Arguments::Arguments(ExecState* exec, FunctionImp* func, const List& args, Activ
     , indexToNameMap(func, args)
 {
     putDirect(exec->propertyNames().callee, func, DontEnum);
-    putDirect(exec, exec->propertyNames().length, args.size(), DontEnum);
+    putDirect(exec->propertyNames().length, args.size(), DontEnum);
   
     int i = 0;
     List::const_iterator end = args.end();
@@ -464,7 +464,7 @@ void ActivationImp::createArgumentsObject(ExecState* exec)
     // Since "arguments" is only accessible while a function is being called,
     // we can retrieve our argument list from the ExecState for our function 
     // call instead of storing the list ourselves.
-    d()->argumentsObject = new (exec) Arguments(exec, d()->exec->function(), *d()->exec->arguments(), this);
+    d()->argumentsObject = new Arguments(exec, d()->exec->function(), *d()->exec->arguments(), this);
 }
 
 JSObject* ActivationImp::toThisObject(ExecState* exec) const
@@ -505,7 +505,7 @@ static JSValue* encode(ExecState* exec, const List& args, const char* do_not_esc
       r += tmp;
     }
   }
-  return jsString(exec, r);
+  return jsString(r);
 }
 
 static JSValue* decode(ExecState* exec, const List& args, const char* do_not_unescape, bool strict)
@@ -570,7 +570,7 @@ static JSValue* decode(ExecState* exec, const List& args, const char* do_not_une
     k++;
     s.append(c);
   }
-  return jsString(exec, s);
+  return jsString(s);
 }
 
 static bool isStrWhiteSpace(unsigned short c)
@@ -764,12 +764,12 @@ JSValue* globalFuncEval(ExecState* exec, PrototypeReflexiveFunction* function, J
 
 JSValue* globalFuncParseInt(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, parseInt(args[0]->toString(exec), args[1]->toInt32(exec)));
+    return jsNumber(parseInt(args[0]->toString(exec), args[1]->toInt32(exec)));
 }
 
 JSValue* globalFuncParseFloat(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, parseFloat(args[0]->toString(exec)));
+    return jsNumber(parseFloat(args[0]->toString(exec)));
 }
 
 JSValue* globalFuncIsNaN(ExecState* exec, JSObject*, const List& args)
@@ -844,7 +844,7 @@ JSValue* globalFuncEscape(ExecState* exec, JSObject*, const List& args)
         r += s;
     }
 
-    return jsString(exec, r);
+    return jsString(r);
 }
 
 JSValue* globalFuncUnescape(ExecState* exec, JSObject*, const List& args)
@@ -869,7 +869,7 @@ JSValue* globalFuncUnescape(ExecState* exec, JSObject*, const List& args)
         s += UString(c, 1);
     }
 
-    return jsString(exec, s);
+    return jsString(s);
 }
 
 #ifndef NDEBUG
@@ -889,7 +889,7 @@ PrototypeFunction::PrototypeFunction(ExecState* exec, int len, const Identifier&
     , m_function(function)
 {
     ASSERT_ARG(function, function);
-    putDirect(exec->propertyNames().length, jsNumber(exec, len), DontDelete | ReadOnly | DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(len), DontDelete | ReadOnly | DontEnum);
 }
 
 PrototypeFunction::PrototypeFunction(ExecState* exec, FunctionPrototype* functionPrototype, int len, const Identifier& name, JSMemberFunction function)
@@ -897,7 +897,7 @@ PrototypeFunction::PrototypeFunction(ExecState* exec, FunctionPrototype* functio
     , m_function(function)
 {
     ASSERT_ARG(function, function);
-    putDirect(exec->propertyNames().length, jsNumber(exec, len), DontDelete | ReadOnly | DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(len), DontDelete | ReadOnly | DontEnum);
 }
 
 JSValue* PrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
@@ -914,7 +914,7 @@ PrototypeReflexiveFunction::PrototypeReflexiveFunction(ExecState* exec, Function
 {
     ASSERT_ARG(function, function);
     ASSERT_ARG(cachedGlobalObject, cachedGlobalObject);
-    putDirect(exec->propertyNames().length, jsNumber(exec, len), DontDelete | ReadOnly | DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(len), DontDelete | ReadOnly | DontEnum);
 }
 
 JSValue* PrototypeReflexiveFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
index bb2f99f..c849b4d 100644 (file)
@@ -44,11 +44,11 @@ static JSValue* functionProtoFuncCall(ExecState*, JSObject*, const List&);
 
 FunctionPrototype::FunctionPrototype(ExecState* exec)
 {
-    putDirect(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
 
-    putDirectFunction(new (exec) PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, this, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, this, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, this, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, this, 2, exec->propertyNames().apply, functionProtoFuncApply), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, this, 1, exec->propertyNames().call, functionProtoFuncCall), DontEnum);
 }
 
 // ECMA 15.3.4
@@ -70,10 +70,10 @@ JSValue* functionProtoFuncToString(ExecState* exec, JSObject* thisObj, const Lis
 
     if (thisObj->inherits(&FunctionImp::info)) {
         FunctionImp* fi = static_cast<FunctionImp*>(thisObj);
-        return jsString(exec, "function " + fi->functionName().ustring() + "(" + fi->body->paramString() + ") " + fi->body->toString());
+        return jsString("function " + fi->functionName().ustring() + "(" + fi->body->paramString() + ") " + fi->body->toString());
     }
 
-    return jsString(exec, "function " + static_cast<InternalFunctionImp*>(thisObj)->functionName().ustring() + "() {\n    [native code]\n}");
+    return jsString("function " + static_cast<InternalFunctionImp*>(thisObj)->functionName().ustring() + "() {\n    [native code]\n}");
 }
 
 JSValue* functionProtoFuncApply(ExecState* exec, JSObject* thisObj, const List& args)
@@ -133,7 +133,7 @@ FunctionObjectImp::FunctionObjectImp(ExecState* exec, FunctionPrototype* functio
     putDirect(exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
 
     // Number of arguments for constructor
-    putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
 }
 
 bool FunctionObjectImp::implementsConstruct() const
@@ -168,7 +168,7 @@ JSObject* FunctionObjectImp::construct(ExecState* exec, const List& args, const
     // send empty sourceURL to indicate constructed code
     Debugger* dbg = exec->dynamicGlobalObject()->debugger();
     if (dbg && !dbg->sourceParsed(exec, sourceId, UString(), body, lineNumber, errLine, errMsg))
-        return new (exec) JSObject();
+        return new JSObject();
 
     // No program node == syntax error - throw a syntax error
     if (!functionBody)
@@ -179,7 +179,7 @@ JSObject* FunctionObjectImp::construct(ExecState* exec, const List& args, const
     ScopeChain scopeChain;
     scopeChain.push(exec->lexicalGlobalObject());
 
-    FunctionImp* fimp = new (exec) FunctionImp(exec, functionName, functionBody.get(), scopeChain);
+    FunctionImp* fimp = new FunctionImp(exec, functionName, functionBody.get(), scopeChain);
 
     // parse parameter list. throw syntax error on illegal identifiers
     int len = p.size();
index c6e599d..4155418 100644 (file)
@@ -80,7 +80,7 @@ UString StringImp::toString(ExecState *) const
 
 JSObject* StringImp::toObject(ExecState *exec) const
 {
-    return new (exec) StringInstance(exec->lexicalGlobalObject()->stringPrototype(), const_cast<StringImp*>(this));
+    return new StringInstance(exec->lexicalGlobalObject()->stringPrototype(), const_cast<StringImp*>(this));
 }
 
 // ------------------------------ NumberImp ------------------------------------
index 89a748c..f8a2dc6 100644 (file)
@@ -45,7 +45,7 @@ namespace KJS {
 
   class StringImp : public JSCell {
   public:
-    StringImp(const UString& v) : val(v) { Heap::heap(this)->reportExtraMemoryCost(v.cost()); }
+    StringImp(const UString& v) : val(v) { Collector::reportExtraMemoryCost(v.cost()); }
     enum HasOtherOwnerType { HasOtherOwner };
     StringImp(const UString& value, HasOtherOwnerType) : val(value) { }
     const UString& value() const { return val; }
@@ -65,7 +65,7 @@ namespace KJS {
 
   class NumberImp : public JSCell {
     friend class ConstantValues;
-    friend JSValue* jsNumberCell(ExecState*, double);
+    friend JSValue *jsNumberCell(double);
   public:
     double value() const { return val; }
 
@@ -78,11 +78,10 @@ namespace KJS {
     virtual UString toString(ExecState *exec) const;
     virtual JSObject *toObject(ExecState *exec) const;
     
-    void* operator new(size_t size, ExecState* exec)
+    void* operator new(size_t size)
     {
-        return exec->heap()->allocateNumber(size);
+        return Collector::allocateNumber(size);
     }
-
   private:
     NumberImp(double v) : val(v) { }
 
index c5c21c9..5cc7cc2 100644 (file)
@@ -31,10 +31,16 @@ void List::getSlice(int startIndex, List& result) const
     result.m_vector.appendRange(start, end());
 }
 
-void List::markProtectedLists(ListSet& markSet)
+List::ListSet& List::markSet()
 {
-    ListSet::iterator end = markSet.end();
-    for (ListSet::iterator it = markSet.begin(); it != end; ++it) {
+    static ListSet staticMarkSet;
+    return staticMarkSet;
+}
+
+void List::markProtectedListsSlowCase()
+{
+    ListSet::iterator end = markSet().end();
+    for (ListSet::iterator it = markSet().begin(); it != end; ++it) {
         List* list = *it;
 
         iterator end2 = list->end();
@@ -59,10 +65,9 @@ void List::expandAndAppend(JSValue* v)
     // therefore don't need explicit marking. Once our size exceeds
     // our Vector's inline capacity, though, our values move to the 
     // heap, where they do need explicit marking.
-    if (!m_markSet) {
-        ListSet& markSet = Heap::threadHeap()->markListSet();
-        markSet.add(this);
-        m_markSet = &markSet;
+    if (!m_isInMarkSet) {
+        markSet().add(this);
+        m_isInMarkSet = true;
     }
 
     m_vector.uncheckedAppend(v);
index df08976..6a43e08 100644 (file)
@@ -42,14 +42,14 @@ namespace KJS {
         typedef VectorType::const_iterator const_iterator;
 
         List()
-            : m_markSet(0)
+            : m_isInMarkSet(false)
         {
         }
 
         ~List()
         {
-            if (m_markSet)
-                m_markSet->remove(this);
+            if (m_isInMarkSet)
+                markSet().remove(this);
         }
 
         size_t size() const { return m_vector.size(); }
@@ -85,13 +85,21 @@ namespace KJS {
         const_iterator begin() const { return m_vector.begin(); }
         const_iterator end() const { return m_vector.end(); }
 
-        static void markProtectedLists(ListSet&);
+        static void markProtectedLists()
+        {
+            if (!markSet().size())
+                return;
+            markProtectedListsSlowCase();
+        }
 
     private:
+        static ListSet& markSet();
+        static void markProtectedListsSlowCase();
+
         void expandAndAppend(JSValue*);
 
         VectorType m_vector;
-        ListSet* m_markSet;
+        bool m_isInMarkSet;
 
     private:
         // Prohibits new / delete, which would break GC.
index 15acdbf..d6fa857 100644 (file)
@@ -92,7 +92,7 @@ namespace KJS {
         return cachedVal;
 
       const HashEntry* entry = slot.staticEntry();
-      JSValue* val = new (exec) PrototypeFunction(exec, entry->length, propertyName, entry->functionValue);
+      JSValue* val = new PrototypeFunction(exec, entry->length, propertyName, entry->functionValue);
       thisObj->putDirect(propertyName, val, entry->attributes);
       return val;
   }
@@ -232,7 +232,7 @@ namespace KJS {
       ASSERT(obj->isObject());
       return static_cast<JSObject* >(obj);
     }
-    JSObject* newObject = new (exec) ClassCtor(exec);
+    JSObject* newObject = new ClassCtor(exec);
     globalObject->putDirect(propertyName, newObject, DontEnum);
     return newObject;
   }
index 8899474..21fa92c 100644 (file)
@@ -76,25 +76,25 @@ bool MathObjectImp::getOwnPropertySlot(ExecState* exec, const Identifier& proper
     return getStaticPropertySlot<MathObjectImp, JSObject>(exec, ExecState::mathTable(exec), this, propertyName, slot);
 }
 
-JSValue* MathObjectImp::getValueProperty(ExecState* exec, int token) const
+JSValue* MathObjectImp::getValueProperty(ExecState*, int token) const
 {
     switch (token) {
     case Euler:
-        return jsNumber(exec, exp(1.0));
+        return jsNumber(exp(1.0));
     case Ln2:
-        return jsNumber(exec, log(2.0));
+        return jsNumber(log(2.0));
     case Ln10:
-        return jsNumber(exec, log(10.0));
+        return jsNumber(log(10.0));
     case Log2E:
-        return jsNumber(exec, 1.0 / log(2.0));
+        return jsNumber(1.0 / log(2.0));
     case Log10E:
-        return jsNumber(exec, 1.0 / log(10.0));
+        return jsNumber(1.0 / log(10.0));
     case Pi:
-        return jsNumber(exec, piDouble);
+        return jsNumber(piDouble);
     case Sqrt1_2:
-        return jsNumber(exec, sqrt(0.5));
+        return jsNumber(sqrt(0.5));
     case Sqrt2:
-        return jsNumber(exec, sqrt(2.0));
+        return jsNumber(sqrt(2.0));
     }
 
     ASSERT_NOT_REACHED();
@@ -106,58 +106,58 @@ JSValue* MathObjectImp::getValueProperty(ExecState* exec, int token) const
 JSValue* mathProtoFuncAbs(ExecState* exec, JSObject*, const List& args)
 {
     double arg = args[0]->toNumber(exec);
-    return signbit(arg) ? jsNumber(exec, -arg) : jsNumber(exec, arg);
+    return signbit(arg) ? jsNumber(-arg) : jsNumber(arg);
 }
 
 JSValue* mathProtoFuncACos(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, acos(args[0]->toNumber(exec)));
+    return jsNumber(acos(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncASin(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, asin(args[0]->toNumber(exec)));
+    return jsNumber(asin(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncATan(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, atan(args[0]->toNumber(exec)));
+    return jsNumber(atan(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncATan2(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, atan2(args[0]->toNumber(exec), args[1]->toNumber(exec)));
+    return jsNumber(atan2(args[0]->toNumber(exec), args[1]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncCeil(ExecState* exec, JSObject*, const List& args)
 {
     double arg = args[0]->toNumber(exec);
     if (signbit(arg) && arg > -1.0)
-        return jsNumber(exec, -0.0);
-    return jsNumber(exec, ceil(arg));
+        return jsNumber(-0.0);
+    return jsNumber(ceil(arg));
 }
 
 JSValue* mathProtoFuncCos(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, cos(args[0]->toNumber(exec)));
+    return jsNumber(cos(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncExp(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, exp(args[0]->toNumber(exec)));
+    return jsNumber(exp(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncFloor(ExecState* exec, JSObject*, const List& args)
 {
     double arg = args[0]->toNumber(exec);
     if (signbit(arg) && arg == 0.0)
-        return jsNumber(exec, -0.0);
-    return jsNumber(exec, floor(arg));
+        return jsNumber(-0.0);
+    return jsNumber(floor(arg));
 }
 
 JSValue* mathProtoFuncLog(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, log(args[0]->toNumber(exec)));
+    return jsNumber(log(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncMax(ExecState* exec, JSObject*, const List& args)
@@ -173,7 +173,7 @@ JSValue* mathProtoFuncMax(ExecState* exec, JSObject*, const List& args)
         if (val > result || (val == 0 && result == 0 && !signbit(val)))
             result = val;
     }
-    return jsNumber(exec, result);
+    return jsNumber(result);
 }
 
 JSValue* mathProtoFuncMin(ExecState* exec, JSObject*, const List& args)
@@ -189,7 +189,7 @@ JSValue* mathProtoFuncMin(ExecState* exec, JSObject*, const List& args)
         if (val < result || (val == 0 && result == 0 && signbit(val)))
             result = val;
     }
-    return jsNumber(exec, result);
+    return jsNumber(result);
 }
 
 JSValue* mathProtoFuncPow(ExecState* exec, JSObject*, const List& args)
@@ -200,13 +200,13 @@ JSValue* mathProtoFuncPow(ExecState* exec, JSObject*, const List& args)
     double arg2 = args[1]->toNumber(exec);
 
     if (isnan(arg2))
-        return jsNumber(exec, NaN);
+        return jsNumber(NaN);
     if (isinf(arg2) && fabs(arg) == 1)
-        return jsNumber(exec, NaN);
-    return jsNumber(exec, pow(arg, arg2));
+        return jsNumber(NaN);
+    return jsNumber(pow(arg, arg2));
 }
 
-JSValue* mathProtoFuncRandom(ExecState* exec, JSObject*, const List&)
+JSValue* mathProtoFuncRandom(ExecState*, JSObject*, const List&)
 {
 #if !USE(MULTIPLE_THREADS)
     static bool didInitRandom;
@@ -216,30 +216,30 @@ JSValue* mathProtoFuncRandom(ExecState* exec, JSObject*, const List&)
     }
 #endif
 
-    return jsNumber(exec, wtf_random());
+    return jsNumber(wtf_random());
 }
 
 JSValue* mathProtoFuncRound(ExecState* exec, JSObject*, const List& args)
 {
     double arg = args[0]->toNumber(exec);
     if (signbit(arg) && arg >= -0.5)
-         return jsNumber(exec, -0.0);
-    return jsNumber(exec, floor(arg + 0.5));
+         return jsNumber(-0.0);
+    return jsNumber(floor(arg + 0.5));
 }
 
 JSValue* mathProtoFuncSin(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, sin(args[0]->toNumber(exec)));
+    return jsNumber(sin(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncSqrt(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, sqrt(args[0]->toNumber(exec)));
+    return jsNumber(sqrt(args[0]->toNumber(exec)));
 }
 
 JSValue* mathProtoFuncTan(ExecState* exec, JSObject*, const List& args)
 {
-    return jsNumber(exec, tan(args[0]->toNumber(exec)));
+    return jsNumber(tan(args[0]->toNumber(exec)));
 }
 
 } // namespace KJS
index 04d97b4..291223b 100644 (file)
 #include <wtf/HashCountedSet.h>
 #include <wtf/HashSet.h>
 #include <wtf/MathExtras.h>
-#if USE(MULTIPLE_THREADS)
-#include <wtf/ThreadSpecific.h>
-#endif
-
-using namespace WTF;
 
 namespace KJS {
 
@@ -122,7 +117,6 @@ static inline bool isConstant(const LocalStorage& localStorage, size_t index)
 #ifndef LOG_CHANNEL_PREFIX
 #define LOG_CHANNEL_PREFIX Log
 #endif
-
 static WTFLogChannel LogKJSNodeLeaks = { 0x00000000, "", WTFLogChannelOn };
 
 struct ParserRefCountedCounter {
@@ -137,41 +131,18 @@ unsigned ParserRefCountedCounter::count = 0;
 static ParserRefCountedCounter parserRefCountedCounter;
 #endif
 
-static HashSet<ParserRefCounted*>* newTrackedObjects()
-{
-#if USE(MULTIPLE_THREADS)
-    static ThreadSpecific<HashSet<ParserRefCounted*> > sharedInstance;
-    return sharedInstance;
-#else
-    static HashSet<ParserRefCounted*> sharedInstance;
-    return &sharedInstance;
-#endif
-}
-
-static HashCountedSet<ParserRefCounted*>* trackedObjectExtraRefCounts()
-{
-#if USE(MULTIPLE_THREADS)
-    static ThreadSpecific<HashCountedSet<ParserRefCounted*> > sharedInstance;
-    return sharedInstance;
-#else
-    static HashCountedSet<ParserRefCounted*> sharedInstance;
-    return &sharedInstance;
-#endif
-}
-
-void initializeNodesThreading()
-{
-    newTrackedObjects();
-    trackedObjectExtraRefCounts();
-}
+static HashSet<ParserRefCounted*>* newTrackedObjects;
+static HashCountedSet<ParserRefCounted*>* trackedObjectExtraRefCounts;
 
 ParserRefCounted::ParserRefCounted()
 {
 #ifndef NDEBUG
     ++ParserRefCountedCounter::count;
 #endif
-    newTrackedObjects()->add(this);
-    ASSERT(newTrackedObjects()->contains(this));
+    if (!newTrackedObjects)
+        newTrackedObjects = new HashSet<ParserRefCounted*>;
+    newTrackedObjects->add(this);
+    ASSERT(newTrackedObjects->contains(this));
 }
 
 ParserRefCounted::~ParserRefCounted()
@@ -183,60 +154,67 @@ ParserRefCounted::~ParserRefCounted()
 
 void ParserRefCounted::ref()
 {
-    HashSet<ParserRefCounted*>* localNewTrackedObjects = newTrackedObjects();
-
     // bumping from 0 to 1 is just removing from the new nodes set
-    HashSet<ParserRefCounted*>::iterator it = localNewTrackedObjects->find(this);
-    if (it != localNewTrackedObjects->end()) {
-        localNewTrackedObjects->remove(it);
-        ASSERT(!trackedObjectExtraRefCounts()->contains(this));
-        return;
+    if (newTrackedObjects) {
+        HashSet<ParserRefCounted*>::iterator it = newTrackedObjects->find(this);
+        if (it != newTrackedObjects->end()) {
+            newTrackedObjects->remove(it);
+            ASSERT(!trackedObjectExtraRefCounts || !trackedObjectExtraRefCounts->contains(this));
+            return;
+        }
     }
 
-    ASSERT(!localNewTrackedObjects->contains(this));
+    ASSERT(!newTrackedObjects || !newTrackedObjects->contains(this));
 
-    trackedObjectExtraRefCounts()->add(this);
+    if (!trackedObjectExtraRefCounts)
+        trackedObjectExtraRefCounts = new HashCountedSet<ParserRefCounted*>;
+    trackedObjectExtraRefCounts->add(this);
 }
 
 void ParserRefCounted::deref()
 {
-    ASSERT(!newTrackedObjects()->contains(this));
-    HashCountedSet<ParserRefCounted*>* localTrackedObjectExtraRefCounts = trackedObjectExtraRefCounts();
+    ASSERT(!newTrackedObjects || !newTrackedObjects->contains(this));
+
+    if (!trackedObjectExtraRefCounts) {
+        delete this;
+        return;
+    }
 
-    HashCountedSet<ParserRefCounted*>::iterator it = localTrackedObjectExtraRefCounts->find(this);
-    if (it == localTrackedObjectExtraRefCounts->end())
+    HashCountedSet<ParserRefCounted*>::iterator it = trackedObjectExtraRefCounts->find(this);
+    if (it == trackedObjectExtraRefCounts->end())
         delete this;
     else
-        localTrackedObjectExtraRefCounts->remove(it);
+        trackedObjectExtraRefCounts->remove(it);
 }
 
 unsigned ParserRefCounted::refcount()
 {
-    HashCountedSet<ParserRefCounted*>* localTrackedObjectExtraRefCounts = trackedObjectExtraRefCounts();
-
-    if (newTrackedObjects()->contains(this)) {
-        ASSERT(!localTrackedObjectExtraRefCounts->contains(this));
+    if (newTrackedObjects && newTrackedObjects->contains(this)) {
+        ASSERT(!trackedObjectExtraRefCounts || !trackedObjectExtraRefCounts->contains(this));
         return 0;
     }
 
-    ASSERT(!newTrackedObjects()->contains(this));
+    ASSERT(!newTrackedObjects || !newTrackedObjects->contains(this));
 
-    if (!localTrackedObjectExtraRefCounts)
+    if (!trackedObjectExtraRefCounts)
         return 1;
 
-    return 1 + localTrackedObjectExtraRefCounts->count(this);
+    return 1 + trackedObjectExtraRefCounts->count(this);
 }
 
 void ParserRefCounted::deleteNewObjects()
 {
-    HashSet<ParserRefCounted*>* localNewTrackedObjects = newTrackedObjects();
+    if (!newTrackedObjects)
+        return;
+
 #ifndef NDEBUG
-    HashSet<ParserRefCounted*>::iterator end = localNewTrackedObjects->end();
-    for (HashSet<ParserRefCounted*>::iterator it = localNewTrackedObjects->begin(); it != end; ++it)
-        ASSERT(!trackedObjectExtraRefCounts()->contains(*it));
+    HashSet<ParserRefCounted*>::iterator end = newTrackedObjects->end();
+    for (HashSet<ParserRefCounted*>::iterator it = newTrackedObjects->begin(); it != end; ++it)
+        ASSERT(!trackedObjectExtraRefCounts || !trackedObjectExtraRefCounts->contains(*it));
 #endif
-    deleteAllValues(*localNewTrackedObjects);
-    localNewTrackedObjects->clear();
+    deleteAllValues(*newTrackedObjects);
+    delete newTrackedObjects;
+    newTrackedObjects = 0;
 }
 
 Node::Node()
@@ -382,8 +360,8 @@ void Node::handleException(ExecState* exec, JSValue* exceptionValue)
     if (exceptionValue->isObject()) {
         JSObject* exception = static_cast<JSObject*>(exceptionValue);
         if (!exception->hasProperty(exec, "line") && !exception->hasProperty(exec, "sourceURL")) {
-            exception->put(exec, "line", jsNumber(exec, m_line));
-            exception->put(exec, "sourceURL", jsString(exec, currentSourceURL(exec)));
+            exception->put(exec, "line", jsNumber(m_line));
+            exception->put(exec, "sourceURL", jsString(currentSourceURL(exec)));
         }
     }
     Debugger* dbg = exec->dynamicGlobalObject()->debugger();
@@ -475,10 +453,10 @@ JSValue* TrueNode::evaluate(ExecState*)
 
 // ------------------------------ NumberNode -----------------------------------
 
-JSValue* NumberNode::evaluate(ExecState* exec)
+JSValue* NumberNode::evaluate(ExecState*)
 {
     // Number nodes are only created when the number can't fit in a JSImmediate, so no need to check again.
-    return jsNumberCell(exec, m_double);
+    return jsNumberCell(m_double);
 }
 
 double NumberNode::evaluateToNumber(ExecState*)
@@ -524,9 +502,9 @@ uint32_t ImmediateNumberNode::evaluateToUInt32(ExecState*)
 
 // ------------------------------ StringNode -----------------------------------
 
-JSValue* StringNode::evaluate(ExecState* exec)
+JSValue* StringNode::evaluate(ExecState*)
 {
-    return jsOwnedString(exec, m_value);
+    return jsOwnedString(m_value);
 }
 
 double StringNode::evaluateToNumber(ExecState*)
@@ -841,7 +819,7 @@ JSValue* ArrayNode::evaluate(ExecState* exec)
     }
 
     if (m_optional)
-        array->put(exec, exec->propertyNames().length, jsNumber(exec, m_elision + length));
+        array->put(exec, exec->propertyNames().length, jsNumber(m_elision + length));
 
     return array;
 }
@@ -1588,7 +1566,7 @@ JSValue* PostIncResolveNode::evaluate(ExecState* exec)
             
             JSObject* base = *iter;
             JSValue* v = slot.getValue(exec, base, m_ident)->toJSNumber(exec);
-            base->put(exec, m_ident, jsNumber(exec, v->toNumber(exec) + 1));
+            base->put(exec, m_ident, jsNumber(v->toNumber(exec) + 1));
             return v;
         }
 
@@ -1609,7 +1587,7 @@ JSValue* PostIncLocalVarNode::evaluate(ExecState* exec)
 
     JSValue** slot = &exec->localStorage()[m_index].value;
     JSValue* v = (*slot)->toJSNumber(exec);
-    *slot = jsNumber(exec, v->toNumber(exec) + 1);
+    *slot = jsNumber(v->toNumber(exec) + 1);
     return v;
 }
 
@@ -1649,7 +1627,7 @@ JSValue* PostDecResolveNode::evaluate(ExecState* exec)
 
             JSObject* base = *iter;
             JSValue* v = slot.getValue(exec, base, m_ident)->toJSNumber(exec);
-            base->put(exec, m_ident, jsNumber(exec, v->toNumber(exec) - 1));
+            base->put(exec, m_ident, jsNumber(v->toNumber(exec) - 1));
             return v;
         }
 
@@ -1670,7 +1648,7 @@ JSValue* PostDecLocalVarNode::evaluate(ExecState* exec)
 
     JSValue** slot = &exec->localStorage()[m_index].value;
     JSValue* v = (*slot)->toJSNumber(exec);
-    *slot = jsNumber(exec, v->toNumber(exec) - 1);
+    *slot = jsNumber(v->toNumber(exec) - 1);
     return v;
 }
 
@@ -1680,7 +1658,7 @@ double PostDecLocalVarNode::inlineEvaluateToNumber(ExecState* exec)
 
     JSValue** slot = &exec->localStorage()[m_index].value;
     double n = (*slot)->toNumber(exec);
-    *slot = jsNumber(exec, n - 1);
+    *slot = jsNumber(n - 1);
     return n;
 }
 
@@ -1734,7 +1712,7 @@ JSValue* PostIncBracketNode::evaluate(ExecState* exec)
         KJS_CHECKEXCEPTIONVALUE
 
         JSValue* v2 = v->toJSNumber(exec);
-        base->put(exec, propertyIndex, jsNumber(exec, v2->toNumber(exec) + 1));
+        base->put(exec, propertyIndex, jsNumber(v2->toNumber(exec) + 1));
 
         return v2;
     }
@@ -1745,7 +1723,7 @@ JSValue* PostIncBracketNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     JSValue* v2 = v->toJSNumber(exec);
-    base->put(exec, propertyName, jsNumber(exec, v2->toNumber(exec) + 1));
+    base->put(exec, propertyName, jsNumber(v2->toNumber(exec) + 1));
     return v2;
 }
 
@@ -1765,7 +1743,7 @@ JSValue* PostDecBracketNode::evaluate(ExecState* exec)
         KJS_CHECKEXCEPTIONVALUE
 
         JSValue* v2 = v->toJSNumber(exec);
-        base->put(exec, propertyIndex, jsNumber(exec, v2->toNumber(exec) - 1));
+        base->put(exec, propertyIndex, jsNumber(v2->toNumber(exec) - 1));
         return v2;
     }
 
@@ -1775,7 +1753,7 @@ JSValue* PostDecBracketNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     JSValue* v2 = v->toJSNumber(exec);
-    base->put(exec, propertyName, jsNumber(exec, v2->toNumber(exec) - 1));
+    base->put(exec, propertyName, jsNumber(v2->toNumber(exec) - 1));
     return v2;
 }
 
@@ -1797,7 +1775,7 @@ JSValue* PostIncDotNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     JSValue* v2 = v->toJSNumber(exec);
-    base->put(exec, m_ident, jsNumber(exec, v2->toNumber(exec) + 1));
+    base->put(exec, m_ident, jsNumber(v2->toNumber(exec) + 1));
     return v2;
 }
 
@@ -1812,7 +1790,7 @@ JSValue* PostDecDotNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     JSValue* v2 = v->toJSNumber(exec);
-    base->put(exec, m_ident, jsNumber(exec, v2->toNumber(exec) - 1));
+    base->put(exec, m_ident, jsNumber(v2->toNumber(exec) - 1));
     return v2;
 }
 
@@ -1949,31 +1927,31 @@ void TypeOfValueNode::optimizeVariableAccess(ExecState*, const SymbolTable&, con
     nodeStack.append(m_expr.get());
 }
 
-static JSValue* typeStringForValue(ExecState*, JSValue*) KJS_FAST_CALL;
-static JSValue* typeStringForValue(ExecState* exec, JSValue* v)
+static JSValue* typeStringForValue(JSValue* v) KJS_FAST_CALL;
+static JSValue* typeStringForValue(JSValue* v)
 {
     switch (v->type()) {
         case UndefinedType:
-            return jsString(exec, "undefined");
+            return jsString("undefined");
         case NullType:
-            return jsString(exec, "object");
+            return jsString("object");
         case BooleanType:
-            return jsString(exec, "boolean");
+            return jsString("boolean");
         case NumberType:
-            return jsString(exec, "number");
+            return jsString("number");
         case StringType:
-            return jsString(exec, "string");
+            return jsString("string");
         default:
             if (v->isObject()) {
                 // Return "undefined" for objects that should be treated
                 // as null when doing comparisons.
                 if (static_cast<JSObject*>(v)->masqueradeAsUndefined())
-                    return jsString(exec, "undefined");
+                    return jsString("undefined");
                 else if (static_cast<JSObject*>(v)->implementsCall())
-                    return jsString(exec, "function");
+                    return jsString("function");
             }
 
-            return jsString(exec, "object");
+            return jsString("object");
     }
 }
 
@@ -1988,7 +1966,7 @@ JSValue* LocalVarTypeOfNode::evaluate(ExecState* exec)
 {
     ASSERT(exec->variableObject() == exec->scopeChain().top());
 
-    return typeStringForValue(exec, exec->localStorage()[m_index].value);
+    return typeStringForValue(exec->localStorage()[m_index].value);
 }
 
 JSValue* TypeOfResolveNode::evaluate(ExecState* exec)
@@ -2006,13 +1984,13 @@ JSValue* TypeOfResolveNode::evaluate(ExecState* exec)
         base = *iter;
         if (base->getPropertySlot(exec, m_ident, slot)) {
             JSValue* v = slot.getValue(exec, base, m_ident);
-            return typeStringForValue(exec, v);
+            return typeStringForValue(v);
         }
 
         ++iter;
     } while (iter != end);
 
-    return jsString(exec, "undefined");
+    return jsString("undefined");
 }
 
 // ------------------------------ TypeOfValueNode -----------------------------------
@@ -2022,7 +2000,7 @@ JSValue* TypeOfValueNode::evaluate(ExecState* exec)
     JSValue* v = m_expr->evaluate(exec);
     KJS_CHECKEXCEPTIONVALUE
 
-    return typeStringForValue(exec, v);
+    return typeStringForValue(v);
 }
 
 // ECMA 11.4.4 and 11.4.5
@@ -2046,7 +2024,7 @@ JSValue* PreIncLocalVarNode::evaluate(ExecState* exec)
     JSValue** slot = &exec->localStorage()[m_index].value;
 
     double n = (*slot)->toNumber(exec);
-    JSValue* n2 = jsNumber(exec, n + 1);
+    JSValue* n2 = jsNumber(n + 1);
     *slot = n2;
     return n2;
 }
@@ -2069,7 +2047,7 @@ JSValue* PreIncResolveNode::evaluate(ExecState* exec)
             JSValue* v = slot.getValue(exec, base, m_ident);
 
             double n = v->toNumber(exec);
-            JSValue* n2 = jsNumber(exec, n + 1);
+            JSValue* n2 = jsNumber(n + 1);
             base->put(exec, m_ident, n2);
 
             return n2;
@@ -2098,7 +2076,7 @@ JSValue* PreDecLocalVarNode::evaluate(ExecState* exec)
     JSValue** slot = &exec->localStorage()[m_index].value;
 
     double n = (*slot)->toNumber(exec);
-    JSValue* n2 = jsNumber(exec, n - 1);
+    JSValue* n2 = jsNumber(n - 1);
     *slot = n2;
     return n2;
 }
@@ -2121,7 +2099,7 @@ JSValue* PreDecResolveNode::evaluate(ExecState* exec)
             JSValue* v = slot.getValue(exec, base, m_ident);
 
             double n = v->toNumber(exec);
-            JSValue* n2 = jsNumber(exec, n - 1);
+            JSValue* n2 = jsNumber(n - 1);
             base->put(exec, m_ident, n2);
 
             return n2;
@@ -2138,7 +2116,7 @@ JSValue* PreDecResolveNode::evaluate(ExecState* exec)
 JSValue* PreIncConstNode::evaluate(ExecState* exec)
 {
     ASSERT(exec->variableObject() == exec->scopeChain().top());
-    return jsNumber(exec, exec->localStorage()[m_index].value->toNumber(exec) + 1);
+    return jsNumber(exec->localStorage()[m_index].value->toNumber(exec) + 1);
 }
 
 // ------------------------------ PreDecConstNode ----------------------------------
@@ -2146,7 +2124,7 @@ JSValue* PreIncConstNode::evaluate(ExecState* exec)
 JSValue* PreDecConstNode::evaluate(ExecState* exec)
 {
     ASSERT(exec->variableObject() == exec->scopeChain().top());
-    return jsNumber(exec, exec->localStorage()[m_index].value->toNumber(exec) - 1);
+    return jsNumber(exec->localStorage()[m_index].value->toNumber(exec) - 1);
 }
 
 // ------------------------------ PostIncConstNode ----------------------------------
@@ -2154,7 +2132,7 @@ JSValue* PreDecConstNode::evaluate(ExecState* exec)
 JSValue* PostIncConstNode::evaluate(ExecState* exec)
 {
     ASSERT(exec->variableObject() == exec->scopeChain().top());
-    return jsNumber(exec, exec->localStorage()[m_index].value->toNumber(exec));
+    return jsNumber(exec->localStorage()[m_index].value->toNumber(exec));
 }
 
 // ------------------------------ PostDecConstNode ----------------------------------
@@ -2162,7 +2140,7 @@ JSValue* PostIncConstNode::evaluate(ExecState* exec)
 JSValue* PostDecConstNode::evaluate(ExecState* exec)
 {
     ASSERT(exec->variableObject() == exec->scopeChain().top());
-    return jsNumber(exec, exec->localStorage()[m_index].value->toNumber(exec));
+    return jsNumber(exec->localStorage()[m_index].value->toNumber(exec));
 }
 
 // ------------------------------ PrefixBracketNode ----------------------------------
@@ -2188,7 +2166,7 @@ JSValue* PreIncBracketNode::evaluate(ExecState* exec)
         JSValue* v = base->getPropertySlot(exec, propertyIndex, slot) ? slot.getValue(exec, base, propertyIndex) : jsUndefined();
         KJS_CHECKEXCEPTIONVALUE
 
-        JSValue* n2 = jsNumber(exec, v->toNumber(exec) + 1);
+        JSValue* n2 = jsNumber(v->toNumber(exec) + 1);
         base->put(exec, propertyIndex, n2);
 
         return n2;
@@ -2199,7 +2177,7 @@ JSValue* PreIncBracketNode::evaluate(ExecState* exec)
     JSValue* v = base->getPropertySlot(exec, propertyName, slot) ? slot.getValue(exec, base, propertyName) : jsUndefined();
     KJS_CHECKEXCEPTIONVALUE
 
-    JSValue* n2 = jsNumber(exec, v->toNumber(exec) + 1);
+    JSValue* n2 = jsNumber(v->toNumber(exec) + 1);
     base->put(exec, propertyName, n2);
 
     return n2;
@@ -2220,7 +2198,7 @@ JSValue* PreDecBracketNode::evaluate(ExecState* exec)
         JSValue* v = base->getPropertySlot(exec, propertyIndex, slot) ? slot.getValue(exec, base, propertyIndex) : jsUndefined();
         KJS_CHECKEXCEPTIONVALUE
 
-        JSValue* n2 = jsNumber(exec, v->toNumber(exec) - 1);
+        JSValue* n2 = jsNumber(v->toNumber(exec) - 1);
         base->put(exec, propertyIndex, n2);
 
         return n2;
@@ -2231,7 +2209,7 @@ JSValue* PreDecBracketNode::evaluate(ExecState* exec)
     JSValue* v = base->getPropertySlot(exec, propertyName, slot) ? slot.getValue(exec, base, propertyName) : jsUndefined();
     KJS_CHECKEXCEPTIONVALUE
 
-    JSValue* n2 = jsNumber(exec, v->toNumber(exec) - 1);
+    JSValue* n2 = jsNumber(v->toNumber(exec) - 1);
     base->put(exec, propertyName, n2);
 
     return n2;
@@ -2255,7 +2233,7 @@ JSValue* PreIncDotNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     double n = v->toNumber(exec);
-    JSValue* n2 = jsNumber(exec, n + 1);
+    JSValue* n2 = jsNumber(n + 1);
     base->put(exec, m_ident, n2);
 
     return n2;
@@ -2272,7 +2250,7 @@ JSValue* PreDecDotNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     double n = v->toNumber(exec);
-    JSValue* n2 = jsNumber(exec, n - 1);
+    JSValue* n2 = jsNumber(n - 1);
     base->put(exec, m_ident, n2);
 
     return n2;
@@ -2334,7 +2312,7 @@ void NegateNode::optimizeVariableAccess(ExecState*, const SymbolTable&, const Lo
 JSValue* NegateNode::evaluate(ExecState* exec)
 {
     // No need to check exception, caller will do so right after evaluate()
-    return jsNumber(exec, -m_expr->evaluateToNumber(exec));
+    return jsNumber(-m_expr->evaluateToNumber(exec));
 }
 
 double NegateNode::evaluateToNumber(ExecState* exec)
@@ -2358,7 +2336,7 @@ int32_t BitwiseNotNode::inlineEvaluateToInt32(ExecState* exec)
 
 JSValue* BitwiseNotNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToInt32(exec));
+    return jsNumber(inlineEvaluateToInt32(exec));
 }
 
 double BitwiseNotNode::evaluateToNumber(ExecState* exec)
@@ -2418,7 +2396,7 @@ double MultNode::inlineEvaluateToNumber(ExecState* exec)
 
 JSValue* MultNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToNumber(exec));
+    return jsNumber(inlineEvaluateToNumber(exec));
 }
 
 double MultNode::evaluateToNumber(ExecState* exec)
@@ -2459,7 +2437,7 @@ double DivNode::inlineEvaluateToNumber(ExecState* exec)
 
 JSValue* DivNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToNumber(exec));
+    return jsNumber(inlineEvaluateToNumber(exec));
 }
 
 double DivNode::evaluateToNumber(ExecState* exec)
@@ -2494,7 +2472,7 @@ double ModNode::inlineEvaluateToNumber(ExecState* exec)
 
 JSValue* ModNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToNumber(exec));
+    return jsNumber(inlineEvaluateToNumber(exec));
 }
 
 double ModNode::evaluateToNumber(ExecState* exec)
@@ -2545,10 +2523,10 @@ static JSValue* addSlowCase(ExecState* exec, JSValue* v1, JSValue* v2)
         UString value = p1->toString(exec) + p2->toString(exec);
         if (value.isNull())
             return throwOutOfMemoryError(exec);
-        return jsString(exec, value);
+        return jsString(value);
     }
 
-    return jsNumber(exec, p1->toNumber(exec) + p2->toNumber(exec));
+    return jsNumber(p1->toNumber(exec) + p2->toNumber(exec));
 }
 
 static double addSlowCaseToNumber(ExecState* exec, JSValue* v1, JSValue* v2)
@@ -2584,12 +2562,12 @@ static inline JSValue* add(ExecState* exec, JSValue* v1, JSValue* v2)
     const unsigned bothTypes = (t1 << 3) | t2;
 
     if (bothTypes == ((NumberType << 3) | NumberType))
-        return jsNumber(exec, v1->toNumber(exec) + v2->toNumber(exec));
+        return jsNumber(v1->toNumber(exec) + v2->toNumber(exec));
     if (bothTypes == ((StringType << 3) | StringType)) {
         UString value = static_cast<StringImp*>(v1)->value() + static_cast<StringImp*>(v2)->value();
         if (value.isNull())
             return throwOutOfMemoryError(exec);
-        return jsString(exec, value);
+        return jsString(value);
     }
 
     // All other cases are pretty uncommon
@@ -2669,7 +2647,7 @@ double AddNumbersNode::inlineEvaluateToNumber(ExecState* exec)
 
 JSValue* AddNumbersNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToNumber(exec));
+    return jsNumber(inlineEvaluateToNumber(exec));
 }
 
 double AddNumbersNode::evaluateToNumber(ExecState* exec)
@@ -2695,7 +2673,7 @@ JSValue* AddStringsNode::evaluate(ExecState* exec)
     JSValue* v2 = m_term2->evaluate(exec);
     KJS_CHECKEXCEPTIONVALUE
 
-    return jsString(exec, static_cast<StringImp*>(v1)->value() + static_cast<StringImp*>(v2)->value());
+    return jsString(static_cast<StringImp*>(v1)->value() + static_cast<StringImp*>(v2)->value());
 }
 
 JSValue* AddStringLeftNode::evaluate(ExecState* exec)
@@ -2707,7 +2685,7 @@ JSValue* AddStringLeftNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     JSValue* p2 = v2->toPrimitive(exec, UnspecifiedType);
-    return jsString(exec, static_cast<StringImp*>(v1)->value() + p2->toString(exec));
+    return jsString(static_cast<StringImp*>(v1)->value() + p2->toString(exec));
 }
 
 JSValue* AddStringRightNode::evaluate(ExecState* exec)
@@ -2719,7 +2697,7 @@ JSValue* AddStringRightNode::evaluate(ExecState* exec)
     KJS_CHECKEXCEPTIONVALUE
 
     JSValue* p1 = v1->toPrimitive(exec, UnspecifiedType);
-    return jsString(exec, p1->toString(exec) + static_cast<StringImp*>(v2)->value());
+    return jsString(p1->toString(exec) + static_cast<StringImp*>(v2)->value());
 }
 
 void SubNode::optimizeVariableAccess(ExecState*, const SymbolTable&, const LocalStorage&, NodeStack& nodeStack)
@@ -2739,7 +2717,7 @@ double SubNode::inlineEvaluateToNumber(ExecState* exec)
 
 JSValue* SubNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToNumber(exec));
+    return jsNumber(inlineEvaluateToNumber(exec));
 }
 
 double SubNode::evaluateToNumber(ExecState* exec)
@@ -2776,7 +2754,7 @@ int32_t LeftShiftNode::inlineEvaluateToInt32(ExecState* exec)
 
 JSValue* LeftShiftNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToInt32(exec));
+    return jsNumber(inlineEvaluateToInt32(exec));
 }
 
 double LeftShiftNode::evaluateToNumber(ExecState* exec)
@@ -2811,7 +2789,7 @@ int32_t RightShiftNode::inlineEvaluateToInt32(ExecState* exec)
 
 JSValue* RightShiftNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToInt32(exec));
+    return jsNumber(inlineEvaluateToInt32(exec));
 }
 
 double RightShiftNode::evaluateToNumber(ExecState* exec)
@@ -2846,7 +2824,7 @@ uint32_t UnsignedRightShiftNode::inlineEvaluateToUInt32(ExecState* exec)
 
 JSValue* UnsignedRightShiftNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToUInt32(exec));
+    return jsNumber(inlineEvaluateToUInt32(exec));
 }
 
 double UnsignedRightShiftNode::evaluateToNumber(ExecState* exec)
@@ -3297,7 +3275,7 @@ int32_t BitXOrNode::inlineEvaluateToInt32(ExecState* exec)
 
 JSValue* BitXOrNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToInt32(exec));
+    return jsNumber(inlineEvaluateToInt32(exec));
 }
 
 double BitXOrNode::evaluateToNumber(ExecState* exec)
@@ -3336,7 +3314,7 @@ int32_t BitOrNode::inlineEvaluateToInt32(ExecState* exec)
 
 JSValue* BitOrNode::evaluate(ExecState* exec)
 {
-    return jsNumber(exec, inlineEvaluateToInt32(exec));
+    return jsNumber(inlineEvaluateToInt32(exec));
 }
 
 double BitOrNode::evaluateToNumber(ExecState* exec)
@@ -3466,51 +3444,51 @@ static ALWAYS_INLINE JSValue* valueForReadModifyAssignment(ExecState* exec, JSVa
     unsigned int ui;
     switch (oper) {
         case OpMultEq:
-            v = jsNumber(exec, current->toNumber(exec) * right->evaluateToNumber(exec));
+            v = jsNumber(current->toNumber(exec) * right->evaluateToNumber(exec));
             break;
         case OpDivEq:
-            v = jsNumber(exec, current->toNumber(exec) / right->evaluateToNumber(exec));
+            v = jsNumber(current->toNumber(exec) / right->evaluateToNumber(exec));
             break;
         case OpPlusEq:
             v = add(exec, current, right->evaluate(exec));
             break;
         case OpMinusEq:
-            v = jsNumber(exec, current->toNumber(exec) - right->evaluateToNumber(exec));
+            v = jsNumber(current->toNumber(exec) - right->evaluateToNumber(exec));
             break;
         case OpLShift:
             i1 = current->toInt32(exec);
             i2 = right->evaluateToInt32(exec);
-            v = jsNumber(exec, i1 << i2);
+            v = jsNumber(i1 << i2);
             break;
         case OpRShift:
             i1 = current->toInt32(exec);
             i2 = right->evaluateToInt32(exec);
-            v = jsNumber(exec, i1 >> i2);
+            v = jsNumber(i1 >> i2);
             break;
         case OpURShift:
             ui = current->toUInt32(exec);
             i2 = right->evaluateToInt32(exec);
-            v = jsNumber(exec, ui >> i2);
+            v = jsNumber(ui >> i2);
             break;
         case OpAndEq:
             i1 = current->toInt32(exec);
             i2 = right->evaluateToInt32(exec);
-            v = jsNumber(exec, i1 & i2);
+            v = jsNumber(i1 & i2);
             break;
         case OpXOrEq:
             i1 = current->toInt32(exec);
             i2 = right->evaluateToInt32(exec);
-            v = jsNumber(exec, i1 ^ i2);
+            v = jsNumber(i1 ^ i2);
             break;
         case OpOrEq:
             i1 = current->toInt32(exec);
             i2 = right->evaluateToInt32(exec);
-            v = jsNumber(exec, i1 | i2);
+            v = jsNumber(i1 | i2);
             break;
         case OpModEq: {
             double d1 = current->toNumber(exec);
             double d2 = right->evaluateToNumber(exec);
-            v = jsNumber(exec, fmod(d1, d2));
+            v = jsNumber(fmod(d1, d2));
         }
             break;
         default:
@@ -4262,7 +4240,7 @@ JSValue* ForInNode::execute(ExecState* exec)
         if (!v->hasProperty(exec, name))
             continue;
 
-        JSValue* str = jsOwnedString(exec, name.ustring());
+        JSValue* str = jsOwnedString(name.ustring());
 
         if (m_lexpr->isResolveNode()) {
             const Identifier& ident = static_cast<ResolveNode*>(m_lexpr.get())->identifier();
@@ -4588,7 +4566,7 @@ JSValue* TryNode::execute(ExecState* exec)
     JSValue* result = m_tryBlock->execute(exec);
 
     if (m_catchBlock && exec->completionType() == Throw) {
-        JSObject* obj = new (exec) JSObject;
+        JSObject* obj = new JSObject;
         obj->putDirect(m_exceptionIdent, result, DontDelete);
         exec->dynamicGlobalObject()->tearOffActivation(exec);
         exec->pushScope(obj);
@@ -4948,12 +4926,12 @@ void FuncDeclNode::addParams()
 
 FunctionImp* FuncDeclNode::makeFunction(ExecState* exec)
 {
-    FunctionImp* func = new (exec) FunctionImp(exec, m_ident, m_body.get(), exec->scopeChain());
+    FunctionImp* func = new FunctionImp(exec, m_ident, m_body.get(), exec->scopeChain());
 
     JSObject* proto = exec->lexicalGlobalObject()->objectConstructor()->construct(exec, exec->emptyList());
     proto->putDirect(exec->propertyNames().constructor, func, DontEnum);
     func->putDirect(exec->propertyNames().prototype, proto, DontDelete);
-    func->putDirect(exec->propertyNames().length, jsNumber(exec, m_body->parameters().size()), ReadOnly | DontDelete | DontEnum);
+    func->putDirect(exec->propertyNames().length, jsNumber(m_body->parameters().size()), ReadOnly | DontDelete | DontEnum);
     return func;
 }
 
@@ -4982,11 +4960,11 @@ JSValue* FuncExprNode::evaluate(ExecState* exec)
         // named FunctionExpressions can recursively call themselves,
         // but they won't register with the current scope chain and should
         // be contained as single property in an anonymous object.
-        functionScopeObject = new (exec) JSObject;
+        functionScopeObject = new JSObject;
         exec->pushScope(functionScopeObject);
     }
 
-    FunctionImp* func = new (exec) FunctionImp(exec, m_ident, m_body.get(), exec->scopeChain());
+    FunctionImp* func = new FunctionImp(exec, m_ident, m_body.get(), exec->scopeChain());
     JSObject* proto = exec->lexicalGlobalObject()->objectConstructor()->construct(exec, exec->emptyList());
     proto->putDirect(exec->propertyNames().constructor, func, DontEnum);
     func->putDirect(exec->propertyNames().prototype, proto, DontDelete);
index bda3a89..6a086d0 100644 (file)
@@ -3009,8 +3009,6 @@ namespace KJS {
         ClauseListNode* tail;
     };
 
-    void initializeNodesThreading();
-
 } // namespace KJS
 
 #endif // NODES_H_
index ccc5acc..b72c0e6 100644 (file)
@@ -55,16 +55,16 @@ static JSValue* numberProtoFuncToPrecision(ExecState*, JSObject*, const List&);
 NumberPrototype::NumberPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
     : NumberInstance(objectPrototype)
 {
-    setInternalValue(jsNumber(exec, 0));
+    setInternalValue(jsNumber(0));
 
     // The constructor will be added later, after NumberObjectImp has been constructed
 
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);
 }
 
 // ------------------------------ Functions ---------------------------
@@ -151,7 +151,7 @@ JSValue* numberProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&
 
     double radixAsDouble = args[0]->toInteger(exec); // nan -> 0
     if (radixAsDouble == 10 || args[0]->isUndefined())
-        return jsString(exec, v->toString(exec));
+        return jsString(v->toString(exec));
 
     if (radixAsDouble < 2 || radixAsDouble > 36)
         return throwError(exec, RangeError, "toString() radix argument must be between 2 and 36");
@@ -165,7 +165,7 @@ JSValue* numberProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&
     const char* lastCharInString = s + sizeof(s) - 1;
     double x = v->toNumber(exec);
     if (isnan(x) || isinf(x))
-        return jsString(exec, UString::from(x));
+        return jsString(UString::from(x));
 
     bool isNegative = x < 0.0;
     if (isNegative)
@@ -204,7 +204,7 @@ JSValue* numberProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&
     *p = '\0';
     ASSERT(p < s + sizeof(s));
 
-    return jsString(exec, startOfResultString);
+    return jsString(startOfResultString);
 }
 
 JSValue* numberProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const List&)
@@ -213,7 +213,7 @@ JSValue* numberProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const
         return throwError(exec, TypeError);
 
     // TODO
-    return jsString(exec, static_cast<NumberInstance*>(thisObj)->internalValue()->toString(exec));
+    return jsString(static_cast<NumberInstance*>(thisObj)->internalValue()->toString(exec));
 }
 
 JSValue* numberProtoFuncValueOf(ExecState* exec, JSObject* thisObj, const List&)
@@ -239,7 +239,7 @@ JSValue* numberProtoFuncToFixed(ExecState* exec, JSObject* thisObj, const List&
 
     double x = v->toNumber(exec);
     if (isnan(x))
-        return jsString(exec, "NaN");
+        return jsString("NaN");
 
     UString s;
     if (x < 0) {
@@ -249,7 +249,7 @@ JSValue* numberProtoFuncToFixed(ExecState* exec, JSObject* thisObj, const List&
         x = 0;
 
     if (x >= pow(10.0, 21.0))
-        return jsString(exec, s + UString::from(x));
+        return jsString(s + UString::from(x));
 
     const double tenToTheF = pow(10.0, f);
     double n = floor(x * tenToTheF);
@@ -269,8 +269,8 @@ JSValue* numberProtoFuncToFixed(ExecState* exec, JSObject* thisObj, const List&
     }
     int kMinusf = k - f;
     if (kMinusf < m.size())
-        return jsString(exec, s + m.substr(0, kMinusf) + "." + m.substr(kMinusf));
-    return jsString(exec, s + m.substr(0, kMinusf));
+        return jsString(s + m.substr(0, kMinusf) + "." + m.substr(kMinusf));
+    return jsString(s + m.substr(0, kMinusf));
 }
 
 static void fractionalPartToString(char* buf, int& i, const char* result, int resultLength, int fractionalDigits)
@@ -320,7 +320,7 @@ JSValue* numberProtoFuncToExponential(ExecState* exec, JSObject* thisObj, const
     double x = v->toNumber(exec);
 
     if (isnan(x) || isinf(x))
-        return jsString(exec, UString::from(x));
+        return jsString(UString::from(x));
 
     JSValue* fractionalDigitsValue = args[0];
     double df = fractionalDigitsValue->toInteger(exec);
@@ -346,7 +346,7 @@ JSValue* numberProtoFuncToExponential(ExecState* exec, JSObject* thisObj, const
     }
 
     if (isnan(x))
-        return jsString(exec, "NaN");
+        return jsString("NaN");
 
     if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0
         x = 0;
@@ -378,7 +378,7 @@ JSValue* numberProtoFuncToExponential(ExecState* exec, JSObject* thisObj, const
 
     freedtoa(result);
 
-    return jsString(exec, buf);
+    return jsString(buf);
 }
 
 JSValue* numberProtoFuncToPrecision(ExecState* exec, JSObject* thisObj, const List& args)
@@ -391,7 +391,7 @@ JSValue* numberProtoFuncToPrecision(ExecState* exec, JSObject* thisObj, const Li
     double doublePrecision = args[0]->toIntegerPreserveNaN(exec);
     double x = v->toNumber(exec);
     if (args[0]->isUndefined() || isnan(x) || isinf(x))
-        return jsString(exec, v->toString(exec));
+        return jsString(v->toString(exec));
 
     UString s;
     if (x < 0) {
@@ -430,8 +430,8 @@ JSValue* numberProtoFuncToPrecision(ExecState* exec, JSObject* thisObj, const Li
             if (m.size() > 1)
                 m = m.substr(0, 1) + "." + m.substr(1);
             if (e >= 0)
-                return jsString(exec, s + m + "e+" + UString::from(e));
-            return jsString(exec, s + m + "e-" + UString::from(-e));
+                return jsString(s + m + "e+" + UString::from(e));
+            return jsString(s + m + "e-" + UString::from(-e));
         }
     } else {
         m = char_sequence('0', precision);
@@ -439,13 +439,13 @@ JSValue* numberProtoFuncToPrecision(ExecState* exec, JSObject* thisObj, const Li
     }
 
     if (e == precision - 1)
-        return jsString(exec, s + m);
+        return jsString(s + m);
     if (e >= 0) {
         if (e + 1 < m.size())
-            return jsString(exec, s + m.substr(0, e + 1) + "." + m.substr(e + 1));
-        return jsString(exec, s + m);
+            return jsString(s + m.substr(0, e + 1) + "." + m.substr(e + 1));
+        return jsString(s + m);
     }
-    return jsString(exec, s + "0." + char_sequence('0', -(e + 1)) + m);
+    return jsString(s + "0." + char_sequence('0', -(e + 1)) + m);
 }
 
 // ------------------------------ NumberObjectImp ------------------------------
@@ -468,7 +468,7 @@ NumberObjectImp::NumberObjectImp(ExecState* exec, FunctionPrototype* funcProto,
     putDirect(exec->propertyNames().prototype, numberProto, DontEnum|DontDelete|ReadOnly);
 
     // no. of arguments for constructor
-    putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
 }
 
 bool NumberObjectImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -476,20 +476,20 @@ bool NumberObjectImp::getOwnPropertySlot(ExecState* exec, const Identifier& prop
     return getStaticValueSlot<NumberObjectImp, InternalFunctionImp>(exec, ExecState::numberTable(exec), this, propertyName, slot);
 }
 
-JSValue* NumberObjectImp::getValueProperty(ExecState* exec, int token) const
+JSValue* NumberObjectImp::getValueProperty(ExecState*, int token) const
 {
     // ECMA 15.7.3
     switch (token) {
         case NaNValue:
-            return jsNaN(exec);
+            return jsNaN();
         case NegInfinity:
-            return jsNumberCell(exec, -Inf);
+            return jsNumberCell(-Inf);
         case PosInfinity:
-            return jsNumberCell(exec, Inf);
+            return jsNumberCell(Inf);
         case MaxValue:
-            return jsNumberCell(exec, 1.7976931348623157E+308);
+            return jsNumberCell(1.7976931348623157E+308);
         case MinValue:
-            return jsNumberCell(exec, 5E-324);
+            return jsNumberCell(5E-324);
     }
     ASSERT_NOT_REACHED();
     return jsNull();
@@ -504,11 +504,11 @@ bool NumberObjectImp::implementsConstruct() const
 JSObject* NumberObjectImp::construct(ExecState* exec, const List& args)
 {
     JSObject* proto = exec->lexicalGlobalObject()->numberPrototype();
-    NumberInstance* obj = new (exec) NumberInstance(proto);
+    NumberInstance* obj = new NumberInstance(proto);
 
     // FIXME: Check args[0]->isUndefined() instead of args.isEmpty()?
     double n = args.isEmpty() ? 0 : args[0]->toNumber(exec);
-    obj->setInternalValue(jsNumber(exec, n));
+    obj->setInternalValue(jsNumber(n));
     return obj;
 }
 
@@ -516,7 +516,7 @@ JSObject* NumberObjectImp::construct(ExecState* exec, const List& args)
 JSValue* NumberObjectImp::callAsFunction(ExecState* exec, JSObject*, const List& args)
 {
     // FIXME: Check args[0]->isUndefined() instead of args.isEmpty()?
-    return jsNumber(exec, args.isEmpty() ? 0 : args[0]->toNumber(exec));
+    return jsNumber(args.isEmpty() ? 0 : args[0]->toNumber(exec));
 }
 
 } // namespace KJS
index 0d7d4e8..096675f 100644 (file)
@@ -63,17 +63,13 @@ namespace KJS {
 
 // ------------------------------ Object ---------------------------------------
 
-JSValue* NEVER_INLINE throwStackSizeExceededError(ExecState* exec)
-{
-    // This function takes a PIC branch to access a string literal, so moving it out of JSObject::call() improves performance.
-    return throwError(exec, RangeError, "Maximum call stack size exceeded.");
-}
-
 JSValue *JSObject::call(ExecState *exec, JSObject *thisObj, const List &args)
 {
   ASSERT(implementsCall());
 
 #if KJS_MAX_STACK > 0
+  static int depth = 0; // sum of all extant function calls
+
 #if JAVASCRIPT_CALL_TRACING
     static bool tracing = false;
     if (traceJavaScript() && !tracing) {
@@ -90,12 +86,9 @@ JSValue *JSObject::call(ExecState *exec, JSObject *thisObj, const List &args)
     }
 #endif
 
-  unsigned& depth = exec->functionCallDepth();
   if (++depth > KJS_MAX_STACK) {
-    // FIXME: secondary threads probably need a different limit than main thread.
-    // Ideally, the limit should be calculated from available stack space, and not just hardcoded.
     --depth;
-    return throwStackSizeExceededError(exec);
+    return throwError(exec, RangeError, "Maximum call stack size exceeded.");
   }
 #endif
 
@@ -173,8 +166,6 @@ UString JSObject::className() const
 
 JSValue *JSObject::get(ExecState *exec, const Identifier &propertyName) const
 {
-  ASSERT(Heap::threadHeap() == Heap::heap(this));
-
   PropertySlot slot;
 
   if (const_cast<JSObject *>(this)->getPropertySlot(exec, propertyName, slot))
@@ -185,8 +176,6 @@ JSValue *JSObject::get(ExecState *exec, const Identifier &propertyName) const
 
 JSValue *JSObject::get(ExecState *exec, unsigned propertyName) const
 {
-  ASSERT(Heap::threadHeap() == Heap::heap(this));
-
   PropertySlot slot;
   if (const_cast<JSObject *>(this)->getPropertySlot(exec, propertyName, slot))
     return slot.getValue(exec, const_cast<JSObject *>(this), propertyName);
@@ -226,7 +215,6 @@ static void throwSetterError(ExecState *exec)
 void JSObject::put(ExecState* exec, const Identifier &propertyName, JSValue *value)
 {
   ASSERT(value);
-  ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
 
   if (propertyName == exec->propertyNames().underscoreProto) {
     JSObject* proto = value->getObject();
@@ -417,7 +405,7 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi
     return 0;
 }
 
-void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc)
+void JSObject::defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunc)
 {
     JSValue *o = getDirect(propertyName);
     GetterSetterImp *gs;
@@ -425,7 +413,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO
     if (o && o->type() == GetterSetterType) {
         gs = static_cast<GetterSetterImp *>(o);
     } else {
-        gs = new (exec) GetterSetterImp;
+        gs = new GetterSetterImp;
         putDirect(propertyName, gs, GetterSetter);
     }
     
@@ -433,7 +421,7 @@ void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSO
     gs->setGetter(getterFunc);
 }
 
-void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc)
+void JSObject::defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc)
 {
     JSValue *o = getDirect(propertyName);
     GetterSetterImp *gs;
@@ -441,7 +429,7 @@ void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSO
     if (o && o->type() == GetterSetterType) {
         gs = static_cast<GetterSetterImp *>(o);
     } else {
-        gs = new (exec) GetterSetterImp;
+        gs = new GetterSetterImp;
         putDirect(propertyName, gs, GetterSetter);
     }
     
@@ -630,9 +618,9 @@ void JSObject::putDirect(const Identifier &propertyName, JSValue *value, int att
     _prop.put(propertyName, value, attr);
 }
 
-void JSObject::putDirect(ExecState* exec, const Identifier &propertyName, int value, int attr)
+void JSObject::putDirect(const Identifier &propertyName, int value, int attr)
 {
-    _prop.put(propertyName, jsNumber(exec, value), attr);
+    _prop.put(propertyName, jsNumber(value), attr);
 }
 
 void JSObject::removeDirect(const Identifier &propertyName)
@@ -699,18 +687,18 @@ JSObject *Error::create(ExecState *exec, ErrorType errtype, const UString &messa
 
   List args;
   if (message.isEmpty())
-    args.append(jsString(exec, errorNames[errtype]));
+    args.append(jsString(errorNames[errtype]));
   else
-    args.append(jsString(exec, message));
+    args.append(jsString(message));
   JSObject *err = static_cast<JSObject *>(cons->construct(exec,args));
 
   if (lineno != -1)
-    err->put(exec, "line", jsNumber(exec, lineno));
+    err->put(exec, "line", jsNumber(lineno));
   if (sourceId != -1)
-    err->put(exec, "sourceId", jsNumber(exec, sourceId));
+    err->put(exec, "sourceId", jsNumber(sourceId));
 
   if(!sourceURL.isNull())
-    err->put(exec, "sourceURL", jsString(exec, sourceURL));
+    err->put(exec, "sourceURL", jsString(sourceURL));
  
   return err;
 }
index 2fdd2fb..90f5c32 100644 (file)
@@ -432,7 +432,7 @@ namespace KJS {
     JSValue **getDirectLocation(const Identifier& propertyName)
         { return _prop.getLocation(propertyName); }
     void putDirect(const Identifier &propertyName, JSValue *value, int attr = 0);
-    void putDirect(ExecState*, const Identifier &propertyName, int value, int attr = 0);
+    void putDirect(const Identifier &propertyName, int value, int attr = 0);
     void removeDirect(const Identifier &propertyName);
     
     // convenience to add a function property under the function's own built-in name
index 5e19c87..9bc1fe2 100644 (file)
@@ -43,18 +43,18 @@ static JSValue* objectProtoFuncToLocaleString(ExecState*, JSObject*, const List&
 ObjectPrototype::ObjectPrototype(ExecState* exec, FunctionPrototype* functionPrototype)
     : JSObject() // [[Prototype]] is null
 {
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);
 
     // Mozilla extensions
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);
 }
 
 
@@ -123,12 +123,12 @@ JSValue* objectProtoFuncPropertyIsEnumerable(ExecState* exec, JSObject* thisObj,
 
 JSValue* objectProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const List&)
 {
-    return jsString(exec, thisObj->toString(exec));
+    return jsString(thisObj->toString(exec));
 }
 
-JSValue* objectProtoFuncToString(ExecState*exec, JSObject* thisObj, const List&)
+JSValue* objectProtoFuncToString(ExecState*, JSObject* thisObj, const List&)
 {
-    return jsString(exec, "[object " + thisObj->className() + "]");
+    return jsString("[object " + thisObj->className() + "]");
 }
 
 // ------------------------------ ObjectObjectImp --------------------------------
@@ -140,7 +140,7 @@ ObjectObjectImp::ObjectObjectImp(ExecState* exec, ObjectPrototype* objProto, Fun
   putDirect(exec->propertyNames().prototype, objProto, DontEnum|DontDelete|ReadOnly);
 
   // no. of arguments for constructor
-  putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
+  putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
 }
 
 
@@ -161,7 +161,7 @@ JSObject* ObjectObjectImp::construct(ExecState* exec, const List& args)
       return arg->toObject(exec);
   case NullType:
   case UndefinedType:
-      return new (exec) JSObject(exec->lexicalGlobalObject()->objectPrototype());
+      return new JSObject(exec->lexicalGlobalObject()->objectPrototype());
   default:
       ASSERT_NOT_REACHED();
       return 0;
index 5030944..30f3612 100644 (file)
@@ -35,6 +35,27 @@ namespace KJS {
     struct PropertyMapEntry;
     struct PropertyMapHashTable;
 
+    class SavedProperty : Noncopyable {
+    public:
+        // Since we use this in arrays, we allocate it uninitialized
+        // and then explicitly initialize. This means we can allocate
+        // the array without initializing every saved property in the
+        // array twice. To accomplish this, the class uses data members
+        // with types that don't have constructors.
+        SavedProperty();
+        void init(UString::Rep* name, JSValue*, unsigned attributes);
+        ~SavedProperty();
+
+        UString::Rep* name() const;
+        JSValue* value() const;
+        unsigned attributes() const;
+
+    private:
+        UString::Rep* m_name;
+        JSValue* m_value;
+        unsigned m_attributes;
+    };
+
     class PropertyMap : Noncopyable {
     public:
         PropertyMap();
@@ -88,6 +109,65 @@ namespace KJS {
 
     {
     }
+
+    inline SavedProperty::SavedProperty()
+#ifndef NDEBUG
+        : m_name(0)
+        , m_value(0)
+        , m_attributes(0)
+#endif
+    {
+    }
+
+    inline void SavedProperty::init(UString::Rep* name, JSValue* value, unsigned attributes)
+    {
+        ASSERT(name);
+        ASSERT(value);
+
+        ASSERT(!m_name);
+        ASSERT(!m_value);
+        ASSERT(!m_attributes);
+
+        m_name = name;
+        m_value = value;
+        m_attributes = attributes;
+        name->ref();
+        gcProtect(value);
+    }
+
+    inline SavedProperty::~SavedProperty()
+    {
+        ASSERT(m_name);
+        ASSERT(m_value);
+
+        m_name->deref();
+        gcUnprotect(m_value);
+    }
+
+    inline UString::Rep* SavedProperty::name() const
+    {
+        ASSERT(m_name);
+        ASSERT(m_value);
+
+        return m_name;
+    }
+
+    inline JSValue* SavedProperty::value() const
+    {
+        ASSERT(m_name);
+        ASSERT(m_value);
+
+        return m_value;
+    }
+
+    inline unsigned SavedProperty::attributes() const
+    {
+        ASSERT(m_name);
+        ASSERT(m_value);
+
+        return m_attributes;
+    }
+
 } // namespace
 
 #endif // _KJS_PROPERTY_MAP_H_
index 4147955..912e45c 100644 (file)
 
 namespace KJS {
 
-    inline void gcProtect(JSValue* val) 
-    {
-        Heap* heap = Heap::heap(val);
-        if (heap)
-            heap->protect(val);
+    inline void gcProtect(JSValue *val) 
+    { 
+        Collector::protect(val);
     }
 
-    inline void gcUnprotect(JSValue* val)
-    {
-        Heap* heap = Heap::heap(val);
-        if (heap)
-            heap->unprotect(val);
+    inline void gcUnprotect(JSValue *val)
+    { 
+        Collector::unprotect(val);
     }
 
     inline void gcProtectNullTolerant(JSValue *val) 
index 3ef1beb..b723798 100644 (file)
@@ -51,10 +51,10 @@ const ClassInfo RegExpPrototype::info = { "RegExpPrototype", 0, 0, 0 };
 RegExpPrototype::RegExpPrototype(ExecState* exec, ObjectPrototype* objectPrototype, FunctionPrototype* functionPrototype)
     : JSObject(objectPrototype)
 {
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
-    putDirectFunction(new (exec) PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);
+    putDirectFunction(new PrototypeFunction(exec, functionPrototype, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);
 }
 
 // ------------------------------ Functions ---------------------------
@@ -106,7 +106,7 @@ JSValue* regExpProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&
 {
     if (!thisObj->inherits(&RegExpImp::info)) {
         if (thisObj->inherits(&RegExpPrototype::info))
-            return jsString(exec, "//");
+            return jsString("//");
         return throwError(exec, TypeError);
     }
 
@@ -117,7 +117,7 @@ JSValue* regExpProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&
         result += "i";
     if (thisObj->get(exec, exec->propertyNames().multiline)->toBoolean(exec))
         result += "m";
-    return jsString(exec, result);
+    return jsString(result);
 }
 
 // ------------------------------ RegExpImp ------------------------------------
@@ -150,7 +150,7 @@ bool RegExpImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyNa
   return getStaticValueSlot<RegExpImp, JSObject>(exec, ExecState::RegExpImpTable(exec), this, propertyName, slot);
 }
 
-JSValue* RegExpImp::getValueProperty(ExecState* exec, int token) const
+JSValue* RegExpImp::getValueProperty(ExecState*, int token) const
 {
     switch (token) {
         case Global:
@@ -160,9 +160,9 @@ JSValue* RegExpImp::getValueProperty(ExecState* exec, int token) const
         case Multiline:
             return jsBoolean(m_regExp->multiline());
         case Source:
-            return jsString(exec, m_regExp->pattern());
+            return jsString(m_regExp->pattern());
         case LastIndex:
-            return jsNumber(exec, m_lastIndex);
+            return jsNumber(m_lastIndex);
     }
     
     ASSERT_NOT_REACHED();
@@ -287,7 +287,7 @@ RegExpObjectImp::RegExpObjectImp(ExecState* exec, FunctionPrototype* funcProto,
   putDirect(exec->propertyNames().prototype, regProto, DontEnum | DontDelete | ReadOnly);
 
   // no. of arguments for constructor
-  putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly | DontDelete | DontEnum);
+  putDirect(exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
 }
 
 /* 
@@ -317,48 +317,48 @@ void RegExpObjectImp::performMatch(RegExp* r, const UString& s, int startOffset,
 JSObject* RegExpObjectImp::arrayOfMatches(ExecState* exec) const
 {
   unsigned lastNumSubpatterns = d->lastNumSubPatterns;
-  ArrayInstance* arr = new (exec) ArrayInstance(exec->lexicalGlobalObject()->arrayPrototype(), lastNumSubpatterns + 1);
+  ArrayInstance* arr = new ArrayInstance(exec->lexicalGlobalObject()->arrayPrototype(), lastNumSubpatterns + 1);
   for (unsigned i = 0; i <= lastNumSubpatterns; ++i) {
     int start = d->lastOvector[2 * i];
     if (start >= 0)
-      arr->put(exec, i, jsString(exec, d->lastInput.substr(start, d->lastOvector[2 * i + 1] - start)));
+      arr->put(exec, i, jsString(d->lastInput.substr(start, d->lastOvector[2 * i + 1] - start)));
   }
-  arr->put(exec, exec->propertyNames().index, jsNumber(exec, d->lastOvector[0]));
-  arr->put(exec, exec->propertyNames().input, jsString(exec, d->lastInput));
+  arr->put(exec, exec->propertyNames().index, jsNumber(d->lastOvector[0]));
+  arr->put(exec, exec->propertyNames().input, jsString(d->lastInput));
   return arr;
 }
 
-JSValue* RegExpObjectImp::getBackref(ExecState* exec, unsigned i) const
+JSValue* RegExpObjectImp::getBackref(unsigned i) const
 {
   if (d->lastOvector && i <= d->lastNumSubPatterns)
-    return jsString(exec, d->lastInput.substr(d->lastOvector[2 * i], d->lastOvector[2 * i + 1] - d->lastOvector[2 * i]));
-  return jsString(exec, "");
+    return jsString(d->lastInput.substr(d->lastOvector[2 * i], d->lastOvector[2 * i + 1] - d->lastOvector[2 * i]));
+  return jsString("");
 }
 
-JSValue* RegExpObjectImp::getLastParen(ExecState* exec) const
+JSValue* RegExpObjectImp::getLastParen() const
 {
   unsigned i = d->lastNumSubPatterns;
   if (i > 0) {
     ASSERT(d->lastOvector);
-    return jsString(exec, d->lastInput.substr(d->lastOvector[2 * i], d->lastOvector[2 * i + 1] - d->lastOvector[2 * i]));
+    return jsString(d->lastInput.substr(d->lastOvector[2 * i], d->lastOvector[2 * i + 1] - d->lastOvector[2 * i]));
   }
-  return jsString(exec, "");
+  return jsString("");
 }
 
-JSValue *RegExpObjectImp::getLeftContext(ExecState* exec) const
+JSValue *RegExpObjectImp::getLeftContext() const
 {
   if (d->lastOvector)
-    return jsString(exec, d->lastInput.substr(0, d->lastOvector[0]));
-  return jsString(exec, "");
+    return jsString(d->lastInput.substr(0, d->lastOvector[0]));
+  return jsString("");
 }
 
-JSValue *RegExpObjectImp::getRightContext(ExecState* exec) const
+JSValue *RegExpObjectImp::getRightContext() const
 {
   if (d->lastOvector) {
     UString s = d->lastInput;
-    return jsString(exec, s.substr(d->lastOvector[1], s.size() - d->lastOvector[1]));
+    return jsString(s.substr(d->lastOvector[1], s.size() - d->lastOvector[1]));
   }
-  return jsString(exec, "");
+  return jsString("");
 }
 
 bool RegExpObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
@@ -366,44 +366,44 @@ bool RegExpObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& prop
   return getStaticValueSlot<RegExpObjectImp, InternalFunctionImp>(exec, ExecState::RegExpObjectImpTable(exec), this, propertyName, slot);
 }
 
-JSValue *RegExpObjectImp::getValueProperty(ExecState* exec, int token) const
+JSValue *RegExpObjectImp::getValueProperty(ExecState*, int token) const
 {
   switch (token) {
     case Dollar1:
-      return getBackref(exec, 1);
+      return getBackref(1);
     case Dollar2:
-      return getBackref(exec, 2);
+      return getBackref(2);
     case Dollar3:
-      return getBackref(exec, 3);
+      return getBackref(3);
     case Dollar4:
-      return getBackref(exec, 4);
+      return getBackref(4);
     case Dollar5:
-      return getBackref(exec, 5);
+      return getBackref(5);
     case Dollar6:
-      return getBackref(exec, 6);
+      return getBackref(6);
     case Dollar7:
-      return getBackref(exec, 7);
+      return getBackref(7);
     case Dollar8:
-      return getBackref(exec, 8);
+      return getBackref(8);
     case Dollar9:
-      return getBackref(exec, 9);
+      return getBackref(9);
     case Input:
-      return jsString(exec, d->lastInput);
+      return jsString(d->lastInput);
     case Multiline:
       return jsBoolean(d->multiline);
     case LastMatch:
-      return getBackref(exec, 0);
+      return getBackref(0);
     case LastParen:
-      return getLastParen(exec);
+      return getLastParen();
     case LeftContext:
-      return getLeftContext(exec);
+      return getLeftContext();
     case RightContext:
-      return getRightContext(exec);
+      return getRightContext();
     default:
       ASSERT(0);
   }
 
-  return jsString(exec, "");
+  return jsString("");
 }
 
 void RegExpObjectImp::put(ExecState *exec, const Identifier &propertyName, JSValue *value)
@@ -451,7 +451,7 @@ JSObject *RegExpObjectImp::construct(ExecState *exec, const List &args)
 JSObject* RegExpObjectImp::createRegExpImp(ExecState* exec, PassRefPtr<RegExp> regExp)
 {
     return regExp->isValid()
-        ? new (exec) RegExpImp(static_cast<RegExpPrototype*>(exec->lexicalGlobalObject()->regExpPrototype()), regExp)
+        ? new RegExpImp(static_cast<RegExpPrototype*>(exec->lexicalGlobalObject()->regExpPrototype()), regExp)
         : throwError(exec, SyntaxError, UString("Invalid regular expression: ").append(regExp->errorMessage()));
 }
 
index a46ce5b..c69e8f7 100644 (file)
@@ -90,10 +90,10 @@ namespace KJS {
         const UString& input() const;
 
     private:
-        JSValue* getBackref(ExecState*, unsigned) const;
-        JSValue* getLastParen(ExecState*) const;
-        JSValue* getLeftContext(ExecState*) const;
-        JSValue* getRightContext(ExecState*) const;
+        JSValue* getBackref(unsigned) const;
+        JSValue* getLastParen() const;
+        JSValue* getLeftContext() const;
+        JSValue* getRightContext() const;
 
         OwnPtr<RegExpObjectImpPrivate> d;
 
index 4ade1d3..415ae37 100644 (file)
@@ -40,10 +40,10 @@ namespace KJS {
 
 const ClassInfo StringInstance::info = { "String", 0, 0, 0 };
 
-StringInstance::StringInstance(ExecState* exec, JSObject* proto)
+StringInstance::StringInstance(JSObject *proto)
   : JSWrapperObject(proto)
 {
-  setInternalValue(jsString(exec, ""));
+  setInternalValue(jsString(""));
 }
 
 StringInstance::StringInstance(JSObject *proto, StringImp* string)
@@ -52,25 +52,25 @@ StringInstance::StringInstance(JSObject *proto, StringImp* string)
   setInternalValue(string);
 }
 
-StringInstance::StringInstance(ExecState* exec, JSObject* proto, const UString &string)
+StringInstance::StringInstance(JSObject *proto, const UString &string)
   : JSWrapperObject(proto)
 {
-  setInternalValue(jsString(exec, string));
+  setInternalValue(jsString(string));
 }
 
-JSValue* StringInstance::lengthGetter(ExecState* exec, JSObject*, const Identifier&, const PropertySlot& slot)
+JSValue *StringInstance::lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot &slot)
 {
-    return jsNumber(exec, static_cast<StringInstance*>(slot.slotBase())->internalValue()->value().size());
+    return jsNumber(static_cast<StringInstance*>(slot.slotBase())->internalValue()->value().size());
 }
 
-JSValue* StringInstance::indexGetter(ExecState* exec, JSObject*, const Identifier&, const PropertySlot& slot)
+JSValue* StringInstance::indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot)
 {
-    return jsString(exec, static_cast<StringInstance*>(slot.slotBase())->internalValue()->value().substr(slot.index(), 1));
+    return jsString(static_cast<StringInstance*>(slot.slotBase())->internalValue()->value().substr(slot.index(), 1));
 }
 
-static JSValue* stringInstanceNumericPropertyGetter(ExecState* exec, JSObject*, unsigned index, const PropertySlot& slot)
+static JSValue* stringInstanceNumericPropertyGetter(ExecState*, JSObject*, unsigned index, const PropertySlot& slot)
 {
-    return jsString(exec, static_cast<StringInstance*>(slot.slotBase())->internalValue()->value().substr(index, 1));
+    return jsString(static_cast<StringInstance*>(slot.slotBase())->internalValue()->value().substr(index, 1));
 }
 
 bool StringInstance::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -165,10 +165,10 @@ const ClassInfo StringPrototype::info = { "String", &StringInstance::info, 0, Ex
 */
 // ECMA 15.5.4
 StringPrototype::StringPrototype(ExecState* exec, ObjectPrototype* objProto)
-  : StringInstance(exec, objProto)
+  : StringInstance(objProto)
 {
   // The constructor will be added later, after StringObjectImp has been built
-  putDirect(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
+  putDirect(exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
 }
 
 bool StringPrototype::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot &slot)
@@ -344,10 +344,10 @@ static JSValue *replace(ExecState *exec, StringImp* sourceVal, JSValue *pattern,
               if (matchStart < 0)
                 args.append(jsUndefined());
               else
-                args.append(jsString(exec, source.substr(matchStart, matchLen)));
+                args.append(jsString(source.substr(matchStart, matchLen)));
           }
           
-          args.append(jsNumber(exec, completeMatchStart));
+          args.append(jsNumber(completeMatchStart));
           args.append(sourceVal);
 
           substitutedReplacement = replacementFunction->call(exec, exec->globalThisValue(), args)->toString(exec);
@@ -381,7 +381,7 @@ static JSValue *replace(ExecState *exec, StringImp* sourceVal, JSValue *pattern,
     if (result == source)
       return sourceVal;
 
-    return jsString(exec, result);
+    return jsString(result);
   }
   
   // First arg is a string
@@ -395,14 +395,14 @@ static JSValue *replace(ExecState *exec, StringImp* sourceVal, JSValue *pattern,
   if (replacementFunction) {
       List args;
       
-      args.append(jsString(exec, source.substr(matchPos, matchLen)));
-      args.append(jsNumber(exec, matchPos));
+      args.append(jsString(source.substr(matchPos, matchLen)));
+      args.append(jsNumber(matchPos));
       args.append(sourceVal);
       
       replacementString = replacementFunction->call(exec, exec->globalThisValue(), args)->toString(exec);
   }
 
-  return jsString(exec, source.substr(0, matchPos) + replacementString + source.substr(matchPos + matchLen));
+  return jsString(source.substr(0, matchPos) + replacementString + source.substr(matchPos + matchLen));
 }
 
 JSValue* stringProtoFuncToString(ExecState* exec, JSObject* thisObj, const List&)
@@ -434,7 +434,7 @@ JSValue* stringProtoFuncCharAt(ExecState* exec, JSObject* thisObj, const List& a
       u = s.substr(static_cast<int>(dpos), 1);
     else
       u = "";
-    return jsString(exec, u);
+    return jsString(u);
 }
 
 JSValue* stringProtoFuncCharCodeAt(ExecState* exec, JSObject* thisObj, const List& args)
@@ -448,9 +448,9 @@ JSValue* stringProtoFuncCharCodeAt(ExecState* exec, JSObject* thisObj, const Lis
     JSValue* a0 = args[0];
     double dpos = a0->toInteger(exec);
     if (dpos >= 0 && dpos < len)
-      result = jsNumber(exec, s[static_cast<int>(dpos)]);
+      result = jsNumber(s[static_cast<int>(dpos)]);
     else
-      result = jsNaN(exec);
+      result = jsNaN();
     return result;
 }
 
@@ -463,7 +463,7 @@ JSValue* stringProtoFuncConcat(ExecState* exec, JSObject* thisObj, const List& a
     for (List::const_iterator it = args.begin(); it != end; ++it) {
         s += (*it)->toString(exec);
     }
-    return jsString(exec, s);
+    return jsString(s);
 }
 
 JSValue* stringProtoFuncIndexOf(ExecState* exec, JSObject* thisObj, const List& args)
@@ -480,7 +480,7 @@ JSValue* stringProtoFuncIndexOf(ExecState* exec, JSObject* thisObj, const List&
         dpos = 0;
     else if (dpos > len)
         dpos = len;
-    return jsNumber(exec, s.find(u2, static_cast<int>(dpos)));
+    return jsNumber(s.find(u2, static_cast<int>(dpos)));
 }
 
 JSValue* stringProtoFuncLastIndexOf(ExecState* exec, JSObject* thisObj, const List& args)
@@ -498,7 +498,7 @@ JSValue* stringProtoFuncLastIndexOf(ExecState* exec, JSObject* thisObj, const Li
         dpos = 0;
     else if (!(dpos <= len)) // true for NaN
         dpos = len;
-    return jsNumber(exec, s.rfind(u2, static_cast<int>(dpos)));
+    return jsNumber(s.rfind(u2, static_cast<int>(dpos)));
 }
 
 JSValue* stringProtoFuncMatch(ExecState* exec, JSObject* thisObj, const List& args)
@@ -537,7 +537,7 @@ JSValue* stringProtoFuncMatch(ExecState* exec, JSObject* thisObj, const List& ar
       List list;
       int lastIndex = 0;
       while (pos >= 0) {
-        list.append(jsString(exec, u.substr(pos, matchLength)));
+        list.append(jsString(u.substr(pos, matchLength)));
         lastIndex = pos;
         pos += matchLength == 0 ? 1 : matchLength;
         regExpObj->performMatch(reg.get(), u, pos, pos, matchLength);
@@ -579,7 +579,7 @@ JSValue* stringProtoFuncSearch(ExecState* exec, JSObject* thisObj, const List& a
     int pos;
     int matchLength;
     regExpObj->performMatch(reg.get(), u, 0, pos, matchLength);
-    return jsNumber(exec, pos);
+    return jsNumber(pos);
 }
 
 JSValue* stringProtoFuncReplace(ExecState* exec, JSObject* thisObj, const List& args)
@@ -589,7 +589,7 @@ JSValue* stringProtoFuncReplace(ExecState* exec, JSObject* thisObj, const List&
 
     StringImp* sVal = thisObj->inherits(&StringInstance::info) ?
       static_cast<StringInstance*>(thisObj)->internalValue() :
-      static_cast<StringImp*>(jsString(exec, s));
+      static_cast<StringImp*>(jsString(s));
 
     JSValue* a0 = args[0];
     JSValue* a1 = args[1];
@@ -616,10 +616,10 @@ JSValue* stringProtoFuncSlice(ExecState* exec, JSObject* thisObj, const List& ar
             from = 0;
         if (to > len)
             to = len;
-        return jsString(exec, s.substr(static_cast<int>(from), static_cast<int>(to - from)));
+        return jsString(s.substr(static_cast<int>(from), static_cast<int>(to - from)));
     }
 
-    return jsString(exec, "");
+    return jsString("");
 }
 
 JSValue* stringProtoFuncSplit(ExecState* exec, JSObject* thisObj, const List& args)
@@ -642,7 +642,7 @@ JSValue* stringProtoFuncSplit(ExecState* exec, JSObject* thisObj, const List& ar
       RegExp *reg = static_cast<RegExpImp *>(a0)->regExp();
       if (u.isEmpty() && reg->match(u, 0) >= 0) {
         // empty string matched by regexp -> empty array
-        res->put(exec, exec->propertyNames().length, jsNumber(exec, 0));
+        res->put(exec, exec->propertyNames().length, jsNumber(0));
         return result;
       }
       pos = 0;
@@ -654,7 +654,7 @@ JSValue* stringProtoFuncSplit(ExecState* exec, JSObject* thisObj, const List& ar
         int mlen = ovector[1] - ovector[0];
         pos = mpos + (mlen == 0 ? 1 : mlen);
         if (mpos != p0 || mlen) {
-          res->put(exec,i, jsString(exec, u.substr(p0, mpos-p0)));
+          res->put(exec,i, jsString(u.substr(p0, mpos-p0)));
           p0 = mpos + mlen;
           i++;
         }
@@ -663,7 +663,7 @@ JSValue* stringProtoFuncSplit(ExecState* exec, JSObject* thisObj, const List& ar
           if (spos < 0)
             res->put(exec, i++, jsUndefined());
           else
-            res->put(exec, i++, jsString(exec, u.substr(spos, ovector[si * 2 + 1] - spos)));
+            res->put(exec, i++, jsString(u.substr(spos, ovector[si * 2 + 1] - spos)));
         }
       }
     } else {
@@ -671,15 +671,15 @@ JSValue* stringProtoFuncSplit(ExecState* exec, JSObject* thisObj, const List& ar
       if (u2.isEmpty()) {
         if (u.isEmpty()) {
           // empty separator matches empty string -> empty array
-          res->put(exec, exec->propertyNames().length, jsNumber(exec, 0));
+          res->put(exec, exec->propertyNames().length, jsNumber(0));
           return result;
         } else {
           while (static_cast<uint32_t>(i) != limit && i < u.size()-1)
-            res->put(exec, i++, jsString(exec, u.substr(p0++, 1)));
+            res->put(exec, i++, jsString(u.substr(p0++, 1)));
         }
       } else {
         while (static_cast<uint32_t>(i) != limit && (pos = u.find(u2, p0)) >= 0) {
-          res->put(exec, i, jsString(exec, u.substr(p0, pos - p0)));
+          res->put(exec, i, jsString(u.substr(p0, pos-p0)));
           p0 = pos + u2.size();
           i++;
         }
@@ -687,8 +687,8 @@ JSValue* stringProtoFuncSplit(ExecState* exec, JSObject* thisObj, const List& ar
     }
     // add remaining string, if any
     if (static_cast<uint32_t>(i) != limit)
-      res->put(exec, i++, jsString(exec, u.substr(p0)));
-    res->put(exec, exec->propertyNames().length, jsNumber(exec, i));
+      res->put(exec, i++, jsString(u.substr(p0)));
+    res->put(exec, exec->propertyNames().length, jsNumber(i));
     return result;
 }
 
@@ -704,9 +704,9 @@ JSValue* stringProtoFuncSubstr(ExecState* exec, JSObject* thisObj, const List& a
     double start = a0->toInteger(exec);
     double length = a1->isUndefined() ? len : a1->toInteger(exec);
     if (start >= len)
-      return jsString(exec, "");
+      return jsString("");
     if (length < 0)
-      return jsString(exec, "");
+      return jsString("");
     if (start < 0) {
       start += len;
       if (start < 0)
@@ -714,7 +714,7 @@ JSValue* stringProtoFuncSubstr(ExecState* exec, JSObject* thisObj, const List& a
     }
     if (length > len)
       length = len;
-    return jsString(exec, s.substr(static_cast<int>(start), static_cast<int>(length)));
+    return jsString(s.substr(static_cast<int>(start), static_cast<int>(length)));
 }
 
 JSValue* stringProtoFuncSubstring(ExecState* exec, JSObject* thisObj, const List& args)
@@ -747,7 +747,7 @@ JSValue* stringProtoFuncSubstring(ExecState* exec, JSObject* thisObj, const List
       end = start;
       start = temp;
     }
-    return jsString(exec, s.substr((int)start, (int)end-(int)start));
+    return jsString(s.substr((int)start, (int)end-(int)start));
 }
 
 JSValue* stringProtoFuncToLowerCase(ExecState* exec, JSObject* thisObj, const List&)
@@ -757,7 +757,7 @@ JSValue* stringProtoFuncToLowerCase(ExecState* exec, JSObject* thisObj, const Li
     
     StringImp* sVal = thisObj->inherits(&StringInstance::info)
         ? static_cast<StringInstance*>(thisObj)->internalValue()
-        : static_cast<StringImp*>(jsString(exec, s));
+        : static_cast<StringImp*>(jsString(s));
     int ssize = s.size();
     if (!ssize)
         return sVal;
@@ -772,7 +772,7 @@ JSValue* stringProtoFuncToLowerCase(ExecState* exec, JSObject* thisObj, const Li
     }
     if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
         return sVal;
-    return jsString(exec, UString(buffer.releaseBuffer(), length, false));
+    return jsString(UString(buffer.releaseBuffer(), length, false));
 }
 
 JSValue* stringProtoFuncToUpperCase(ExecState* exec, JSObject* thisObj, const List&)
@@ -782,7 +782,7 @@ JSValue* stringProtoFuncToUpperCase(ExecState* exec, JSObject* thisObj, const Li
 
     StringImp* sVal = thisObj->inherits(&StringInstance::info)
         ? static_cast<StringInstance*>(thisObj)->internalValue()
-        : static_cast<StringImp*>(jsString(exec, s));
+        : static_cast<StringImp*>(jsString(s));
     int ssize = s.size();
     if (!ssize)
         return sVal;
@@ -797,7 +797,7 @@ JSValue* stringProtoFuncToUpperCase(ExecState* exec, JSObject* thisObj, const Li
     }
     if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
         return sVal;
-    return jsString(exec, UString(buffer.releaseBuffer(), length, false));
+    return jsString(UString(buffer.releaseBuffer(), length, false));
 }
 
 JSValue* stringProtoFuncToLocaleLowerCase(ExecState* exec, JSObject* thisObj, const List&)
@@ -808,7 +808,7 @@ JSValue* stringProtoFuncToLocaleLowerCase(ExecState* exec, JSObject* thisObj, co
     // FIXME: See http://www.unicode.org/Public/UNIDATA/SpecialCasing.txt for locale-sensitive mappings that aren't implemented.
     StringImp* sVal = thisObj->inherits(&StringInstance::info)
         ? static_cast<StringInstance*>(thisObj)->internalValue()
-        : static_cast<StringImp*>(jsString(exec, s));
+        : static_cast<StringImp*>(jsString(s));
     int ssize = s.size();
     if (!ssize)
         return sVal;
@@ -823,7 +823,7 @@ JSValue* stringProtoFuncToLocaleLowerCase(ExecState* exec, JSObject* thisObj, co
     }
     if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
         return sVal;
-    return jsString(exec, UString(buffer.releaseBuffer(), length, false));
+    return jsString(UString(buffer.releaseBuffer(), length, false));
 }
 
 JSValue* stringProtoFuncToLocaleUpperCase(ExecState* exec, JSObject* thisObj, const List&)
@@ -833,7 +833,7 @@ JSValue* stringProtoFuncToLocaleUpperCase(ExecState* exec, JSObject* thisObj, co
 
     StringImp* sVal = thisObj->inherits(&StringInstance::info)
         ? static_cast<StringInstance*>(thisObj)->internalValue()
-        : static_cast<StringImp*>(jsString(exec, s));
+        : static_cast<StringImp*>(jsString(s));
     int ssize = s.size();
     if (!ssize)
         return sVal;
@@ -848,81 +848,81 @@ JSValue* stringProtoFuncToLocaleUpperCase(ExecState* exec, JSObject* thisObj, co
     }
     if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
         return sVal;
-    return jsString(exec, UString(buffer.releaseBuffer(), length, false));
+    return jsString(UString(buffer.releaseBuffer(), length, false));
 }
 
 JSValue* stringProtoFuncLocaleCompare(ExecState* exec, JSObject* thisObj, const List& args)
 {
     if (args.size() < 1)
-      return jsNumber(exec, 0);
+      return jsNumber(0);
 
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
     JSValue* a0 = args[0];
-    return jsNumber(exec, localeCompare(s, a0->toString(exec)));
+    return jsNumber(localeCompare(s, a0->toString(exec)));
 }
 
 JSValue* stringProtoFuncBig(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<big>" + s + "</big>");
+    return jsString("<big>" + s + "</big>");
 }
 
 JSValue* stringProtoFuncSmall(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<small>" + s + "</small>");
+    return jsString("<small>" + s + "</small>");
 }
 
 JSValue* stringProtoFuncBlink(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<blink>" + s + "</blink>");
+    return jsString("<blink>" + s + "</blink>");
 }
 
 JSValue* stringProtoFuncBold(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<b>" + s + "</b>");
+    return jsString("<b>" + s + "</b>");
 }
 
 JSValue* stringProtoFuncFixed(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<tt>" + s + "</tt>");
+    return jsString("<tt>" + s + "</tt>");
 }
 
 JSValue* stringProtoFuncItalics(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<i>" + s + "</i>");
+    return jsString("<i>" + s + "</i>");
 }
 
 JSValue* stringProtoFuncStrike(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<strike>" + s + "</strike>");
+    return jsString("<strike>" + s + "</strike>");
 }
 
 JSValue* stringProtoFuncSub(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<sub>" + s + "</sub>");
+    return jsString("<sub>" + s + "</sub>");
 }
 
 JSValue* stringProtoFuncSup(ExecState* exec, JSObject* thisObj, const List&)
 {
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
-    return jsString(exec, "<sup>" + s + "</sup>");
+    return jsString("<sup>" + s + "</sup>");
 }
 
 JSValue* stringProtoFuncFontcolor(ExecState* exec, JSObject* thisObj, const List& args)
@@ -930,7 +930,7 @@ JSValue* stringProtoFuncFontcolor(ExecState* exec, JSObject* thisObj, const List
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
     JSValue* a0 = args[0];
-    return jsString(exec, "<font color=\"" + a0->toString(exec) + "\">" + s + "</font>");
+    return jsString("<font color=\"" + a0->toString(exec) + "\">" + s + "</font>");
 }
 
 JSValue* stringProtoFuncFontsize(ExecState* exec, JSObject* thisObj, const List& args)
@@ -938,7 +938,7 @@ JSValue* stringProtoFuncFontsize(ExecState* exec, JSObject* thisObj, const List&
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
     JSValue* a0 = args[0];
-    return jsString(exec, "<font size=\"" + a0->toString(exec) + "\">" + s + "</font>");
+    return jsString("<font size=\"" + a0->toString(exec) + "\">" + s + "</font>");
 }
 
 JSValue* stringProtoFuncAnchor(ExecState* exec, JSObject* thisObj, const List& args)
@@ -946,7 +946,7 @@ JSValue* stringProtoFuncAnchor(ExecState* exec, JSObject* thisObj, const List& a
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
     JSValue* a0 = args[0];
-    return jsString(exec, "<a name=\"" + a0->toString(exec) + "\">" + s + "</a>");
+    return jsString("<a name=\"" + a0->toString(exec) + "\">" + s + "</a>");
 }
 
 JSValue* stringProtoFuncLink(ExecState* exec, JSObject* thisObj, const List& args)
@@ -954,7 +954,7 @@ JSValue* stringProtoFuncLink(ExecState* exec, JSObject* thisObj, const List& arg
     // This optimizes the common case that thisObj is a StringInstance
     UString s = thisObj->inherits(&StringInstance::info) ? static_cast<StringInstance*>(thisObj)->internalValue()->value() : thisObj->toString(exec);
     JSValue* a0 = args[0];
-    return jsString(exec, "<a href=\"" + a0->toString(exec) + "\">" + s + "</a>");
+    return jsString("<a href=\"" + a0->toString(exec) + "\">" + s + "</a>");
 }
 
 // ------------------------------ StringObjectImp ------------------------------
@@ -965,10 +965,10 @@ StringObjectImp::StringObjectImp(ExecState* exec, FunctionPrototype* funcProto,
   // ECMA 15.5.3.1 String.prototype
   putDirect(exec->propertyNames().prototype, stringProto, DontEnum|DontDelete|ReadOnly);
 
-  putDirectFunction(new (exec) StringObjectFuncImp(exec, funcProto, exec->propertyNames().fromCharCode), DontEnum);
+  putDirectFunction(new StringObjectFuncImp(exec, funcProto, exec->propertyNames().fromCharCode), DontEnum);
 
   // no. of arguments for constructor
-  putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
+  putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
 }
 
 
@@ -982,18 +982,18 @@ JSObject *StringObjectImp::construct(ExecState *exec, const List &args)
 {
   JSObject *proto = exec->lexicalGlobalObject()->stringPrototype();
   if (args.size() == 0)
-    return new (exec) StringInstance(exec, proto);
-  return new (exec) StringInstance(exec, proto, args[0]->toString(exec));
+    return new StringInstance(proto);
+  return new StringInstance(proto, args[0]->toString(exec));
 }
 
 // ECMA 15.5.1
 JSValue *StringObjectImp::callAsFunction(ExecState *exec, JSObject* /*thisObj*/, const List &args)
 {
   if (args.isEmpty())
-    return jsString(exec, "");
+    return jsString("");
   else {
     JSValue *v = args[0];
-    return jsString(exec, v->toString(exec));
+    return jsString(v->toString(exec));
   }
 }
 
@@ -1003,7 +1003,7 @@ JSValue *StringObjectImp::callAsFunction(ExecState *exec, JSObject* /*thisObj*/,
 StringObjectFuncImp::StringObjectFuncImp(ExecState* exec, FunctionPrototype* funcProto, const Identifier& name)
   : InternalFunctionImp(funcProto, name)
 {
-  putDirect(exec->propertyNames().length, jsNumber(exec, 1), DontDelete|ReadOnly|DontEnum);
+  putDirect(exec->propertyNames().length, jsNumber(1), DontDelete|ReadOnly|DontEnum);
 }
 
 JSValue *StringObjectFuncImp::callAsFunction(ExecState *exec, JSObject* /*thisObj*/, const List &args)
@@ -1021,7 +1021,7 @@ JSValue *StringObjectFuncImp::callAsFunction(ExecState *exec, JSObject* /*thisOb
   } else
     s = "";
 
-  return jsString(exec, s);
+  return jsString(s);
 }
 
 } // namespace KJS
index 5a8fd8a..8508788 100644 (file)
@@ -31,9 +31,9 @@ namespace KJS {
 
   class StringInstance : public JSWrapperObject {
   public:
-    StringInstance(ExecState*, JSObject* proto);
+    StringInstance(JSObject *proto);
     StringInstance(JSObject *proto, StringImp*);
-    StringInstance(ExecState*, JSObject* proto, const UString&);
+    StringInstance(JSObject *proto, const UString&);
 
     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
@@ -57,8 +57,8 @@ namespace KJS {
   // WebCore uses this to make style.filter undetectable
   class StringInstanceThatMasqueradesAsUndefined : public StringInstance {
   public:
-      StringInstanceThatMasqueradesAsUndefined(ExecState* exec, JSObject* proto, const UString& string)
-          : StringInstance(exec, proto, string) { }
+      StringInstanceThatMasqueradesAsUndefined(JSObject* proto, const UString& string)
+          : StringInstance(proto, string) { }
       virtual bool masqueradeAsUndefined() const { return true; }
       virtual bool toBoolean(ExecState*) const { return false; }
   };
index 0c02250..153bdf9 100644 (file)
@@ -131,18 +131,18 @@ COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false
 
 GlobalObject::GlobalObject(Vector<UString>& arguments)
 {
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, "debug", functionDebug));
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, "print", functionPrint));
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 0, "quit", functionQuit));
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 0, "gc", functionGC));
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, "version", functionVersion));
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, "run", functionRun));
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 1, "load", functionLoad));
-    putDirectFunction(new (globalExec()) PrototypeFunction(globalExec(), functionPrototype(), 0, "readline", functionReadline));
+    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));
 
     JSObject* array = arrayConstructor()->construct(globalExec(), globalExec()->emptyList());
     for (size_t i = 0; i < arguments.size(); ++i)
-        array->put(globalExec(), i, jsString(globalExec(), arguments[i]));
+        array->put(globalExec(), i, jsString(arguments[i]));
     putDirect("arguments", array);
 
     Interpreter::setShouldPrintExceptions(true);
@@ -161,10 +161,10 @@ JSValue* functionDebug(ExecState* exec, JSObject*, const List& args)
     return jsUndefined();
 }
 
-JSValue* functionGC(ExecState* exec, JSObject*, const List&)
+JSValue* functionGC(ExecState*, JSObject*, const List&)
 {
     JSLock lock;
-    exec->heap()->collect();
+    Collector::collect();
     return jsUndefined();
 }
 
@@ -187,7 +187,7 @@ JSValue* functionRun(ExecState* exec, JSObject*, const List& args)
     Interpreter::evaluate(exec->dynamicGlobalObject()->globalExec(), fileName, 0, script.data());
     stopWatch.stop();
 
-    return jsNumber(exec, stopWatch.getElapsedMS());
+    return jsNumber(stopWatch.getElapsedMS());
 }
 
 JSValue* functionLoad(ExecState* exec, JSObject*, const List& args)
@@ -202,7 +202,7 @@ JSValue* functionLoad(ExecState* exec, JSObject*, const List& args)
     return jsUndefined();
 }
 
-JSValue* functionReadline(ExecState* exec, JSObject*, const List&)
+JSValue* functionReadline(ExecState*, JSObject*, const List&)
 {
     Vector<char, 256> line;
     int c;
@@ -213,7 +213,7 @@ JSValue* functionReadline(ExecState* exec, JSObject*, const List&)
         line.append(c);
     }
     line.append('\0');
-    return jsString(exec, line.data());
+    return jsString(line.data());
 }
 
 JSValue* functionQuit(ExecState*, JSObject*, const List&)
@@ -345,7 +345,7 @@ int kjsmain(int argc, char** argv)
     bool success = runWithScripts(fileNames, arguments, prettyPrint);
 
 #ifndef NDEBUG
-    Heap::threadHeap()->collect();
+    Collector::collect();
 #endif
 
     return success ? 0 : 3;
index 7f129c2..33b5809 100644 (file)
@@ -396,7 +396,7 @@ inline unsigned UString::toArrayIndex(bool *ok) const
 // huge buffer.
 // FIXME: this should be size_t but that would cause warnings until we
 // fix UString sizes to be size_t instead of int
-static const int minShareSize = Heap::minExtraCostSize / sizeof(UChar);
+static const int minShareSize = Collector::minExtraCostSize / sizeof(UChar);
 
 inline size_t UString::cost() const
 {
index 7ae6f0f..55da40b 100644 (file)
@@ -80,9 +80,9 @@ extern const double Inf = NaNInf.doubles.Inf_Double;
 static const double D16 = 65536.0;
 static const double D32 = 4294967296.0;
 
-void* JSCell::operator new(size_t size, ExecState* exec)
+void *JSCell::operator new(size_t size)
 {
-    return exec->heap()->allocate(size);
+    return Collector::allocate(size);
 }
 
 bool JSCell::getUInt32(uint32_t&) const
@@ -207,26 +207,26 @@ const JSObject *JSCell::getObject() const
     return isObject() ? static_cast<const JSObject *>(this) : 0;
 }
 
-JSCell* jsString(ExecState* exec, const char* s)
+JSCell* jsString(const char* s)
 {
-    return new (exec) StringImp(s ? s : "");
+    return new StringImp(s ? s : "");
 }
 
-JSCell* jsString(ExecState* exec, const UString& s)
+JSCell* jsString(const UString& s)
 {
-    return s.isNull() ? new (exec) StringImp("") : new (exec) StringImp(s);
+    return s.isNull() ? new StringImp("") : new StringImp(s);
 }
 
-JSCell* jsOwnedString(ExecState* exec, const UString& s)
+JSCell* jsOwnedString(const UString& s)
 {
-    return s.isNull() ? new (exec) StringImp("", StringImp::HasOtherOwner) : new (exec) StringImp(s, StringImp::HasOtherOwner);
+    return s.isNull() ? new StringImp("", StringImp::HasOtherOwner) : new StringImp(s, StringImp::HasOtherOwner);
 }
 
 // This method includes a PIC branch to set up the NumberImp's vtable, so we quarantine
 // it in a separate function to keep the normal case speedy.
-JSValue* jsNumberCell(ExecState* exec, double d)
+JSValue *jsNumberCell(double d)
 {
-    return new (exec) NumberImp(d);
+    return new NumberImp(d);
 }
 
 } // namespace KJS
index b892d7c..dfbeee4 100644 (file)
@@ -46,7 +46,7 @@ struct ClassInfo;
  */
 class JSValue : Noncopyable {
     friend class JSCell; // so it can derive from this class
-    friend class Heap; // so it can call asCell()
+    friend class Collector; // so it can call asCell()
 
 private:
     JSValue();
@@ -125,7 +125,7 @@ private:
 };
 
 class JSCell : public JSValue {
-    friend class Heap;
+    friend class Collector;
     friend class NumberImp;
     friend class StringImp;
     friend class JSObject;
@@ -163,20 +163,20 @@ public:
     virtual JSObject *toObject(ExecState *exec) const = 0;
 
     // Garbage collection.
-    void* operator new(size_t, ExecState*);
+    void *operator new(size_t);
     virtual void mark();
     bool marked() const;
 };
 
-JSValue* jsNumberCell(ExecState*, double);
+JSValue *jsNumberCell(double);
 
-JSCell* jsString(ExecState*, const UString&); // returns empty string if passed null string
-JSCell* jsString(ExecState*, const char* = ""); // returns empty string if passed 0
+JSCell *jsString(const UString&); // returns empty string if passed null string
+JSCell *jsString(const char* = ""); // returns empty string if passed 0
 
 // should be used for strings that are owned by an object that will
 // likely outlive the JSValue this makes, such as the parse tree or a
 // DOM object that contains a UString
-JSCell* jsOwnedString(ExecState*, const UString&);
+JSCell *jsOwnedString(const UString&); 
 
 extern const double NaN;
 extern const double Inf;
@@ -191,9 +191,9 @@ inline JSValue *jsNull()
     return JSImmediate::nullImmediate();
 }
 
-inline JSValue* jsNaN(ExecState* exec)
+inline JSValue *jsNaN()
 {
-    return jsNumberCell(exec, NaN);
+    return jsNumberCell(NaN);
 }
 
 inline JSValue *jsBoolean(bool b)
@@ -201,53 +201,53 @@ inline JSValue *jsBoolean(bool b)
     return b ? JSImmediate::trueImmediate() : JSImmediate::falseImmediate();
 }
 
-ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, double d)
+ALWAYS_INLINE JSValue* jsNumber(double d)
 {
     JSValue* v = JSImmediate::from(d);
-    return v ? v : jsNumberCell(exec, d);
+    return v ? v : jsNumberCell(d);
 }
 
-ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, int i)
+ALWAYS_INLINE JSValue* jsNumber(int i)
 {
     JSValue* v = JSImmediate::from(i);
-    return v ? v : jsNumberCell(exec, i);
+    return v ? v : jsNumberCell(i);
 }
 
-ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, unsigned i)
+ALWAYS_INLINE JSValue* jsNumber(unsigned i)
 {
     JSValue* v = JSImmediate::from(i);
-    return v ? v : jsNumberCell(exec, i);
+    return v ? v : jsNumberCell(i);
 }
 
-ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, long i)
+ALWAYS_INLINE JSValue* jsNumber(long i)
 {
     JSValue* v = JSImmediate::from(i);
-    return v ? v : jsNumberCell(exec, i);
+    return v ? v : jsNumberCell(i);
 }
 
-ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, unsigned long i)
+ALWAYS_INLINE JSValue* jsNumber(unsigned long i)
 {
     JSValue* v = JSImmediate::from(i);
-    return v ? v : jsNumberCell(exec, i);
+    return v ? v : jsNumberCell(i);
 }
 
-ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, long long i)
+ALWAYS_INLINE JSValue* jsNumber(long long i)
 {
     JSValue* v = JSImmediate::from(i);
-    return v ? v : jsNumberCell(exec, static_cast<double>(i));
+    return v ? v : jsNumberCell(static_cast<double>(i));
 }
 
-ALWAYS_INLINE JSValue* jsNumber(ExecState* exec, unsigned long long i)
+ALWAYS_INLINE JSValue* jsNumber(unsigned long long i)
 {
     JSValue* v = JSImmediate::from(i);
-    return v ? v : jsNumberCell(exec, static_cast<double>(i));
+    return v ? v : jsNumberCell(static_cast<double>(i));
 }
 
 ALWAYS_INLINE JSValue* jsNumberFromAnd(ExecState *exec, JSValue* v1, JSValue* v2)
 {
     if (JSImmediate::areBothImmediateNumbers(v1, v2))
         return JSImmediate::andImmediateNumbers(v1, v2);
-    return jsNumber(exec, v1->toInt32(exec) & v2->toInt32(exec));
+    return jsNumber(v1->toInt32(exec) & v2->toInt32(exec));
 }
 
 inline JSValue::JSValue()
@@ -283,12 +283,12 @@ inline bool JSCell::isObject() const
 
 inline bool JSCell::marked() const
 {
-    return Heap::isCellMarked(this);
+    return Collector::isCellMarked(this);
 }
 
 inline void JSCell::mark()
 {
-    return Heap::markCell(this);
+    return Collector::markCell(this);
 }
 
 ALWAYS_INLINE JSCell* JSValue::asCell()
@@ -445,7 +445,7 @@ ALWAYS_INLINE double JSValue::toNumber(ExecState *exec) const
 
 ALWAYS_INLINE JSValue* JSValue::toJSNumber(ExecState* exec) const
 {
-    return JSImmediate::isNumber(this) ? const_cast<JSValue*>(this) : jsNumber(exec, this->toNumber(exec));
+    return JSImmediate::isNumber(this) ? const_cast<JSValue*>(this) : jsNumber(this->toNumber(exec));
 }
 
 inline UString JSValue::toString(ExecState *exec) const
index ffe5a3b..605ffbd 100644 (file)
@@ -109,7 +109,7 @@ inline ThreadSpecific<T>::operator T*()
 {
     T* ptr = static_cast<T*>(get());
     if (!ptr) {
-        ptr = new T();
+        ptr = new T;
         set(ptr);
     }
     return ptr;
index 496cdea..824bb6e 100644 (file)
@@ -1,3 +1,21 @@
+2008-05-12  Alexey Proskuryakov  <ap@webkit.org>
+
+        Roll out recent  threading changes (r32807, r32810, r32819, r32822) to simplify
+        SquirrelFish merging.
+
+        * JSUtils.cpp:
+        (JSObjectKJSValue):
+        * JSUtils.h:
+        * JSValueWrapper.cpp:
+        (unprotectGlobalObject):
+        (initializeGlobalObjectKey):
+        (getThreadGlobalExecState):
+        * JavaScriptGlue.cpp:
+        (JSCollect):
+        (JSLockInterpreter):
+        * UserObjectImp.cpp:
+        (UserObjectImp::toPrimitive):
+
 2008-05-02  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
index 87d0a46..dbc370e 100644 (file)
@@ -155,14 +155,14 @@ JSValue *JSObjectKJSValue(JSUserObject* ptr)
                     CFTypeID typeID = CFGetTypeID(cfType);
                     if (typeID == CFStringGetTypeID())
                     {
-                        result = jsString(getThreadGlobalExecState(), CFStringToUString((CFStringRef)cfType));
+                        result = jsString(CFStringToUString((CFStringRef)cfType));
                         handled = true;
                     }
                     else if (typeID == CFNumberGetTypeID())
                     {
                         double num;
                         CFNumberGetValue((CFNumberRef)cfType, kCFNumberDoubleType, &num);
-                        result = jsNumber(getThreadGlobalExecState(), num);
+                        result = jsNumber(num);
                         handled = true;
                     }
                     else if (typeID == CFBooleanGetTypeID())
@@ -181,7 +181,7 @@ JSValue *JSObjectKJSValue(JSUserObject* ptr)
         }
         if (!handled)
         {
-            result = new (getThreadGlobalExecState()) UserObjectImp(ptr);
+            result = new UserObjectImp(ptr);
         }
     }
     return result;
@@ -378,50 +378,3 @@ CFTypeRef GetCFNull(void)
     return result;
 }
 
-/*
- * This is a slight hack. The JSGlue API has no concept of execution state.
- * However, execution state is an inherent part of JS, and JSCore requires it.
- * So, we keep a single execution state for the whole thread and supply it
- * where necessary.
-
- * The execution state holds two things: (1) exceptions; (2) the global object. 
- * JSGlue has no API for accessing exceptions, so we just discard them. As for
- * the global object, JSGlue includes no calls that depend on it. Its property
- * getters and setters are per-object; they don't walk up the enclosing scope. 
- * Functions called by JSObjectCallFunction may reference values in the enclosing 
- * scope, but they do so through an internally stored scope chain, so we don't 
- * need to supply the global scope.
- */      
-
-pthread_key_t globalObjectKey;
-pthread_once_t globalObjectKeyOnce = PTHREAD_ONCE_INIT;
-
-static void unprotectGlobalObject(void* data) 
-{
-    JSLock lock;
-    gcUnprotect(static_cast<JSGlobalObject*>(data));
-}
-
-static void initializeGlobalObjectKey()
-{
-    pthread_key_create(&globalObjectKey, unprotectGlobalObject);
-}
-
-ExecState* getThreadGlobalExecState()
-{
-    pthread_once(&globalObjectKeyOnce, initializeGlobalObjectKey);
-    JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(pthread_getspecific(globalObjectKey));
-    if (!globalObject) {
-        globalObject = new JSGlueGlobalObject;
-        gcProtect(globalObject);
-        pthread_setspecific(globalObjectKey, globalObject);
-    }
-    
-    ExecState* exec = globalObject->globalExec();
-
-    // Discard exceptions -- otherwise an exception would forestall JS 
-    // evaluation throughout the thread
-    exec->clearException();
-    return exec;
-}
-
index 76fa38d..1fe8428 100644 (file)
@@ -62,8 +62,6 @@ CFTypeRef GetCFNull(void);
 inline CFTypeRef RetainCFType(CFTypeRef x) { if (x) x = CFRetain(x); return x; }
 inline void ReleaseCFType(CFTypeRef x) { if (x) CFRelease(x);  }
 
-ExecState* getThreadGlobalExecState();
-
 enum {
     kJSInvalidTypeID = 0,
     kJSObjectTypeID,
index 97f5eb8..4cc9a38 100644 (file)
@@ -46,6 +46,53 @@ JSValue *JSValueWrapper::GetValue()
     return fValue;
 }
 
+/*
+ * This is a slight hack. The JSGlue API has no concept of execution state.
+ * However, execution state is an inherent part of JS, and JSCore requires it.
+ * So, we keep a single execution state for the whole thread and supply it
+ * where necessary.
+
+ * The execution state holds two things: (1) exceptions; (2) the global object. 
+ * JSGlue has no API for accessing exceptions, so we just discard them. As for
+ * the global object, JSGlue includes no calls that depend on it. Its property
+ * getters and setters are per-object; they don't walk up the enclosing scope. 
+ * Functions called by JSObjectCallFunction may reference values in the enclosing 
+ * scope, but they do so through an internally stored scope chain, so we don't 
+ * need to supply the global scope.
+ */      
+
+pthread_key_t globalObjectKey;
+pthread_once_t globalObjectKeyOnce = PTHREAD_ONCE_INIT;
+
+static void unprotectGlobalObject(void* data) 
+{
+    JSLock lock;
+    gcUnprotect(static_cast<JSGlobalObject*>(data));
+}
+
+static void initializeGlobalObjectKey()
+{
+    pthread_key_create(&globalObjectKey, unprotectGlobalObject);
+}
+
+static ExecState* getThreadGlobalExecState()
+{
+    pthread_once(&globalObjectKeyOnce, initializeGlobalObjectKey);
+    JSGlobalObject* globalObject = static_cast<JSGlobalObject*>(pthread_getspecific(globalObjectKey));
+    if (!globalObject) {
+        globalObject = new JSGlueGlobalObject;
+        gcProtect(globalObject);
+        pthread_setspecific(globalObjectKey, globalObject);
+    }
+    
+    ExecState* exec = globalObject->globalExec();
+
+    // Discard exceptions -- otherwise an exception would forestall JS 
+    // evaluation throughout the thread
+    exec->clearException();
+    return exec;
+}
+
 void JSValueWrapper::GetJSObectCallBacks(JSObjectCallBacks& callBacks)
 {
     callBacks.dispose = (JSObjectDisposeProcPtr)JSValueWrapper::JSObjectDispose;
index 87c0ca2..13fb6c3 100644 (file)
@@ -338,7 +338,7 @@ void JSCollect()
     initializeThreading();
 
     JSLock lock;
-    getThreadGlobalExecState()->heap()->collect();
+    Collector::collect();
 }
 
 /*
@@ -649,6 +649,7 @@ void JSLockInterpreter()
 {
     initializeThreading();
     JSLock::lock();
+    JSLock::registerThread();
 }
 
 
index b8a17ab..7217c40 100644 (file)
@@ -183,15 +183,15 @@ JSValue *UserObjectImp::toPrimitive(ExecState *exec, JSType preferredType) const
                 result = jsBoolean(false);
             }
         } else if (cfType == CFStringGetTypeID()) {
-            result = jsString(exec, CFStringToUString((CFStringRef)cfValue));
+            result = jsString(CFStringToUString((CFStringRef)cfValue));
         } else if (cfType == CFNumberGetTypeID()) {
             double d = 0.0;
             CFNumberGetValue((CFNumberRef)cfValue, kCFNumberDoubleType, &d);
-            result = jsNumber(exec, d);
+            result = jsNumber(d);
         } else if (cfType == CFURLGetTypeID()) {
             CFURLRef absURL = CFURLCopyAbsoluteURL((CFURLRef)cfValue);
             if (absURL) {
-                result = jsString(exec, CFStringToUString(CFURLGetString(absURL)));
+                result = jsString(CFStringToUString(CFURLGetString(absURL)));
                 ReleaseCFType(absURL);
             }
         }
index bb29ca2..9380b2b 100644 (file)
@@ -1,3 +1,211 @@
+2008-05-12  Alexey Proskuryakov  <ap@webkit.org>
+
+        Roll out recent  threading changes (r32807, r32810, r32819, r32822) to simplify
+        SquirrelFish merging.
+
+        * bindings/js/GCController.cpp:
+        (WebCore::collect):
+        (WebCore::GCController::gcTimerFired):
+        (WebCore::GCController::garbageCollectNow):
+        * bindings/js/JSAudioConstructor.cpp:
+        (WebCore::JSAudioConstructor::JSAudioConstructor):
+        * bindings/js/JSCSSRuleCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::JSCSSStyleDeclaration::nameGetter):
+        * bindings/js/JSCSSValueCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSCanvasPixelArrayCustom.cpp:
+        (WebCore::JSCanvasPixelArray::indexGetter):
+        (WebCore::toJS):
+        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSClipboardCustom.cpp:
+        (WebCore::JSClipboard::types):
+        (WebCore::JSClipboard::getData):
+        * bindings/js/JSCustomXPathNSResolver.cpp:
+        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/js/JSDOMApplicationCacheCustom.cpp:
+        (WebCore::JSDOMApplicationCache::addEventListener):
+        (WebCore::JSDOMApplicationCache::removeEventListener):
+        (WebCore::JSDOMApplicationCache::setOnchecking):
+        (WebCore::JSDOMApplicationCache::setOnerror):
+        (WebCore::JSDOMApplicationCache::setOnnoupdate):
+        (WebCore::JSDOMApplicationCache::setOndownloading):
+        (WebCore::JSDOMApplicationCache::setOnprogress):
+        (WebCore::JSDOMApplicationCache::setOnupdateready):
+        (WebCore::JSDOMApplicationCache::setOncached):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::JSDOMWindowBase):
+        (WebCore::JSDOMWindowBase::getValueProperty):
+        (WebCore::JSDOMWindowBase::setListener):
+        (WebCore::JSDOMWindowBase::findOrCreateJSEventListener):
+        (WebCore::JSDOMWindowBase::findJSUnprotectedEventListener):
+        (WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener):
+        (WebCore::windowProtoFuncAToB):
+        (WebCore::windowProtoFuncBToA):
+        (WebCore::windowProtoFuncSetTimeout):
+        (WebCore::windowProtoFuncSetInterval):
+        (WebCore::windowProtoFuncAddEventListener):
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/js/JSDOMWindowShell.cpp:
+        * bindings/js/JSDOMWindowShell.h:
+        * bindings/js/JSDocumentCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSEventTargetBase.cpp:
+        (WebCore::jsEventTargetAddEventListener):
+        * bindings/js/JSEventTargetBase.h:
+        (WebCore::JSEventTargetPrototype::self):
+        * bindings/js/JSEventTargetNode.cpp:
+        (WebCore::JSEventTargetNode::setListener):
+        * bindings/js/JSHTMLCollectionCustom.cpp:
+        (WebCore::getNamedItems):
+        (WebCore::toJS):
+        * bindings/js/JSHTMLElementWrapperFactory.cpp:
+        (WebCore::createJSHTMLWrapper):
+        * bindings/js/JSHTMLFormElementCustom.cpp:
+        (WebCore::JSHTMLFormElement::nameGetter):
+        * bindings/js/JSHTMLInputElementBase.cpp:
+        (WebCore::JSHTMLInputElementBase::getValueProperty):
+        * bindings/js/JSHTMLOptionElementConstructor.cpp:
+        (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor):
+        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
+        (WebCore::JSHTMLOptionsCollection::length):
+        * bindings/js/JSInspectedObjectWrapper.cpp:
+        (WebCore::JSInspectedObjectWrapper::wrap):
+        * bindings/js/JSInspectorCallbackWrapper.cpp:
+        (WebCore::JSInspectorCallbackWrapper::wrap):
+        * bindings/js/JSLocationCustom.cpp:
+        (WebCore::JSLocation::toString):
+        * bindings/js/JSNamedNodesCollection.cpp:
+        (WebCore::JSNamedNodesCollection::lengthGetter):
+        * bindings/js/JSNavigatorCustom.cpp:
+        (WebCore::JSNavigator::appVersion):
+        * bindings/js/JSNodeCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSNodeFilterCustom.cpp:
+        (WebCore::JSNodeFilter::acceptNode):
+        * bindings/js/JSRGBColor.cpp:
+        (WebCore::getJSRGBColor):
+        * bindings/js/JSSQLResultSetRowListCustom.cpp:
+        (WebCore::JSSQLResultSetRowList::item):
+        * bindings/js/JSSVGElementWrapperFactory.cpp:
+        (WebCore::createJSSVGWrapper):
+        * bindings/js/JSSVGLazyEventListener.cpp:
+        (WebCore::JSSVGLazyEventListener::eventParameterName):
+        * bindings/js/JSStorageCustom.cpp:
+        (WebCore::JSStorage::nameGetter):
+        * bindings/js/JSStyleSheetCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSXMLHttpRequestConstructor.cpp:
+        (WebCore::JSXMLHttpRequestConstructor::construct):
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::setOnreadystatechange):
+        (WebCore::JSXMLHttpRequest::setOnload):
+        (WebCore::JSXMLHttpRequest::setOnprogress):
+        (WebCore::JSXMLHttpRequest::getResponseHeader):
+        (WebCore::JSXMLHttpRequest::addEventListener):
+        (WebCore::JSXMLHttpRequest::removeEventListener):
+        * bindings/js/JSXSLTProcessorConstructor.cpp:
+        (WebCore::JSXSLTProcessorConstructor::construct):
+        * bindings/js/JSXSLTProcessorCustom.cpp:
+        (WebCore::JSXSLTProcessor::getParameter):
+        * bindings/js/kjs_binding.cpp:
+        (WebCore::jsStringOrNull):
+        (WebCore::jsOwnedStringOrNull):
+        (WebCore::jsStringOrUndefined):
+        (WebCore::jsStringOrFalse):
+        (WebCore::nonCachingStaticFunctionGetter):
+        (WebCore::objectToStringFunctionGetter):
+        * bindings/js/kjs_binding.h:
+        (WebCore::DOMObject::DOMObject):
+        (WebCore::cacheDOMObject):
+        (WebCore::cacheSVGDOMObject):
+        * bindings/js/kjs_events.cpp:
+        (WebCore::JSLazyEventListener::eventParameterName):
+        (WebCore::JSLazyEventListener::parseCode):
+        * bindings/js/kjs_html.cpp:
+        (WebCore::getRuntimeObject):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * bridge/c/c_instance.cpp:
+        (KJS::Bindings::CInstance::defaultValue):
+        (KJS::Bindings::CInstance::stringValue):
+        (KJS::Bindings::CInstance::numberValue):
+        (KJS::Bindings::CInstance::valueOf):
+        * bridge/c/c_instance.h:
+        * bridge/c/c_utility.cpp:
+        (KJS::Bindings::convertNPVariantToValue):
+        * bridge/jni/jni_instance.cpp:
+        (JavaInstance::stringValue):
+        (JavaInstance::numberValue):
+        (JavaInstance::invokeMethod):
+        (JavaInstance::defaultValue):
+        (JavaInstance::valueOf):
+        * bridge/jni/jni_instance.h:
+        * bridge/jni/jni_jsobject.h:
+        * bridge/jni/jni_jsobject.mm:
+        (JavaJSObject::call):
+        (JavaJSObject::setMember):
+        (JavaJSObject::setSlot):
+        (JavaJSObject::convertJObjectToValue):
+        (JavaJSObject::getListFromJArray):
+        * bridge/jni/jni_objc.mm:
+        (KJS::Bindings::dispatchJNICall):
+        * bridge/jni/jni_runtime.cpp:
+        (JavaArray::convertJObjectToArray):
+        (JavaField::dispatchValueFromInstance):
+        (JavaField::valueFromInstance):
+        (JavaField::dispatchSetValueToInstance):
+        (JavaArray::valueAt):
+        * bridge/jni/jni_utility.h:
+        * bridge/objc/objc_class.mm:
+        (KJS::Bindings::ObjcClass::fallbackObject):
+        * bridge/objc/objc_instance.h:
+        * bridge/objc/objc_instance.mm:
+        (ObjcInstance::defaultValue):
+        (ObjcInstance::stringValue):
+        (ObjcInstance::numberValue):
+        (ObjcInstance::valueOf):
+        * bridge/objc/objc_utility.h:
+        * bridge/objc/objc_utility.mm:
+        (KJS::Bindings::convertNSStringToString):
+        (KJS::Bindings::convertObjcValueToValue):
+        * bridge/qt/qt_class.cpp:
+        (KJS::Bindings::QtClass::fallbackObject):
+        * bridge/qt/qt_instance.cpp:
+        (KJS::Bindings::QtRuntimeObjectImp::construct):
+        (KJS::Bindings::QtInstance::getRuntimeObject):
+        (KJS::Bindings::QtInstance::invokeDefaultMethod):
+        (KJS::Bindings::QtInstance::defaultValue):
+        (KJS::Bindings::QtInstance::stringValue):
+        (KJS::Bindings::QtInstance::numberValue):
+        (KJS::Bindings::QtInstance::valueOf):
+        * bridge/qt/qt_instance.h:
+        * bridge/qt/qt_runtime.cpp:
+        (KJS::Bindings::convertValueToQVariant):
+        (KJS::Bindings::convertQVariantToValue):
+        (KJS::Bindings::QtRuntimeMetaMethod::lengthGetter):
+        (KJS::Bindings::QtRuntimeMetaMethod::connectGetter):
+        (KJS::Bindings::QtRuntimeMetaMethod::disconnectGetter):
+        (KJS::Bindings::QtRuntimeConnectionMethod::lengthGetter):
+        (KJS::Bindings::QtConnectionObject::execute):
+        * bridge/runtime.cpp:
+        (KJS::Bindings::Instance::createRuntimeObject):
+        * bridge/runtime.h:
+        (KJS::Bindings::Instance::valueOf):
+        * bridge/runtime_array.cpp:
+        (RuntimeArray::lengthGetter):
+        * bridge/runtime_method.cpp:
+        (RuntimeMethod::lengthGetter):
+        * bridge/runtime_object.cpp:
+        (RuntimeObjectImp::RuntimeObjectImp):
+        (RuntimeObjectImp::methodGetter):
+        (RuntimeObjectImp::defaultValue):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::dropProtection):
+
 2008-05-11  Robin Dunn  <robin@alldunn.com>
 
         Reviewed by Kevin Ollivier.
index 128bb04..94c48a1 100644 (file)
@@ -42,7 +42,7 @@ namespace WebCore {
 static void* collect(void*)
 {
     JSLock lock;
-    Heap::threadHeap()->collect();
+    Collector::collect();
     return 0;
 }
 
@@ -68,13 +68,13 @@ void GCController::garbageCollectSoon()
 void GCController::gcTimerFired(Timer<GCController>*)
 {
     JSLock lock;
-    Heap::threadHeap()->collect();
+    Collector::collect();
 }
 
 void GCController::garbageCollectNow()
 {
     JSLock lock;
-    Heap::threadHeap()->collect();
+    Collector::collect();
 }
 
 void GCController::garbageCollectOnAlternateThreadForDebugging(bool waitUntilDone)
index 8fa7f53..ab4e735 100644 (file)
@@ -43,7 +43,7 @@ JSAudioConstructor::JSAudioConstructor(ExecState* exec, Document* document)
     : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
     , m_document(document)
 {
-    putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
+    putDirect(exec->propertyNames().length, jsNumber(1), ReadOnly|DontDelete|DontEnum);
 }
 
 bool JSAudioConstructor::implementsConstruct() const
index 6eff6a9..44a52a6 100644 (file)
@@ -55,25 +55,25 @@ JSValue* toJS(ExecState* exec, CSSRule* rule)
 
     switch (rule->type()) {
         case CSSRule::STYLE_RULE:
-            ret = new (exec) JSCSSStyleRule(JSCSSRulePrototype::self(exec), static_cast<CSSStyleRule*>(rule));
+            ret = new JSCSSStyleRule(JSCSSRulePrototype::self(exec), static_cast<CSSStyleRule*>(rule));
             break;
         case CSSRule::MEDIA_RULE:
-            ret = new (exec) JSCSSMediaRule(JSCSSMediaRulePrototype::self(exec), static_cast<CSSMediaRule*>(rule));
+            ret = new JSCSSMediaRule(JSCSSMediaRulePrototype::self(exec), static_cast<CSSMediaRule*>(rule));
             break;
         case CSSRule::FONT_FACE_RULE:
-            ret = new (exec) JSCSSFontFaceRule(JSCSSFontFaceRulePrototype::self(exec), static_cast<CSSFontFaceRule*>(rule));
+            ret = new JSCSSFontFaceRule(JSCSSFontFaceRulePrototype::self(exec), static_cast<CSSFontFaceRule*>(rule));
             break;
         case CSSRule::PAGE_RULE:
-            ret = new (exec) JSCSSPageRule(JSCSSPageRulePrototype::self(exec), static_cast<CSSPageRule*>(rule));
+            ret = new JSCSSPageRule(JSCSSPageRulePrototype::self(exec), static_cast<CSSPageRule*>(rule));
             break;
         case CSSRule::IMPORT_RULE:
-            ret = new (exec) JSCSSImportRule(JSCSSImportRulePrototype::self(exec), static_cast<CSSImportRule*>(rule));
+            ret = new JSCSSImportRule(JSCSSImportRulePrototype::self(exec), static_cast<CSSImportRule*>(rule));
             break;
         case CSSRule::CHARSET_RULE:
-            ret = new (exec) JSCSSCharsetRule(JSCSSCharsetRulePrototype::self(exec), static_cast<CSSCharsetRule*>(rule));
+            ret = new JSCSSCharsetRule(JSCSSCharsetRulePrototype::self(exec), static_cast<CSSCharsetRule*>(rule));
             break;
         default:
-            ret = new (exec) JSCSSRule(JSCSSRulePrototype::self(exec), rule);
+            ret = new JSCSSRule(JSCSSRulePrototype::self(exec), rule);
             break;
     }
 
index 6750cd0..8483365 100644 (file)
@@ -138,8 +138,8 @@ JSValue* JSCSSStyleDeclaration::nameGetter(ExecState* exec, JSObject* originalOb
     RefPtr<CSSValue> v = thisObj->impl()->getPropertyCSSValue(prop);
     if (v) {
         if (pixelOrPos && v->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE)
-            return jsNumber(exec, static_pointer_cast<CSSPrimitiveValue>(v)->getFloatValue(CSSPrimitiveValue::CSS_PX));
-        return jsStringOrNull(exec, v->cssText());
+            return jsNumber(static_pointer_cast<CSSPrimitiveValue>(v)->getFloatValue(CSSPrimitiveValue::CSS_PX));
+        return jsStringOrNull(v->cssText());
     }
 
     // If the property is a shorthand property (such as "padding"), 
@@ -147,10 +147,10 @@ JSValue* JSCSSStyleDeclaration::nameGetter(ExecState* exec, JSObject* originalOb
 
     // Make the SVG 'filter' attribute undetectable, to avoid confusion with the IE 'filter' attribute.
     if (propertyName == "filter")
-        return new (exec) StringInstanceThatMasqueradesAsUndefined(exec, exec->lexicalGlobalObject()->stringPrototype(),
+        return new StringInstanceThatMasqueradesAsUndefined(exec->lexicalGlobalObject()->stringPrototype(),
             thisObj->impl()->getPropertyValue(prop));
 
-    return jsString(exec, thisObj->impl()->getPropertyValue(prop));
+    return jsString(thisObj->impl()->getPropertyValue(prop));
 }
 
 
index e545119..88147d7 100644 (file)
@@ -53,17 +53,17 @@ JSValue* toJS(ExecState* exec, CSSValue* value)
         return ret;
 
     if (value->isValueList())
-        ret = new (exec) JSCSSValueList(JSCSSValueListPrototype::self(exec), static_cast<CSSValueList*>(value));
+        ret = new JSCSSValueList(JSCSSValueListPrototype::self(exec), static_cast<CSSValueList*>(value));
 #if ENABLE(SVG)
     else if (value->isSVGPaint())
-        ret = new (exec) JSSVGPaint(JSSVGPaintPrototype::self(exec), static_cast<SVGPaint*>(value));
+        ret = new JSSVGPaint(JSSVGPaintPrototype::self(exec), static_cast<SVGPaint*>(value));
     else if (value->isSVGColor())
-        ret = new (exec) JSSVGColor(JSSVGColorPrototype::self(exec), static_cast<SVGColor*>(value));
+        ret = new JSSVGColor(JSSVGColorPrototype::self(exec), static_cast<SVGColor*>(value));
 #endif
     else if (value->isPrimitiveValue())
-        ret = new (exec) JSCSSPrimitiveValue(JSCSSPrimitiveValuePrototype::self(exec), static_cast<CSSPrimitiveValue*>(value));
+        ret = new JSCSSPrimitiveValue(JSCSSPrimitiveValuePrototype::self(exec), static_cast<CSSPrimitiveValue*>(value));
     else
-        ret = new (exec) JSCSSValue(JSCSSValuePrototype::self(exec), value);
+        ret = new JSCSSValue(JSCSSValuePrototype::self(exec), value);
 
     ScriptInterpreter::putDOMObject(value, ret);
     return ret;
index d592f93..23e6afd 100644 (file)
@@ -42,7 +42,7 @@ JSValue* JSCanvasPixelArray::indexGetter(ExecState* exec, JSObject*, const Ident
     unsigned char result;
     if (!array->get(index, result))
         return jsUndefined();
-    return jsNumber(exec, result);
+    return jsNumber(result);
 }
 
 void JSCanvasPixelArray::indexSetter(ExecState* exec, unsigned index, JSValue* value)
@@ -62,9 +62,9 @@ JSValue* toJS(ExecState* exec, CanvasPixelArray* pixels)
     if (ret)
         return ret;
     
-    ret = new (exec) JSCanvasPixelArray(JSCanvasPixelArrayPrototype::self(exec), pixels);
+    ret = new JSCanvasPixelArray(JSCanvasPixelArrayPrototype::self(exec), pixels);
     
-    exec->heap()->reportExtraMemoryCost(pixels->length());
+    Collector::reportExtraMemoryCost(pixels->length());
     
     ScriptInterpreter::putDOMObject(pixels, ret);
     
index 27ff91e..e952302 100644 (file)
@@ -46,7 +46,7 @@ static JSValue* toJS(ExecState* exec, CanvasStyle* style)
         return toJS(exec, style->canvasGradient());
     if (style->pattern())
         return toJS(exec, style->pattern());
-    return jsString(exec, style->color());
+    return jsString(style->color());
 }
 
 static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState* exec, JSValue* value)
index 7d89b3b..422e646 100644 (file)
@@ -58,7 +58,7 @@ JSValue* JSClipboard::types(ExecState* exec) const
     List list;
     HashSet<String>::const_iterator end = types.end();
     for (HashSet<String>::const_iterator it = types.begin(); it != end; ++it)
-        list.append(jsString(exec, UString(*it)));
+        list.append(jsString(UString(*it)));
     return exec->lexicalGlobalObject()->arrayConstructor()->construct(exec, list);
 }
 
@@ -93,7 +93,7 @@ JSValue* JSClipboard::getData(ExecState* exec, const List& args)
     if (!success)
         return jsUndefined();
 
-    return jsString(exec, result);
+    return jsString(result);
 }
 
 JSValue* JSClipboard::setData(ExecState* exec, const List& args)
index e8f8686..d1d604b 100644 (file)
@@ -97,7 +97,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
     RefPtr<JSCustomXPathNSResolver> selfProtector(this);
 
     List args;
-    args.append(jsString(exec, prefix));
+    args.append(jsString(prefix));
 
     String result;
     JSValue* retval;
index 9e27b7b..89aea2c 100644 (file)
@@ -73,7 +73,7 @@ JSValue* JSDOMApplicationCache::addEventListener(ExecState* exec, const List& ar
     Frame* frame = impl()->frame();
     if (!frame)
         return jsUndefined();
-    JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, args[1], true);
+    JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
     if (!listener)
         return jsUndefined();
     impl()->addEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
@@ -85,7 +85,7 @@ JSValue* JSDOMApplicationCache::removeEventListener(ExecState* exec, const List&
     Frame* frame = impl()->frame();
     if (!frame)
         return jsUndefined();
-    JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, args[1], true);
+    JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
     if (!listener)
         return jsUndefined();
     impl()->removeEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
@@ -102,10 +102,10 @@ JSValue* JSDOMApplicationCache::dispatchEvent(KJS::ExecState* exec, const List&
     return jsBoolean(result);    
 }
 
-void JSDOMApplicationCache::setOnchecking(ExecState* exec, JSValue* value)
+void JSDOMApplicationCache::setOnchecking(ExecState*, JSValue* value)
 {
     if (Frame* frame = impl()->frame())
-        impl()->setOnCheckingListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, value, true));
+        impl()->setOnCheckingListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
 }
 
 JSValue* JSDOMApplicationCache::onchecking(ExecState*) const
@@ -116,10 +116,10 @@ JSValue* JSDOMApplicationCache::onchecking(ExecState*) const
     return jsNull();
 }
 
-void JSDOMApplicationCache::setOnerror(ExecState* exec, JSValue* value)
+void JSDOMApplicationCache::setOnerror(ExecState*, JSValue* value)
 {
     if (Frame* frame = impl()->frame())
-        impl()->setOnErrorListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, value, true));
+        impl()->setOnErrorListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
 }
 
 JSValue* JSDOMApplicationCache::onerror(ExecState*) const
@@ -130,10 +130,10 @@ JSValue* JSDOMApplicationCache::onerror(ExecState*) const
     return jsNull();
 }
 
-void JSDOMApplicationCache::setOnnoupdate(ExecState* exec, JSValue* value)
+void JSDOMApplicationCache::setOnnoupdate(ExecState*, JSValue* value)
 {
     if (Frame* frame = impl()->frame())
-        impl()->setOnNoUpdateListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, value, true));
+        impl()->setOnNoUpdateListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
 }
 
 JSValue* JSDOMApplicationCache::onnoupdate(ExecState*) const
@@ -144,10 +144,10 @@ JSValue* JSDOMApplicationCache::onnoupdate(ExecState*) const
     return jsNull();
 }
 
-void JSDOMApplicationCache::setOndownloading(ExecState* exec, JSValue* value)
+void JSDOMApplicationCache::setOndownloading(ExecState*, JSValue* value)
 {
     if (Frame* frame = impl()->frame())
-        impl()->setOnDownloadingListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, value, true));
+        impl()->setOnDownloadingListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
 }
 
 JSValue* JSDOMApplicationCache::ondownloading(ExecState*) const
@@ -158,10 +158,10 @@ JSValue* JSDOMApplicationCache::ondownloading(ExecState*) const
     return jsNull();
 }
 
-void JSDOMApplicationCache::setOnprogress(ExecState* exec, JSValue* value)
+void JSDOMApplicationCache::setOnprogress(ExecState*, JSValue* value)
 {
     if (Frame* frame = impl()->frame())
-        impl()->setOnProgressListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, value, true));
+        impl()->setOnProgressListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
 }
 
 JSValue* JSDOMApplicationCache::onprogress(ExecState*) const
@@ -172,10 +172,10 @@ JSValue* JSDOMApplicationCache::onprogress(ExecState*) const
     return jsNull();
 }
 
-void JSDOMApplicationCache::setOnupdateready(ExecState* exec, JSValue* value)
+void JSDOMApplicationCache::setOnupdateready(ExecState*, JSValue* value)
 {
     if (Frame* frame = impl()->frame())
-        impl()->setOnUpdateReadyListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, value, true));
+        impl()->setOnUpdateReadyListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
 }
 
 JSValue* JSDOMApplicationCache::onupdateready(ExecState*) const
@@ -186,10 +186,10 @@ JSValue* JSDOMApplicationCache::onupdateready(ExecState*) const
     return jsNull();
 }
 
-void JSDOMApplicationCache::setOncached(ExecState* exec, JSValue* value)
+void JSDOMApplicationCache::setOncached(ExecState*, JSValue* value)
 {
     if (Frame* frame = impl()->frame())
-        impl()->setOnCachedListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(exec, value, true));
+        impl()->setOnCachedListener(toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(value, true));
 }
 
 JSValue* JSDOMApplicationCache::oncached(ExecState*) const
index e1e8110..2f4f612 100644 (file)
@@ -199,6 +199,10 @@ JSDOMWindowBase::JSDOMWindowBase(JSObject* prototype, DOMWindow* window, JSDOMWi
     , m_impl(window)
     , d(new JSDOMWindowBasePrivate(shell))
 {
+    // JSDOMWindowBase destruction is not thread-safe because of
+    // the non-thread-safe WebCore structures it references.
+    Collector::collectOnMainThreadOnly(this);
+
     // Time in milliseconds before the script timeout handler kicks in.
     setTimeoutTime(10000);
 }
@@ -426,22 +430,22 @@ JSValue *JSDOMWindowBase::getValueProperty(ExecState *exec, int token) const
         return jsUndefined();
       // FIXME: this property (and the few below) probably shouldn't create a new object every
       // time
-      return new (exec) JSImageConstructor(exec, impl()->frame()->document());
+      return new JSImageConstructor(exec, impl()->frame()->document());
     case Option:
       if (!allowsAccessFrom(exec))
         return jsUndefined();
-      return new (exec) JSHTMLOptionElementConstructor(exec, impl()->frame()->document());
+      return new JSHTMLOptionElementConstructor(exec, impl()->frame()->document());
     case XMLHttpRequest:
       if (!allowsAccessFrom(exec))
         return jsUndefined();
-      return new (exec) JSXMLHttpRequestConstructor(exec, impl()->frame()->document());
+      return new JSXMLHttpRequestConstructor(exec, impl()->frame()->document());
     case Audio:
 #if ENABLE(VIDEO)
       if (!allowsAccessFrom(exec))
         return jsUndefined();
       if (!MediaPlayer::isAvailable())
         return jsUndefined();
-      return new (exec) JSAudioConstructor(exec, impl()->frame()->document());
+      return new JSAudioConstructor(exec, impl()->frame()->document());
 #else
       return jsUndefined();
 #endif
@@ -449,7 +453,7 @@ JSValue *JSDOMWindowBase::getValueProperty(ExecState *exec, int token) const
 #if ENABLE(XSLT)
       if (!allowsAccessFrom(exec))
         return jsUndefined();
-      return new (exec) JSXSLTProcessorConstructor(exec);
+      return new JSXSLTProcessorConstructor(exec);
 #else
       return jsUndefined();
 #endif
@@ -840,7 +844,7 @@ void JSDOMWindowBase::setListener(ExecState* exec, const AtomicString& eventType
     if (!doc)
         return;
 
-    doc->setHTMLWindowEventListener(eventType, findOrCreateJSEventListener(exec, func, true));
+    doc->setHTMLWindowEventListener(eventType, findOrCreateJSEventListener(func, true));
 }
 
 JSValue* JSDOMWindowBase::getListener(ExecState* exec, const AtomicString& eventType) const
@@ -865,7 +869,7 @@ JSEventListener* JSDOMWindowBase::findJSEventListener(JSValue* val, bool html)
     return listeners.get(object);
 }
 
-JSEventListener* JSDOMWindowBase::findOrCreateJSEventListener(ExecState* exec, JSValue* val, bool html)
+JSEventListener* JSDOMWindowBase::findOrCreateJSEventListener(JSValue* val, bool html)
 {
     JSEventListener* listener = findJSEventListener(val, html);
     if (listener)
@@ -879,7 +883,7 @@ JSEventListener* JSDOMWindowBase::findOrCreateJSEventListener(ExecState* exec, J
     return new JSEventListener(object, static_cast<JSDOMWindow*>(this), html);
 }
 
-JSUnprotectedEventListener* JSDOMWindowBase::findJSUnprotectedEventListener(ExecState* exec, JSValue* val, bool html)
+JSUnprotectedEventListener* JSDOMWindowBase::findJSUnprotectedEventListener(JSValue* val, bool html)
 {
     if (!val->isObject())
         return 0;
@@ -888,9 +892,9 @@ JSUnprotectedEventListener* JSDOMWindowBase::findJSUnprotectedEventListener(Exec
     return listeners.get(object);
 }
 
-JSUnprotectedEventListener* JSDOMWindowBase::findOrCreateJSUnprotectedEventListener(ExecState* exec, JSValue* val, bool html)
+JSUnprotectedEventListener* JSDOMWindowBase::findOrCreateJSUnprotectedEventListener(JSValue* val, bool html)
 {
-    JSUnprotectedEventListener* listener = findJSUnprotectedEventListener(exec, val, html);
+    JSUnprotectedEventListener* listener = findJSUnprotectedEventListener(val, html);
     if (listener)
         return listener;
     if (!val->isObject())
@@ -951,7 +955,7 @@ JSValue* windowProtoFuncAToB(ExecState* exec, JSObject* thisObj, const List& arg
 
     JSValue* v = args[0];
     if (v->isNull())
-        return jsString(exec);
+        return jsString();
 
     UString s = v->toString(exec);
     if (!s.is8Bit()) {
@@ -967,7 +971,7 @@ JSValue* windowProtoFuncAToB(ExecState* exec, JSObject* thisObj, const List& arg
     if (!base64Decode(in, out))
         return throwError(exec, GeneralError, "Cannot decode base64");
 
-    return jsString(exec, String(out.data(), out.size()));
+    return jsString(String(out.data(), out.size()));
 }
 
 JSValue* windowProtoFuncBToA(ExecState* exec, JSObject* thisObj, const List& args)
@@ -984,7 +988,7 @@ JSValue* windowProtoFuncBToA(ExecState* exec, JSObject* thisObj, const List& arg
 
     JSValue* v = args[0];
     if (v->isNull())
-        return jsString(exec);
+        return jsString();
 
     UString s = v->toString(exec);
     if (!s.is8Bit()) {
@@ -999,7 +1003,7 @@ JSValue* windowProtoFuncBToA(ExecState* exec, JSObject* thisObj, const List& arg
 
     base64Encode(in, out);
 
-    return jsString(exec, String(out.data(), out.size()));
+    return jsString(String(out.data(), out.size()));
 }
 
 JSValue* windowProtoFuncOpen(ExecState* exec, JSObject* thisObj, const List& args)
@@ -1084,11 +1088,11 @@ JSValue* windowProtoFuncSetTimeout(ExecState* exec, JSObject* thisObj, const Lis
 
     JSValue* v = args[0];
     if (v->isString())
-        return jsNumber(exec, window->installTimeout(v->toString(exec), args[1]->toInt32(exec), true /*single shot*/));
+        return jsNumber(window->installTimeout(v->toString(exec), args[1]->toInt32(exec), true /*single shot*/));
     if (v->isObject() && static_cast<JSObject*>(v)->implementsCall()) {
         List argsTail;
         args.getSlice(2, argsTail);
-        return jsNumber(exec, window->installTimeout(v, argsTail, args[1]->toInt32(exec), true /*single shot*/));
+        return jsNumber(window->installTimeout(v, argsTail, args[1]->toInt32(exec), true /*single shot*/));
     }
 
     return jsUndefined();
@@ -1121,11 +1125,11 @@ JSValue* windowProtoFuncSetInterval(ExecState* exec, JSObject* thisOb