summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-02-11 10:55:52 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-03-10 09:19:43 (GMT)
commitd73e11d56a094544f036fac3f6e4483d1104261e (patch)
treec292c8f53c660dae3f7681dc7acbbe788730a580 /src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp
parent20e2b87b5194abf7e9f08b7c42c030a57e2d6b28 (diff)
downloadQt-d73e11d56a094544f036fac3f6e4483d1104261e.zip
Qt-d73e11d56a094544f036fac3f6e4483d1104261e.tar.gz
Qt-d73e11d56a094544f036fac3f6e4483d1104261e.tar.bz2
Update src/3rdparty/javascriptcore and adapt src/script to the changes
- Update qscriptvalueiterator test to expect length property when iterating arrays and strings. - Use EvalExecutable::create() instead of EvalExecutable constructor. The constructor is private. - Reimplement getOwnPropertyDescriptor() in all custom script objects. - Remove all reimplementations of getPropertyAttributes(). It doesn't exist in trunk anymore (getOwnPropertyDescriptor() is used instead). - Remove checkDontDelete argument from deleteProperty() reimplementations. The purpose of this argument was to support deleting properties with attribute Undeletable from C++. But it was quite an invasive patch to JavaScriptCore, and it doesn't seem worth it. If this feature is really crucial it should be re-done upstream. One of the tests needed to be updated so it's not sensitive to the C++ undeletability. - Adapt getOwnPropertyNames() reimplementations to signature change. - Add missing QScriptObject structure flags, otherwise we don't get all virtual calls. - Remove our patch for reporting column numbers in the debugger callbacks. It was just too intrusive. As with the checkDontDelete issue, this should be redone upstream if it's really important. In 4.7, QScriptEngineAgent will always report a column number of 1. Other compilation fixes: - InternalFunction::name() takes an ExecState* argument, not GlobalData* - ScopeChain::globalObject is no longer a function but a member variable - ScopeChainNode constructor takes a GlobalObject argument - Heap::collect() is called collectAllGarbage() - JSValue::strictEqual() takes an ExecState* argument - Debugger::exception() takes a bool hasHandler argument - Debugger no longer reports column number (we decided to drop that patch from JSC) - UString doesn't have operator+=(char*) - Update the autotests to reflect the columnNumber=1 change. - Add helper class to avoid crashing inside JSC. Ever since r52856 in WebKit trunk, this is needed. There are probably a lot of other public API functions that need this guard as well, but I'll add them as they are discovered. - Update mkdist-javascriptcore tag, exclude a few more files. - Set ENABLE_JSC_MULTIPLE_THREADS=0 define on Mac due to r52355 in trunk. Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp')
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp64
1 files changed, 21 insertions, 43 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp
index 06ef578..faaa4eb 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.cpp
@@ -76,8 +76,7 @@ void JSClassRelease(JSClassRef jsClass)
JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
if (!jsClass)
return toRef(new (exec) JSObject(exec->lexicalGlobalObject()->emptyObjectStructure())); // slightly more efficient
@@ -92,8 +91,7 @@ JSObjectRef JSObjectMake(JSContextRef ctx, JSClassRef jsClass, void* data)
JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, JSObjectCallAsFunctionCallback callAsFunction)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous");
@@ -103,8 +101,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name,
JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSValue jsPrototype = jsClass ? jsClass->prototype(exec) : 0;
if (!jsPrototype)
@@ -118,8 +115,7 @@ JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObje
JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned parameterCount, const JSStringRef parameterNames[], JSStringRef body, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous");
@@ -141,8 +137,7 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa
JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* result;
if (argumentCount) {
@@ -167,8 +162,7 @@ JSObjectRef JSObjectMakeArray(JSContextRef ctx, size_t argumentCount, const JSVa
JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; ++i)
@@ -188,8 +182,7 @@ JSObjectRef JSObjectMakeDate(JSContextRef ctx, size_t argumentCount, const JSVal
JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; ++i)
@@ -209,8 +202,7 @@ JSObjectRef JSObjectMakeError(JSContextRef ctx, size_t argumentCount, const JSVa
JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; ++i)
@@ -230,8 +222,7 @@ JSObjectRef JSObjectMakeRegExp(JSContextRef ctx, size_t argumentCount, const JSV
JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
return toRef(exec, jsObject->prototype());
@@ -240,8 +231,7 @@ JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object)
void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
JSValue jsValue = toJS(exec, value);
@@ -252,8 +242,7 @@ void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value
bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
@@ -263,8 +252,7 @@ bool JSObjectHasProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope
JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
@@ -280,8 +268,7 @@ JSValueRef JSObjectGetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef
void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
Identifier name(propertyName->identifier(&exec->globalData()));
@@ -304,8 +291,7 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope
JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
@@ -322,8 +308,7 @@ JSValueRef JSObjectGetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsi
void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
JSValue jsValue = toJS(exec, value);
@@ -339,8 +324,7 @@ void JSObjectSetPropertyAtIndex(JSContextRef ctx, JSObjectRef object, unsigned p
bool JSObjectDeleteProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
@@ -389,8 +373,7 @@ bool JSObjectIsFunction(JSContextRef, JSObjectRef object)
JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
JSObject* jsThisObject = toJS(thisObject);
@@ -427,8 +410,7 @@ bool JSObjectIsConstructor(JSContextRef, JSObjectRef object)
JSObjectRef JSObjectCallAsConstructor(JSContextRef ctx, JSObjectRef object, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSObject* jsObject = toJS(object);
@@ -466,8 +448,7 @@ JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef ctx, JSObjectRef o
{
JSObject* jsObject = toJS(object);
ExecState* exec = toJS(ctx);
- exec->globalData().heap.registerThread();
- JSLock lock(exec);
+ APIEntryShim entryShim(exec);
JSGlobalData* globalData = &exec->globalData();
@@ -492,7 +473,7 @@ JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array)
void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array)
{
if (--array->refCount == 0) {
- JSLock lock(array->globalData->isSharedInstance ? LockForReal : SilenceAssertionsOnly);
+ APIEntryShim entryShim(array->globalData, false);
delete array;
}
}
@@ -510,9 +491,6 @@ JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size
void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName)
{
PropertyNameArray* propertyNames = toJS(array);
-
- propertyNames->globalData()->heap.registerThread();
- JSLock lock(propertyNames->globalData()->isSharedInstance ? LockForReal : SilenceAssertionsOnly);
-
+ APIEntryShim entryShim(propertyNames->globalData());
propertyNames->add(propertyName->identifier(propertyNames->globalData()));
}