Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index 6215ab09681f9becca17d073c7ac52406b9cf60c..765c1e6c996da0421d8068c4046d71c9b5db53ea 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -175,7 +175,7 @@ function GlobalEval(x) { |
var global_proxy = %GlobalProxy(global); |
- var f = %CompileString(x, false); |
+ var f = %CompileString(x, false, 0); |
if (!IS_FUNCTION(f)) return f; |
return %_CallFunction(global_proxy, f); |
@@ -1829,7 +1829,7 @@ function FunctionBind(this_arg) { // Length is 1. |
} |
-function NewFunctionString(arguments, function_token) { |
+function NewFunctionFromString(arguments, function_token) { |
var n = arguments.length; |
var p = ''; |
if (n > 1) { |
@@ -1846,21 +1846,20 @@ function NewFunctionString(arguments, function_token) { |
// If the formal parameters include an unbalanced block comment, the |
// function must be rejected. Since JavaScript does not allow nested |
// comments we can include a trailing block comment to catch this. |
- p += '\n/' + '**/'; |
+ p += '\n\x2f**\x2f'; |
} |
var body = (n > 0) ? ToString(arguments[n - 1]) : ''; |
- return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; |
+ var head = '(' + function_token + '(' + p + ') {\n'; |
+ var src = head + body + '\n})'; |
+ var global_proxy = %GlobalProxy(global); |
+ var f = %_CallFunction(global_proxy, %CompileString(src, true, head.length)); |
+ %FunctionMarkNameShouldPrintAsAnonymous(f); |
+ return f; |
} |
function FunctionConstructor(arg1) { // length == 1 |
- var source = NewFunctionString(arguments, 'function'); |
- var global_proxy = %GlobalProxy(global); |
- // Compile the string in the constructor and not a helper so that errors |
- // appear to come from here. |
- var f = %_CallFunction(global_proxy, %CompileString(source, true)); |
- %FunctionMarkNameShouldPrintAsAnonymous(f); |
- return f; |
+ return NewFunctionFromString(arguments, 'function'); |
} |