Reviewers: William Hesse, Description: Experimental: eagerly allocate space in the actual frame for spilling locals. It's more compact for multiple locals, and we will always need to allocate this space anyway.
Please review this at http://codereview.chromium.org/11470 SVN Base: http://v8.googlecode.com/svn/branches/experimental/toiger/ Affected files: M src/codegen-ia32.cc M src/virtual-frame-ia32.h M src/virtual-frame-ia32.cc Index: src/virtual-frame-ia32.cc =================================================================== --- src/virtual-frame-ia32.cc (revision 788) +++ src/virtual-frame-ia32.cc (working copy) @@ -206,8 +206,19 @@ void VirtualFrame::AllocateStackSlots(int count) { ASSERT(height() == 0); local_count_ = count; - for (int i = 0; i < count; i++) { - elements_.Add(FrameElement(Factory::undefined_value())); + + if (count > 0) { + Comment cmnt(masm_, "[ Allocate space for locals"); + // The locals are constants (the undefined value), but we sync them with + // the actual frame to allocate space for spilling them. + FrameElement initial_value(Factory::undefined_value()); + initial_value.clear_dirty(); + __ Set(eax, Immediate(Factory::undefined_value())); + for (int i = 0; i < count; i++) { + elements_.Add(initial_value); + stack_pointer_++; + __ push(eax); + } } } Index: src/virtual-frame-ia32.h =================================================================== --- src/virtual-frame-ia32.h (revision 789) +++ src/virtual-frame-ia32.h (working copy) @@ -137,9 +137,8 @@ void Enter(); void Exit(); - // Allocate and initialize the frame-allocated locals. The number of - // locals is known from the frame's code generator's state (specifically - // its scope). As a side effect, code may be emitted. + // Allocate and initialize the frame-allocated locals. The eax register + // us clobbered. void AllocateStackSlots(int count); // The current top of the expression stack as an assembly operand. Index: src/codegen-ia32.cc =================================================================== --- src/codegen-ia32.cc (revision 788) +++ src/codegen-ia32.cc (working copy) @@ -1228,7 +1228,7 @@ // Call the function just below TOS on the stack with the given // arguments. The receiver is the TOS. void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, - int position) { + int position) { // Push the arguments ("left-to-right") on the stack. int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
