| Index: src/x64/virtual-frame-x64.cc
|
| ===================================================================
|
| --- src/x64/virtual-frame-x64.cc (revision 3519)
|
| +++ src/x64/virtual-frame-x64.cc (working copy)
|
| @@ -129,11 +129,29 @@
|
| Handle<Object> undefined = Factory::undefined_value();
|
| FrameElement initial_value =
|
| FrameElement::ConstantElement(undefined, FrameElement::SYNCED);
|
| - __ movq(kScratchRegister, undefined, RelocInfo::EMBEDDED_OBJECT);
|
| + if (count == 1) {
|
| + __ Push(undefined);
|
| + } else if (count < kLocalVarBound) {
|
| + // For less locals the unrolled loop is more compact.
|
| + __ movq(kScratchRegister, undefined, RelocInfo::EMBEDDED_OBJECT);
|
| + for (int i = 0; i < count; i++) {
|
| + __ push(kScratchRegister);
|
| + }
|
| + } else {
|
| + // For more locals a loop in generated code is more compact.
|
| + Label alloc_locals_loop;
|
| + Result cnt = cgen()->allocator()->Allocate();
|
| + ASSERT(cnt.is_valid());
|
| + __ movq(cnt.reg(), Immediate(count));
|
| + __ movq(kScratchRegister, undefined, RelocInfo::EMBEDDED_OBJECT);
|
| + __ bind(&alloc_locals_loop);
|
| + __ push(kScratchRegister);
|
| + __ decl(cnt.reg());
|
| + __ j(not_zero, &alloc_locals_loop);
|
| + }
|
| for (int i = 0; i < count; i++) {
|
| elements_.Add(initial_value);
|
| stack_pointer_++;
|
| - __ push(kScratchRegister);
|
| }
|
| }
|
| }
|
|
|