summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime/FunctionConstructor.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-06-15 19:36:43 +0100
committerBen Murdoch <benm@google.com>2010-06-16 14:52:28 +0100
commit545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch)
treec0c14763654d84d37577dde512c3d3b4699a9e86 /JavaScriptCore/runtime/FunctionConstructor.cpp
parent719298a66237d38ea5c05f1547123ad8aacbc237 (diff)
downloadexternal_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'JavaScriptCore/runtime/FunctionConstructor.cpp')
-rw-r--r--JavaScriptCore/runtime/FunctionConstructor.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index de9fff1..a5ff28c 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -22,6 +22,7 @@
#include "FunctionConstructor.h"
#include "Debugger.h"
+#include "ExceptionHelpers.h"
#include "FunctionPrototype.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
@@ -44,9 +45,10 @@ FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* global
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontDelete | DontEnum);
}
-static JSObject* constructWithFunctionConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec)
{
- return constructFunction(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructFunction(exec, args));
}
ConstructType FunctionConstructor::getConstructData(ConstructData& constructData)
@@ -55,10 +57,10 @@ ConstructType FunctionConstructor::getConstructData(ConstructData& constructData
return ConstructTypeHost;
}
-static JSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callFunctionConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructFunction(exec, args);
+ return JSValue::encode(constructFunction(exec, args));
}
// ECMA 15.3.1 The Function Constructor Called as a Function
@@ -95,13 +97,14 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
int errLine;
UString errMsg;
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ JSGlobalData* globalData = globalObject->globalData();
SourceCode source = makeSource(program, sourceURL, lineNumber);
RefPtr<FunctionExecutable> function = FunctionExecutable::fromGlobalCode(functionName, exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
if (!function)
- return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
+ return throwError(exec, addErrorInfo(globalData, createSyntaxError(globalObject, errMsg), errLine, source));
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
- ScopeChain scopeChain(globalObject, globalObject->globalData(), globalObject, exec->globalThisValue());
+ ScopeChain scopeChain(globalObject, globalData, globalObject, exec->globalThisValue());
return new (exec) JSFunction(exec, function, scopeChain.node());
}