Index: src/arm/virtual-frame-arm.cc |
=================================================================== |
--- src/arm/virtual-frame-arm.cc (revision 3519) |
+++ src/arm/virtual-frame-arm.cc (working copy) |
@@ -143,13 +143,26 @@ |
if (count > 0) { |
Comment cmnt(masm(), "[ Allocate space for locals"); |
Adjust(count); |
- // Initialize stack slots with 'undefined' value. |
+ // Initialize stack slots with 'undefined' value. |
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
+ __ LoadRoot(r2, Heap::kStackLimitRootIndex); |
+ if (count < kLocalVarBound) { |
+ // For less locals the unrolled loop is more compact. |
+ for (int i = 0; i < count; i++) { |
+ __ push(ip); |
+ } |
+ } else { |
+ // For more locals a loop in generated code is more compact. |
+ Label alloc_locals_loop; |
+ __ mov(r1, Operand(count)); |
+ __ bind(&alloc_locals_loop); |
+ __ push(ip); |
+ __ sub(r1, r1, Operand(1), SetCC); |
+ __ b(ne, &alloc_locals_loop); |
+ } |
+ } else { |
+ __ LoadRoot(r2, Heap::kStackLimitRootIndex); |
} |
- __ LoadRoot(r2, Heap::kStackLimitRootIndex); |
- for (int i = 0; i < count; i++) { |
- __ push(ip); |
- } |
// Check the stack for overflow or a 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 with pc |