Revision: 14694
Author: [email protected]
Date: Wed May 15 08:57:58 2013
Log: Revert "GeneratorFunction() makes generator instances"
This reverts r14684 because of blink LayoutTest failures in
inspector/debugger/debugger-pause-in-internal.html.
[email protected]
BUG=
Review URL: https://codereview.chromium.org/14619040
http://code.google.com/p/v8/source/detail?r=14694
Modified:
/branches/bleeding_edge/src/generator.js
/branches/bleeding_edge/src/v8natives.js
/branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js
/branches/bleeding_edge/test/mjsunit/harmony/generators-runtime.js
=======================================
--- /branches/bleeding_edge/src/generator.js Wed May 15 06:22:05 2013
+++ /branches/bleeding_edge/src/generator.js Wed May 15 08:57:58 2013
@@ -65,17 +65,6 @@
return %_GeneratorThrow(this, exn);
}
-function GeneratorFunctionPrototypeConstructor(x) {
- if (%_IsConstructCall()) {
- throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']);
- }
-}
-
-function GeneratorFunctionConstructor(arg1) { // length == 1
- return NewFunction(arguments, 'function*');
-}
-
-
function SetUpGenerators() {
%CheckIsBootstrapping();
var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype;
@@ -87,11 +76,9 @@
%SetProperty(GeneratorObjectPrototype, "constructor",
GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE |
READ_ONLY);
%SetPrototype(GeneratorFunctionPrototype, $Function.prototype);
- %SetCode(GeneratorFunctionPrototype,
GeneratorFunctionPrototypeConstructor);
%SetProperty(GeneratorFunctionPrototype, "constructor",
GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY);
%SetPrototype(GeneratorFunction, $Function);
- %SetCode(GeneratorFunction, GeneratorFunctionConstructor);
}
SetUpGenerators();
=======================================
--- /branches/bleeding_edge/src/v8natives.js Wed May 15 06:22:05 2013
+++ /branches/bleeding_edge/src/v8natives.js Wed May 15 08:57:58 2013
@@ -1757,27 +1757,26 @@
}
-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));
@@ -1785,11 +1784,6 @@
%FunctionMarkNameShouldPrintAsAnonymous(f);
return f;
}
-
-
-function FunctionConstructor(arg1) { // length == 1
- return NewFunction(arguments, 'function');
-}
//
----------------------------------------------------------------------------
@@ -1797,7 +1791,7 @@
function SetUpFunction() {
%CheckIsBootstrapping();
- %SetCode($Function, FunctionConstructor);
+ %SetCode($Function, NewFunction);
%SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
InstallFunctions($Function.prototype, DONT_ENUM, $Array(
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js
Wed May 15 06:22:05 2013
+++ /branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js
Wed May 15 08:57:58 2013
@@ -324,28 +324,6 @@
"foo",
[2, "1foo3", 5, "4foo6", "foofoo"]);
-// Generator function instances.
-TestGenerator(GeneratorFunction(),
- [undefined],
- "foo",
- [undefined]);
-
-TestGenerator(new GeneratorFunction(),
- [undefined],
- "foo",
- [undefined]);
-
-TestGenerator(GeneratorFunction('yield 1;'),
- [1, undefined],
- "foo",
- [1, undefined]);
-
-TestGenerator(
- function() { return GeneratorFunction('x', 'y', 'yield x + y;')(1, 2)
},
- [3, undefined],
- "foo",
- [3, undefined]);
-
function TestTryCatch(instantiate) {
function* g() { yield 1; try { yield 2; } catch (e) { yield e; } yield
3; }
function Sentinel() {}
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/generators-runtime.js Wed
May 15 06:22:05 2013
+++ /branches/bleeding_edge/test/mjsunit/harmony/generators-runtime.js Wed
May 15 08:57:58 2013
@@ -110,9 +110,6 @@
// Not all functions are generators.
assertTrue(f instanceof Function); // Sanity check.
assertTrue(!(f instanceof GeneratorFunction));
-
- assertTrue((new GeneratorFunction()) instanceof GeneratorFunction);
- assertTrue(GeneratorFunction() instanceof GeneratorFunction);
}
TestGeneratorFunction();
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.