Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Unified Diff: src/v8natives.js

Issue 1053563002: Revert of Correctly compute line numbers in functions from the function constructor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added regression test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | test/message/single-function-literal.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 7a7915aa592b4a1e831b696c38b24e29197cc52f..2c3bf9767c8962d5d747cb696a3eb67f41abfd47 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -176,7 +176,7 @@ function GlobalEval(x) {
var global_proxy = %GlobalProxy(global);
- var f = %CompileString(x, false, 0);
+ var f = %CompileString(x, false);
if (!IS_FUNCTION(f)) return f;
return %_CallFunction(global_proxy, f);
@@ -1832,7 +1832,7 @@ function FunctionBind(this_arg) { // Length is 1.
}
-function NewFunctionFromString(arguments, function_token) {
+function NewFunctionString(arguments, function_token) {
var n = arguments.length;
var p = '';
if (n > 1) {
@@ -1849,20 +1849,21 @@ function NewFunctionFromString(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\x2f**\x2f';
+ p += '\n/' + '**/';
}
var body = (n > 0) ? ToString(arguments[n - 1]) : '';
- 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;
+ return '(' + function_token + '(' + p + ') {\n' + body + '\n})';
}
function FunctionConstructor(arg1) { // length == 1
- return NewFunctionFromString(arguments, 'function');
+ 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;
}
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | test/message/single-function-literal.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698