exec->globalData().heap.registerThread();
JSLock lock(exec);
- JSValuePtr jsPrototype = jsClass
- ? jsClass->prototype(exec)
- : exec->lexicalGlobalObject()->objectPrototype();
-
+ JSValue jsPrototype = jsClass ? jsClass->prototype(exec) : 0;
+ if (!jsPrototype)
+ jsPrototype = exec->lexicalGlobalObject()->objectPrototype();
+
JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);
constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly);
return toRef(constructor);
Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous");
- ArgList args;
+ MarkedArgumentBuffer args;
for (unsigned i = 0; i < parameterCount; i++)
args.append(jsString(exec, parameterNames[i]->ustring()));
args.append(jsString(exec, body->ustring()));
JSObject* result = constructFunction(exec, args, nameID, sourceURL->ustring(), startingLineNumber);
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
result = 0;
}
JSObject* result;
if (argumentCount) {
- ArgList argList;
+ MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; ++i)
- argList.append(toJS(arguments[i]));
+ argList.append(toJS(exec, arguments[i]));
result = constructArray(exec, argList);
} else
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
result = 0;
}
exec->globalData().heap.registerThread();
JSLock lock(exec);
- ArgList argList;
+ MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; ++i)
- argList.append(toJS(arguments[i]));
+ argList.append(toJS(exec, arguments[i]));
JSObject* result = constructDate(exec, argList);
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
result = 0;
}
exec->globalData().heap.registerThread();
JSLock lock(exec);
- ArgList argList;
+ MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; ++i)
- argList.append(toJS(arguments[i]));
+ argList.append(toJS(exec, arguments[i]));
JSObject* result = constructError(exec, argList);
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
result = 0;
}
exec->globalData().heap.registerThread();
JSLock lock(exec);
- ArgList argList;
+ MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; ++i)
- argList.append(toJS(arguments[i]));
+ argList.append(toJS(exec, arguments[i]));
JSObject* result = constructRegExp(exec, argList);
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
result = 0;
}
return toRef(result);
}
-JSValueRef JSObjectGetPrototype(JSContextRef, JSObjectRef object)
+JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object)
{
+ ExecState* exec = toJS(ctx);
+ exec->globalData().heap.registerThread();
+ JSLock lock(exec);
+
JSObject* jsObject = toJS(object);
- return toRef(jsObject->prototype());
+ return toRef(exec, jsObject->prototype());
}
-void JSObjectSetPrototype(JSContextRef, JSObjectRef object, JSValueRef value)
+void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value)
{
+ ExecState* exec = toJS(ctx);
+ exec->globalData().heap.registerThread();
+ JSLock lock(exec);
+
JSObject* jsObject = toJS(object);
- JSValuePtr jsValue = toJS(value);
+ JSValue jsValue = toJS(exec, value);
jsObject->setPrototype(jsValue.isObject() ? jsValue : jsNull());
}
JSObject* jsObject = toJS(object);
- JSValuePtr jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData()));
+ JSValue jsValue = jsObject->get(exec, propertyName->identifier(&exec->globalData()));
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
}
- return toRef(jsValue);
+ return toRef(exec, jsValue);
}
void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSPropertyAttributes attributes, JSValueRef* exception)
JSObject* jsObject = toJS(object);
Identifier name(propertyName->identifier(&exec->globalData()));
- JSValuePtr jsValue = toJS(value);
+ JSValue jsValue = toJS(exec, value);
if (attributes && !jsObject->hasProperty(exec, name))
jsObject->putWithAttributes(exec, name, jsValue, attributes);
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
}
}
JSObject* jsObject = toJS(object);
- JSValuePtr jsValue = jsObject->get(exec, propertyIndex);
+ JSValue jsValue = jsObject->get(exec, propertyIndex);
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
}
- return toRef(jsValue);
+ return toRef(exec, jsValue);
}
JSLock lock(exec);
JSObject* jsObject = toJS(object);
- JSValuePtr jsValue = toJS(value);
+ JSValue jsValue = toJS(exec, value);
jsObject->put(exec, propertyIndex, jsValue);
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
}
}
bool result = jsObject->deleteProperty(exec, propertyName->identifier(&exec->globalData()));
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
}
return result;
if (!jsThisObject)
jsThisObject = exec->globalThisValue();
- ArgList argList;
+ MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; i++)
- argList.append(toJS(arguments[i]));
+ argList.append(toJS(exec, arguments[i]));
CallData callData;
CallType callType = jsObject->getCallData(callData);
if (callType == CallTypeNone)
return 0;
- JSValueRef result = toRef(call(exec, jsObject, callType, callData, jsThisObject, argList));
+ JSValueRef result = toRef(exec, call(exec, jsObject, callType, callData, jsThisObject, argList));
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
result = 0;
}
if (constructType == ConstructTypeNone)
return 0;
- ArgList argList;
+ MarkedArgumentBuffer argList;
for (size_t i = 0; i < argumentCount; i++)
- argList.append(toJS(arguments[i]));
+ argList.append(toJS(exec, arguments[i]));
JSObjectRef result = toRef(construct(exec, jsObject, constructType, constructData, argList));
if (exec->hadException()) {
if (exception)
- *exception = toRef(exec->exception());
+ *exception = toRef(exec, exec->exception());
exec->clearException();
result = 0;
}