Permalink
Browse files

MIPS: Force context allocation for variables in generator scopes.

Port r14152 (4e58a8e)

Original commit message:
* src/scopes.h (ForceContextAllocation, has_forced_context_allocation):
  New interface to force context allocation for an entire function's
  scope.

* src/scopes.cc: Unless a new scope is a function scope, if its outer
  scope has forced context allocation, it should also force context
  allocation.
  (MustAllocateInContext): Return true if the scope as a whole has
  forced context allocation.
  (CollectStackAndContextLocals): Allow temporaries to be
  context-allocated.

* src/parser.cc (ParseFunctionLiteral): Force context allocation for
  generator scopes.

* src/v8globals.h (VariableMode): Update comment on TEMPORARY.

* src/arm/full-codegen-arm.cc (Generate):
* src/ia32/full-codegen-ia32.cc (Generate):
* src/x64/full-codegen-x64.cc (Generate): Assert that generators have no
  stack slots.

    * test/mjsunit/harmony/generators-instantiation.js: New test.
  • Loading branch information...
1 parent e4e6186 commit 43512705df633d7dc52a7a5f208c700d5e8f233d Akos Palfi committed Apr 5, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/mips/full-codegen-mips.cc
@@ -170,8 +170,6 @@ void FullCodeGenerator::Generate() {
// the frame (that is done below).
FrameScope frame_scope(masm_, StackFrame::MANUAL);
- int locals_count = info->scope()->num_stack_slots();
-
info->set_prologue_offset(masm_->pc_offset());
// The following three instructions must remain together and unmodified for
// code aging to work properly.
@@ -183,6 +181,9 @@ void FullCodeGenerator::Generate() {
__ Addu(fp, sp, Operand(2 * kPointerSize));
{ Comment cmnt(masm_, "[ Allocate locals");
+ int locals_count = info->scope()->num_stack_slots();
+ // Generators allocate locals, if any, in context slots.
+ ASSERT(!info->function()->is_generator() || locals_count == 0);
for (int i = 0; i < locals_count; i++) {
__ push(at);
}

0 comments on commit 4351270

Please sign in to comment.