Index: src/arm/codegen-arm.cc |
=================================================================== |
--- src/arm/codegen-arm.cc (revision 5256) |
+++ src/arm/codegen-arm.cc (working copy) |
@@ -217,93 +217,80 @@ |
} |
#endif |
- if (info->mode() == CompilationInfo::PRIMARY) { |
- frame_->Enter(); |
- // tos: code slot |
+ frame_->Enter(); |
+ // tos: code slot |
- // Allocate space for locals and initialize them. This also checks |
- // for stack overflow. |
- frame_->AllocateStackSlots(); |
+ // Allocate space for locals and initialize them. This also checks |
+ // for stack overflow. |
+ frame_->AllocateStackSlots(); |
- frame_->AssertIsSpilled(); |
- int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
- if (heap_slots > 0) { |
- // Allocate local context. |
- // Get outer context and create a new context based on it. |
- __ ldr(r0, frame_->Function()); |
- frame_->EmitPush(r0); |
- if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
- FastNewContextStub stub(heap_slots); |
- frame_->CallStub(&stub, 1); |
- } else { |
- frame_->CallRuntime(Runtime::kNewContext, 1); |
- } |
+ frame_->AssertIsSpilled(); |
+ int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
+ if (heap_slots > 0) { |
+ // Allocate local context. |
+ // Get outer context and create a new context based on it. |
+ __ ldr(r0, frame_->Function()); |
+ frame_->EmitPush(r0); |
+ if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
+ FastNewContextStub stub(heap_slots); |
+ frame_->CallStub(&stub, 1); |
+ } else { |
+ frame_->CallRuntime(Runtime::kNewContext, 1); |
+ } |
#ifdef DEBUG |
- JumpTarget verified_true; |
- __ cmp(r0, cp); |
- verified_true.Branch(eq); |
- __ stop("NewContext: r0 is expected to be the same as cp"); |
- verified_true.Bind(); |
+ JumpTarget verified_true; |
+ __ cmp(r0, cp); |
+ verified_true.Branch(eq); |
+ __ stop("NewContext: r0 is expected to be the same as cp"); |
+ verified_true.Bind(); |
#endif |
- // Update context local. |
- __ str(cp, frame_->Context()); |
- } |
+ // Update context local. |
+ __ str(cp, frame_->Context()); |
+ } |
- // TODO(1241774): Improve this code: |
- // 1) only needed if we have a context |
- // 2) no need to recompute context ptr every single time |
- // 3) don't copy parameter operand code from SlotOperand! |
- { |
- Comment cmnt2(masm_, "[ copy context parameters into .context"); |
- // Note that iteration order is relevant here! If we have the same |
- // parameter twice (e.g., function (x, y, x)), and that parameter |
- // needs to be copied into the context, it must be the last argument |
- // passed to the parameter that needs to be copied. This is a rare |
- // case so we don't check for it, instead we rely on the copying |
- // order: such a parameter is copied repeatedly into the same |
- // context location and thus the last value is what is seen inside |
- // the function. |
- frame_->AssertIsSpilled(); |
- for (int i = 0; i < scope()->num_parameters(); i++) { |
- Variable* par = scope()->parameter(i); |
- Slot* slot = par->slot(); |
- if (slot != NULL && slot->type() == Slot::CONTEXT) { |
- ASSERT(!scope()->is_global_scope()); // No params in global scope. |
- __ ldr(r1, frame_->ParameterAt(i)); |
- // Loads r2 with context; used below in RecordWrite. |
- __ str(r1, SlotOperand(slot, r2)); |
- // Load the offset into r3. |
- int slot_offset = |
- FixedArray::kHeaderSize + slot->index() * kPointerSize; |
- __ RecordWrite(r2, Operand(slot_offset), r3, r1); |
- } |
+ // TODO(1241774): Improve this code: |
+ // 1) only needed if we have a context |
+ // 2) no need to recompute context ptr every single time |
+ // 3) don't copy parameter operand code from SlotOperand! |
+ { |
+ Comment cmnt2(masm_, "[ copy context parameters into .context"); |
+ // Note that iteration order is relevant here! If we have the same |
+ // parameter twice (e.g., function (x, y, x)), and that parameter |
+ // needs to be copied into the context, it must be the last argument |
+ // passed to the parameter that needs to be copied. This is a rare |
+ // case so we don't check for it, instead we rely on the copying |
+ // order: such a parameter is copied repeatedly into the same |
+ // context location and thus the last value is what is seen inside |
+ // the function. |
+ frame_->AssertIsSpilled(); |
+ for (int i = 0; i < scope()->num_parameters(); i++) { |
+ Variable* par = scope()->parameter(i); |
+ Slot* slot = par->slot(); |
+ if (slot != NULL && slot->type() == Slot::CONTEXT) { |
+ ASSERT(!scope()->is_global_scope()); // No params in global scope. |
+ __ ldr(r1, frame_->ParameterAt(i)); |
+ // Loads r2 with context; used below in RecordWrite. |
+ __ str(r1, SlotOperand(slot, r2)); |
+ // Load the offset into r3. |
+ int slot_offset = |
+ FixedArray::kHeaderSize + slot->index() * kPointerSize; |
+ __ RecordWrite(r2, Operand(slot_offset), r3, r1); |
} |
} |
+ } |
- // Store the arguments object. This must happen after context |
- // initialization because the arguments object may be stored in |
- // the context. |
- if (ArgumentsMode() != NO_ARGUMENTS_ALLOCATION) { |
- StoreArgumentsObject(true); |
- } |
+ // Store the arguments object. This must happen after context |
+ // initialization because the arguments object may be stored in |
+ // the context. |
+ if (ArgumentsMode() != NO_ARGUMENTS_ALLOCATION) { |
+ StoreArgumentsObject(true); |
+ } |
- // Initialize ThisFunction reference if present. |
- if (scope()->is_function_scope() && scope()->function() != NULL) { |
- frame_->EmitPushRoot(Heap::kTheHoleValueRootIndex); |
- StoreToSlot(scope()->function()->slot(), NOT_CONST_INIT); |
- } |
- } else { |
- // When used as the secondary compiler for splitting, r1, cp, |
- // fp, and lr have been pushed on the stack. Adjust the virtual |
- // frame to match this state. |
- frame_->Adjust(4); |
- |
- // Bind all the bailout labels to the beginning of the function. |
- List<CompilationInfo::Bailout*>* bailouts = info->bailouts(); |
- for (int i = 0; i < bailouts->length(); i++) { |
- __ bind(bailouts->at(i)->label()); |
- } |
+ // Initialize ThisFunction reference if present. |
+ if (scope()->is_function_scope() && scope()->function() != NULL) { |
+ frame_->EmitPushRoot(Heap::kTheHoleValueRootIndex); |
+ StoreToSlot(scope()->function()->slot(), NOT_CONST_INIT); |
} |
// Initialize the function return target after the locals are set |