summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/API
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/JavaScriptCore/API
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/JavaScriptCore/API')
-rw-r--r--Source/JavaScriptCore/API/APIShims.h2
-rw-r--r--Source/JavaScriptCore/API/JSBase.h5
-rw-r--r--Source/JavaScriptCore/API/JSCallbackConstructor.h4
-rw-r--r--Source/JavaScriptCore/API/JSCallbackFunction.h4
-rw-r--r--Source/JavaScriptCore/API/JSCallbackObject.h4
-rw-r--r--Source/JavaScriptCore/API/JSClassRef.cpp10
-rw-r--r--Source/JavaScriptCore/API/JSClassRef.h2
-rw-r--r--Source/JavaScriptCore/API/JSContextRef.cpp4
-rw-r--r--Source/JavaScriptCore/API/JSObjectRef.cpp6
-rw-r--r--Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp11
-rw-r--r--Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h11
-rw-r--r--Source/JavaScriptCore/API/OpaqueJSString.h4
12 files changed, 30 insertions, 37 deletions
diff --git a/Source/JavaScriptCore/API/APIShims.h b/Source/JavaScriptCore/API/APIShims.h
index 26db2dc..2e13851 100644
--- a/Source/JavaScriptCore/API/APIShims.h
+++ b/Source/JavaScriptCore/API/APIShims.h
@@ -42,7 +42,7 @@ protected:
UNUSED_PARAM(registerThread);
#if ENABLE(JSC_MULTIPLE_THREADS)
if (registerThread)
- globalData->heap.machineStackMarker().registerThread();
+ globalData->heap.machineThreads().addCurrentThread();
#endif
m_globalData->heap.activityCallback()->synchronize();
m_globalData->timeoutChecker.start();
diff --git a/Source/JavaScriptCore/API/JSBase.h b/Source/JavaScriptCore/API/JSBase.h
index d962b01..fed54fe 100644
--- a/Source/JavaScriptCore/API/JSBase.h
+++ b/Source/JavaScriptCore/API/JSBase.h
@@ -80,6 +80,11 @@ typedef struct OpaqueJSValue* JSObjectRef;
#define JS_EXPORT
#endif /* defined(JS_NO_EXPORT) */
+/* JS tests uses WTF but has no config.h, so we need to set the export defines here. */
+#ifndef WTF_EXPORT_PRIVATE
+#define WTF_EXPORT_PRIVATE JS_EXPORT
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/Source/JavaScriptCore/API/JSCallbackConstructor.h b/Source/JavaScriptCore/API/JSCallbackConstructor.h
index cd307a6..001c416 100644
--- a/Source/JavaScriptCore/API/JSCallbackConstructor.h
+++ b/Source/JavaScriptCore/API/JSCallbackConstructor.h
@@ -39,9 +39,9 @@ public:
JSObjectCallAsConstructorCallback callback() const { return m_callback; }
static const ClassInfo s_info;
- static PassRefPtr<Structure> createStructure(JSValue proto)
+ static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
diff --git a/Source/JavaScriptCore/API/JSCallbackFunction.h b/Source/JavaScriptCore/API/JSCallbackFunction.h
index d8ae608..11fb95c 100644
--- a/Source/JavaScriptCore/API/JSCallbackFunction.h
+++ b/Source/JavaScriptCore/API/JSCallbackFunction.h
@@ -39,9 +39,9 @@ public:
// InternalFunction mish-mashes constructor and function behavior -- we should
// refactor the code so this override isn't necessary
- static PassRefPtr<Structure> createStructure(JSValue proto)
+ static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
private:
diff --git a/Source/JavaScriptCore/API/JSCallbackObject.h b/Source/JavaScriptCore/API/JSCallbackObject.h
index 732cc1d..a0adb44 100644
--- a/Source/JavaScriptCore/API/JSCallbackObject.h
+++ b/Source/JavaScriptCore/API/JSCallbackObject.h
@@ -128,9 +128,9 @@ public:
JSClassRef classRef() const { return m_callbackObjectData->jsClass; }
bool inherits(JSClassRef) const;
- static PassRefPtr<Structure> createStructure(JSValue proto)
+ static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue proto)
{
- return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount, &s_info);
+ return Structure::create(globalData, proto, TypeInfo(ObjectType, StructureFlags), Base::AnonymousSlotCount, &s_info);
}
JSValue getPrivateProperty(const Identifier& propertyName) const
diff --git a/Source/JavaScriptCore/API/JSClassRef.cpp b/Source/JavaScriptCore/API/JSClassRef.cpp
index d953dce..70668bd 100644
--- a/Source/JavaScriptCore/API/JSClassRef.cpp
+++ b/Source/JavaScriptCore/API/JSClassRef.cpp
@@ -84,8 +84,9 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass*
// Use a local variable here to sidestep an RVCT compiler bug.
StaticValueEntry* entry = new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes);
StringImpl* impl = valueName.impl();
- impl->ref();
- m_staticValues->add(impl, entry);
+ StaticValueEntry* existingEntry = m_staticValues->get(impl);
+ m_staticValues->set(impl, entry);
+ delete existingEntry;
}
++staticValue;
}
@@ -99,8 +100,9 @@ OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass*
// Use a local variable here to sidestep an RVCT compiler bug.
StaticFunctionEntry* entry = new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes);
StringImpl* impl = functionName.impl();
- impl->ref();
- m_staticFunctions->add(impl, entry);
+ StaticFunctionEntry* existingEntry = m_staticFunctions->get(impl);
+ m_staticFunctions->set(impl, entry);
+ delete existingEntry;
}
++staticFunction;
}
diff --git a/Source/JavaScriptCore/API/JSClassRef.h b/Source/JavaScriptCore/API/JSClassRef.h
index 0f4119a..239c5a4 100644
--- a/Source/JavaScriptCore/API/JSClassRef.h
+++ b/Source/JavaScriptCore/API/JSClassRef.h
@@ -85,7 +85,7 @@ public:
JSC::WeakGCPtr<JSC::JSObject> cachedPrototype;
};
-struct OpaqueJSClass : public ThreadSafeShared<OpaqueJSClass> {
+struct OpaqueJSClass : public ThreadSafeRefCounted<OpaqueJSClass> {
static PassRefPtr<OpaqueJSClass> create(const JSClassDefinition*);
static PassRefPtr<OpaqueJSClass> createNoAutomaticPrototype(const JSClassDefinition*);
~OpaqueJSClass();
diff --git a/Source/JavaScriptCore/API/JSContextRef.cpp b/Source/JavaScriptCore/API/JSContextRef.cpp
index ccab953..e5c778f 100644
--- a/Source/JavaScriptCore/API/JSContextRef.cpp
+++ b/Source/JavaScriptCore/API/JSContextRef.cpp
@@ -93,11 +93,11 @@ JSGlobalContextRef JSGlobalContextCreateInGroup(JSContextGroupRef group, JSClass
#endif
if (!globalObjectClass) {
- JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject;
+ JSGlobalObject* globalObject = new (globalData.get()) JSGlobalObject(*globalData);
return JSGlobalContextRetain(toGlobalRef(globalObject->globalExec()));
}
- JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(jsNull()));
+ JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull()));
ExecState* exec = globalObject->globalExec();
JSValue prototype = globalObjectClass->prototype(exec);
if (!prototype)
diff --git a/Source/JavaScriptCore/API/JSObjectRef.cpp b/Source/JavaScriptCore/API/JSObjectRef.cpp
index 36ca338..b7030e4 100644
--- a/Source/JavaScriptCore/API/JSObjectRef.cpp
+++ b/Source/JavaScriptCore/API/JSObjectRef.cpp
@@ -124,7 +124,7 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa
args.append(jsString(exec, parameterNames[i]->ustring()));
args.append(jsString(exec, body->ustring()));
- JSObject* result = constructFunction(exec, args, nameID, sourceURL->ustring(), startingLineNumber);
+ JSObject* result = constructFunction(exec, exec->lexicalGlobalObject(), args, nameID, sourceURL->ustring(), startingLineNumber);
if (exec->hadException()) {
if (exception)
*exception = toRef(exec, exec->exception());
@@ -168,7 +168,7 @@ JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSVal
for (size_t i = 0; i < argumentCount; ++i)
argList.append(toJS(exec, arguments[i]));
- JSObject* result = constructDate(exec, argList);
+ JSObject* result = constructDate(exec, exec->lexicalGlobalObject(), argList);
if (exec->hadException()) {
if (exception)
*exception = toRef(exec, exec->exception());
@@ -207,7 +207,7 @@ JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSV
for (size_t i = 0; i < argumentCount; ++i)
argList.append(toJS(exec, arguments[i]));
- JSObject* result = constructRegExp(exec, argList);
+ JSObject* result = constructRegExp(exec, exec->lexicalGlobalObject(), argList);
if (exec->hadException()) {
if (exception)
*exception = toRef(exec, exec->exception());
diff --git a/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
index bc5e383..54dfda6 100644
--- a/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
+++ b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.cpp
@@ -68,14 +68,11 @@ JSObjectRef JSWeakObjectMapGet(JSContextRef ctx, JSWeakObjectMapRef map, void* k
return toRef(static_cast<JSObject*>(map->map().get(key)));
}
-bool JSWeakObjectMapClear(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSObjectRef object)
+// We need to keep this function in the build to keep the nightlies running.
+JS_EXPORT bool JSWeakObjectMapClear(JSContextRef, JSWeakObjectMapRef, void*, JSObjectRef);
+bool JSWeakObjectMapClear(JSContextRef, JSWeakObjectMapRef, void*, JSObjectRef)
{
- ExecState* exec = toJS(ctx);
- APIEntryShim entryShim(exec);
- JSObject* obj = toJS(object);
- if (map->map().deprecatedRemove(key, obj))
- return true;
- return false;
+ return true;
}
#ifdef __cplusplus
diff --git a/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h
index bb3fe96..01e0611 100644
--- a/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h
+++ b/Source/JavaScriptCore/API/JSWeakObjectMapRefPrivate.h
@@ -76,17 +76,6 @@ JS_EXPORT void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void
*/
JS_EXPORT JSObjectRef JSWeakObjectMapGet(JSContextRef ctx, JSWeakObjectMapRef map, void* key);
-/*!
- @function
- @abstract Clears the association between a key and an object in a JSWeakObjectMapRef
- @param ctx The execution context to use.
- @param map The map to clear the key association from.
- @param key The key to use.
- @param object The old object value.
- @result Returns true if the key/object association was present in map, and has been removed.
- */
-JS_EXPORT bool JSWeakObjectMapClear(JSContextRef ctx, JSWeakObjectMapRef map, void* key, JSObjectRef object);
-
#ifdef __cplusplus
}
#endif
diff --git a/Source/JavaScriptCore/API/OpaqueJSString.h b/Source/JavaScriptCore/API/OpaqueJSString.h
index 473c815..69c0962 100644
--- a/Source/JavaScriptCore/API/OpaqueJSString.h
+++ b/Source/JavaScriptCore/API/OpaqueJSString.h
@@ -33,7 +33,7 @@ namespace JSC {
class JSGlobalData;
}
-struct OpaqueJSString : public ThreadSafeShared<OpaqueJSString> {
+struct OpaqueJSString : public ThreadSafeRefCounted<OpaqueJSString> {
static PassRefPtr<OpaqueJSString> create() // null
{
@@ -54,7 +54,7 @@ struct OpaqueJSString : public ThreadSafeShared<OpaqueJSString> {
JSC::Identifier identifier(JSC::JSGlobalData*) const;
private:
- friend class WTF::ThreadSafeShared<OpaqueJSString>;
+ friend class WTF::ThreadSafeRefCounted<OpaqueJSString>;
OpaqueJSString()
: m_characters(0)