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

Unified Diff: src/v8natives.js

Issue 14619040: Revert "GeneratorFunction() makes generator instances" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/generator.js ('k') | test/mjsunit/harmony/generators-iteration.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 61f2d85b4649fdef8476fcf4060b69f4f8c0df48..b2ea749c73030e82d4e7323ce9637f721dc593e7 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1757,27 +1757,26 @@ function FunctionBind(this_arg) { // Length is 1.
}
-function NewFunction(arguments, function_token) {
- var n = arguments.length;
+function NewFunction(arg1) { // length == 1
+ var n = %_ArgumentsLength();
var p = '';
if (n > 1) {
- p = ToString(arguments[0]);
- for (var i = 1; i < n - 1; i++) {
- p += ',' + ToString(arguments[i]);
- }
+ p = new InternalArray(n - 1);
+ for (var i = 0; i < n - 1; i++) p[i] = %_Arguments(i);
+ p = Join(p, n - 1, ',', NonStringToString);
// If the formal parameters string include ) - an illegal
// character - it may make the combined function expression
// compile. We avoid this problem by checking for this early on.
if (%_CallFunction(p, ')', StringIndexOf) != -1) {
- throw MakeSyntaxError('paren_in_arg_string', []);
+ throw MakeSyntaxError('paren_in_arg_string',[]);
}
// 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/' + '**/';
}
- var body = (n > 0) ? ToString(arguments[n - 1]) : '';
- var source = '(' + function_token + '(' + p + ') {\n' + body + '\n})';
+ var body = (n > 0) ? ToString(%_Arguments(n - 1)) : '';
+ var source = '(function(' + p + ') {\n' + body + '\n})';
var global_receiver = %GlobalReceiver(global);
var f = %_CallFunction(global_receiver, %CompileString(source, true));
@@ -1787,17 +1786,12 @@ function NewFunction(arguments, function_token) {
}
-function FunctionConstructor(arg1) { // length == 1
- return NewFunction(arguments, 'function');
-}
-
-
// ----------------------------------------------------------------------------
function SetUpFunction() {
%CheckIsBootstrapping();
- %SetCode($Function, FunctionConstructor);
+ %SetCode($Function, NewFunction);
%SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
« no previous file with comments | « src/generator.js ('k') | test/mjsunit/harmony/generators-iteration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698