diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-18 14:03:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-18 14:03:11 +0200 |
commit | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (patch) | |
tree | cdca40d0353886b3ca52f33a2d7b8f1c0011aafc /Source/JavaScriptCore/API | |
parent | 1b914638db989aaa98631a1c1e02c7b2d44805d8 (diff) | |
download | qtwebkit-8d473cf9743f1d30a16a27114e93bd5af5648d23.tar.gz |
Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578)
Weekly snapshot
Diffstat (limited to 'Source/JavaScriptCore/API')
-rw-r--r-- | Source/JavaScriptCore/API/JSCallbackFunction.cpp | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/API/JSCallbackFunction.h | 4 | ||||
-rw-r--r-- | Source/JavaScriptCore/API/JSCallbackObject.h | 14 | ||||
-rw-r--r-- | Source/JavaScriptCore/API/JSCallbackObjectFunctions.h | 16 | ||||
-rw-r--r-- | Source/JavaScriptCore/API/JSContextRef.cpp | 16 | ||||
-rw-r--r-- | Source/JavaScriptCore/API/JSObjectRef.cpp | 5 | ||||
-rw-r--r-- | Source/JavaScriptCore/API/JSValueRef.h | 2 |
7 files changed, 36 insertions, 23 deletions
diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.cpp b/Source/JavaScriptCore/API/JSCallbackFunction.cpp index d287ab778..59de186b0 100644 --- a/Source/JavaScriptCore/API/JSCallbackFunction.cpp +++ b/Source/JavaScriptCore/API/JSCallbackFunction.cpp @@ -49,7 +49,7 @@ JSCallbackFunction::JSCallbackFunction(JSGlobalObject* globalObject, JSObjectCal { } -void JSCallbackFunction::finishCreation(JSGlobalData& globalData, const Identifier& name) +void JSCallbackFunction::finishCreation(JSGlobalData& globalData, const UString& name) { Base::finishCreation(globalData, name); ASSERT(inherits(&s_info)); diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.h b/Source/JavaScriptCore/API/JSCallbackFunction.h index fec4136f8..40bef8c48 100644 --- a/Source/JavaScriptCore/API/JSCallbackFunction.h +++ b/Source/JavaScriptCore/API/JSCallbackFunction.h @@ -34,12 +34,12 @@ namespace JSC { class JSCallbackFunction : public InternalFunction { protected: JSCallbackFunction(JSGlobalObject*, JSObjectCallAsFunctionCallback); - void finishCreation(JSGlobalData&, const Identifier& name); + void finishCreation(JSGlobalData&, const UString& name); public: typedef InternalFunction Base; - static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name) + static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const UString& name) { JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(globalObject, callback); function->finishCreation(exec->globalData(), name); diff --git a/Source/JavaScriptCore/API/JSCallbackObject.h b/Source/JavaScriptCore/API/JSCallbackObject.h index 9aca0c7e1..2c3e0e859 100644 --- a/Source/JavaScriptCore/API/JSCallbackObject.h +++ b/Source/JavaScriptCore/API/JSCallbackObject.h @@ -177,12 +177,12 @@ private: static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); - static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&); - static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); + static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&); + static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&); - static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&); + static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&); - static bool deleteProperty(JSCell*, ExecState*, const Identifier&); + static bool deleteProperty(JSCell*, ExecState*, PropertyName); static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned); static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue proto); @@ -209,9 +209,9 @@ private: static EncodedJSValue JSC_HOST_CALL call(ExecState*); static EncodedJSValue JSC_HOST_CALL construct(ExecState*); - JSValue getStaticValue(ExecState*, const Identifier&); - static JSValue staticFunctionGetter(ExecState*, JSValue, const Identifier&); - static JSValue callbackGetter(ExecState*, JSValue, const Identifier&); + JSValue getStaticValue(ExecState*, PropertyName); + static JSValue staticFunctionGetter(ExecState*, JSValue, PropertyName); + static JSValue callbackGetter(ExecState*, JSValue, PropertyName); OwnPtr<JSCallbackObjectData> m_callbackObjectData; }; diff --git a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h index b909dde71..fdc58fccf 100644 --- a/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -122,7 +122,7 @@ UString JSCallbackObject<Parent>::className(const JSObject* object) } template <class Parent> -bool JSCallbackObject<Parent>::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +bool JSCallbackObject<Parent>::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell); JSContextRef ctx = toRef(exec); @@ -205,7 +205,7 @@ JSValue JSCallbackObject<Parent>::defaultValue(const JSObject* object, ExecState } template <class Parent> -bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object); PropertySlot slot; @@ -225,7 +225,7 @@ bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(JSObject* object, ExecSt } template <class Parent> -void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell); JSContextRef ctx = toRef(exec); @@ -284,7 +284,7 @@ void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, const Identifi } template <class Parent> -bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName) +bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) { JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell); JSContextRef ctx = toRef(exec); @@ -504,7 +504,7 @@ bool JSCallbackObject<Parent>::inherits(JSClassRef c) const } template <class Parent> -JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, const Identifier& propertyName) +JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, PropertyName propertyName) { JSObjectRef thisRef = toRef(this); RefPtr<OpaqueJSString> propertyNameRef; @@ -533,7 +533,7 @@ JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, const Identifi } template <class Parent> -JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName) +JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName) { JSCallbackObject* thisObj = asCallbackObject(slotParent); @@ -547,7 +547,7 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.impl())) { if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { - JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, propertyName); + JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, propertyName.ustring()); thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes); return o; } @@ -559,7 +559,7 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue } template <class Parent> -JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName) +JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, PropertyName propertyName) { JSCallbackObject* thisObj = asCallbackObject(slotParent); diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp index 746febfbb..92e03a671 100644 --- a/Source/JavaScriptCore/API/JSContextRef.cpp +++ b/Source/JavaScriptCore/API/JSContextRef.cpp @@ -38,6 +38,12 @@ #include "UStringBuilder.h" #include <wtf/text/StringHash.h> +#if OS(DARWIN) +#include <mach-o/dyld.h> + +static const int32_t webkitFirstVersionWithConcurrentGlobalContexts = 0x2100500; // 528.5.0 +#endif + using namespace JSC; // From the API's perspective, a context group remains alive iff @@ -67,6 +73,16 @@ void JSContextGroupRelease(JSContextGroupRef group) JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass) { initializeThreading(); + +#if OS(DARWIN) + // If the application was linked before JSGlobalContextCreate was changed to use a unique JSGlobalData, + // we use a shared one for backwards compatibility. + if (NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitFirstVersionWithConcurrentGlobalContexts) { + JSLock lock(LockForReal); + return JSGlobalContextCreateInGroup(toRef(&JSGlobalData::sharedInstance()), globalObjectClass); + } +#endif // OS(DARWIN) + return JSGlobalContextCreateInGroup(0, globalObjectClass); } diff --git a/Source/JavaScriptCore/API/JSObjectRef.cpp b/Source/JavaScriptCore/API/JSObjectRef.cpp index e01214d5e..91aa3c6bd 100644 --- a/Source/JavaScriptCore/API/JSObjectRef.cpp +++ b/Source/JavaScriptCore/API/JSObjectRef.cpp @@ -92,10 +92,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, { ExecState* exec = toJS(ctx); APIEntryShim entryShim(exec); - - Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); - - return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, nameID)); + return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, name ? name->ustring() : "anonymous")); } JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) diff --git a/Source/JavaScriptCore/API/JSValueRef.h b/Source/JavaScriptCore/API/JSValueRef.h index 4186db822..125e4028a 100644 --- a/Source/JavaScriptCore/API/JSValueRef.h +++ b/Source/JavaScriptCore/API/JSValueRef.h @@ -63,7 +63,7 @@ extern "C" { @param value The JSValue whose type you want to obtain. @result A value of type JSType that identifies value's type. */ -JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value); +JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef); /*! @function |