Index: src/arm/fast-codegen-arm.cc |
=================================================================== |
--- src/arm/fast-codegen-arm.cc (revision 3220) |
+++ src/arm/fast-codegen-arm.cc (working copy) |
@@ -71,6 +71,24 @@ |
} |
} |
+ // Possibly allocate a local context. |
+ if (fun->scope()->num_heap_slots() > 0) { |
+ Comment cmnt(masm_, "[ Allocate local context"); |
+ // Argument to NewContext is the function, still in r1. |
+ __ push(r1); |
+ __ CallRuntime(Runtime::kNewContext, 1); |
+ // Context is returned in both r0 and cp. It replaces the context |
+ // passed to us. It's saved in the stack and kept live in cp. |
+ __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
+#ifdef DEBUG |
+ // Assert we do not have to copy any parameters into the context. |
+ for (int i = 0, len = fun->scope()->num_parameters(); i < len; i++) { |
+ Slot* slot = fun->scope()->parameter(i)->slot(); |
+ ASSERT(slot != NULL && slot->type() != Slot::CONTEXT); |
+ } |
+#endif |
+ } |
+ |
// Check the stack for overflow or break request. |
// Put the lr setup instruction in the delay slot. The kInstrSize is |
// added to the implicit 8 byte offset that always applies to operations |