summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime/ObjectConstructor.cpp
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-06-03 14:33:32 +0100
committerLeon Clarke <leonclarke@google.com>2010-06-08 12:24:51 +0100
commit5af96e2c7b73ebc627c6894727826a7576d31758 (patch)
treef9d5e6f6175ccd7e3d14de9b290f08937a0d17ba /JavaScriptCore/runtime/ObjectConstructor.cpp
parent8cc4fcf4f6adcbc0e0aebfc24fbad9a4cddf2cfb (diff)
downloadexternal_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.zip
external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.gz
external_webkit-5af96e2c7b73ebc627c6894727826a7576d31758.tar.bz2
Merge webkit.org at r60469 : Initial merge by git.
Change-Id: I66a0047aa2af802f66bb0c7f2a8b02247a596234
Diffstat (limited to 'JavaScriptCore/runtime/ObjectConstructor.cpp')
-rw-r--r--JavaScriptCore/runtime/ObjectConstructor.cpp73
1 files changed, 37 insertions, 36 deletions
diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp
index fe98df3..c373f87 100644
--- a/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ b/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -34,13 +34,13 @@ namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(ObjectConstructor);
-static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*, JSObject*, JSValue, const ArgList&);
-static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*, JSObject*, JSValue, const ArgList&);
+static JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState*);
+static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState*);
+static JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState*);
+static JSValue JSC_HOST_CALL objectConstructorKeys(ExecState*);
+static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*);
+static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*);
+static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*);
ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure)
: InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object"))
@@ -80,8 +80,9 @@ ConstructType ObjectConstructor::getConstructData(ConstructData& constructData)
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+static JSValue JSC_HOST_CALL callObjectConstructor(ExecState* exec)
{
+ ArgList args(exec);
return constructObject(exec, args);
}
@@ -91,21 +92,21 @@ CallType ObjectConstructor::getCallData(CallData& callData)
return CallTypeHost;
}
-JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+JSValue JSC_HOST_CALL objectConstructorGetPrototypeOf(ExecState* exec)
{
- if (!args.at(0).isObject())
+ if (!exec->argument(0).isObject())
return throwError(exec, TypeError, "Requested prototype of a value that is not an object.");
- return asObject(args.at(0))->prototype();
+ return asObject(exec->argument(0))->prototype();
}
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec)
{
- if (!args.at(0).isObject())
+ if (!exec->argument(0).isObject())
return throwError(exec, TypeError, "Requested property descriptor of a value that is not an object.");
- UString propertyName = args.at(1).toString(exec);
+ UString propertyName = exec->argument(1).toString(exec);
if (exec->hadException())
return jsNull();
- JSObject* object = asObject(args.at(0));
+ JSObject* object = asObject(exec->argument(0));
PropertyDescriptor descriptor;
if (!object->getOwnPropertyDescriptor(exec, Identifier(exec, propertyName), descriptor))
return jsUndefined();
@@ -128,12 +129,12 @@ JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyDescriptor(ExecState* exec,
}
// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec)
{
- if (!args.at(0).isObject())
+ if (!exec->argument(0).isObject())
return throwError(exec, TypeError, "Requested property names of a value that is not an object.");
PropertyNameArray properties(exec);
- asObject(args.at(0))->getOwnPropertyNames(exec, properties, IncludeDontEnumProperties);
+ asObject(exec->argument(0))->getOwnPropertyNames(exec, properties, IncludeDontEnumProperties);
JSArray* names = constructEmptyArray(exec);
size_t numProperties = properties.size();
for (size_t i = 0; i < numProperties; i++)
@@ -142,12 +143,12 @@ JSValue JSC_HOST_CALL objectConstructorGetOwnPropertyNames(ExecState* exec, JSOb
}
// FIXME: Use the enumeration cache.
-JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+JSValue JSC_HOST_CALL objectConstructorKeys(ExecState* exec)
{
- if (!args.at(0).isObject())
+ if (!exec->argument(0).isObject())
return throwError(exec, TypeError, "Requested keys of a value that is not an object.");
PropertyNameArray properties(exec);
- asObject(args.at(0))->getOwnPropertyNames(exec, properties);
+ asObject(exec->argument(0))->getOwnPropertyNames(exec, properties);
JSArray* keys = constructEmptyArray(exec);
size_t numProperties = properties.size();
for (size_t i = 0; i < numProperties; i++)
@@ -241,16 +242,16 @@ static bool toPropertyDescriptor(ExecState* exec, JSValue in, PropertyDescriptor
return true;
}
-JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState* exec)
{
- if (!args.at(0).isObject())
+ if (!exec->argument(0).isObject())
return throwError(exec, TypeError, "Properties can only be defined on Objects.");
- JSObject* O = asObject(args.at(0));
- UString propertyName = args.at(1).toString(exec);
+ JSObject* O = asObject(exec->argument(0));
+ UString propertyName = exec->argument(1).toString(exec);
if (exec->hadException())
return jsNull();
PropertyDescriptor descriptor;
- if (!toPropertyDescriptor(exec, args.at(2), descriptor))
+ if (!toPropertyDescriptor(exec, exec->argument(2), descriptor))
return jsNull();
ASSERT((descriptor.attributes() & (Getter | Setter)) || (!descriptor.isAccessorDescriptor()));
ASSERT(!exec->hadException());
@@ -292,26 +293,26 @@ static JSValue defineProperties(ExecState* exec, JSObject* object, JSObject* pro
return object;
}
-JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec)
{
- if (!args.at(0).isObject())
+ if (!exec->argument(0).isObject())
return throwError(exec, TypeError, "Properties can only be defined on Objects.");
- if (!args.at(1).isObject())
+ if (!exec->argument(1).isObject())
return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, asObject(args.at(0)), asObject(args.at(1)));
+ return defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1)));
}
-JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec, JSObject*, JSValue, const ArgList& args)
+JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec)
{
- if (!args.at(0).isObject() && !args.at(0).isNull())
+ if (!exec->argument(0).isObject() && !exec->argument(0).isNull())
return throwError(exec, TypeError, "Object prototype may only be an Object or null.");
JSObject* newObject = constructEmptyObject(exec);
- newObject->setPrototype(args.at(0));
- if (args.at(1).isUndefined())
+ newObject->setPrototype(exec->argument(0));
+ if (exec->argument(1).isUndefined())
return newObject;
- if (!args.at(1).isObject())
+ if (!exec->argument(1).isObject())
return throwError(exec, TypeError, "Property descriptor list must be an Object.");
- return defineProperties(exec, newObject, asObject(args.at(1)));
+ return defineProperties(exec, newObject, asObject(exec->argument(1)));
}
} // namespace JSC