Revision: 15230
Author:   [email protected]
Date:     Thu Jun 20 03:48:34 2013
Log: Fix stack frame reconstruction for generators with formal arguments

The formal parameter count was always being treated as an untagged
integer, but it is actually a Smi on ia32 and arm.

[email protected]
BUG=v8:2355
TEST=mjsunit/harmony/generators-iteration

Review URL: https://codereview.chromium.org/17485002
http://code.google.com/p/v8/source/detail?r=15230

Modified:
 /branches/bleeding_edge/src/arm/full-codegen-arm.cc
 /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
 /branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js

=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Fri Jun 14 04:35:00 2013 +++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Thu Jun 20 03:48:34 2013
@@ -2132,7 +2132,7 @@
   __ LoadRoot(r2, Heap::kTheHoleValueRootIndex);
   Label push_argument_holes, push_frame;
   __ bind(&push_argument_holes);
-  __ sub(r3, r3, Operand(1), SetCC);
+  __ sub(r3, r3, Operand(Smi::FromInt(1)), SetCC);
   __ b(mi, &push_frame);
   __ push(r2);
   __ jmp(&push_argument_holes);
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Fri Jun 14 04:35:00 2013 +++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Thu Jun 20 03:48:34 2013
@@ -2091,7 +2091,7 @@
   __ mov(ecx, isolate()->factory()->the_hole_value());
   Label push_argument_holes, push_frame;
   __ bind(&push_argument_holes);
-  __ sub(edx, Immediate(1));
+  __ sub(edx, Immediate(Smi::FromInt(1)));
   __ j(carry, &push_frame);
   __ push(ecx);
   __ jmp(&push_argument_holes);
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js Thu Jun 13 03:57:11 2013 +++ /branches/bleeding_edge/test/mjsunit/harmony/generators-iteration.js Thu Jun 20 03:48:34 2013
@@ -346,6 +346,15 @@
     "foo",
     [3, undefined]);

+// Access to this with formal arguments.
+TestGenerator(
+    function () {
+      return ({ x: 42, g: function* (a) { yield this.x } }).g(0);
+    },
+    [42, undefined],
+    "foo",
+    [42, undefined]);
+
 // Test that yield* re-yields received results without re-boxing.
 function TestDelegatingYield() {
   function results(results) {

--
--
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.


Reply via email to