| Index: src/x64/fast-codegen-x64.cc
|
| ===================================================================
|
| --- src/x64/fast-codegen-x64.cc (revision 3310)
|
| +++ src/x64/fast-codegen-x64.cc (working copy)
|
| @@ -74,6 +74,12 @@
|
| }
|
| }
|
|
|
| + // The current stack contains the context, function, and locals.
|
| + // Keep track of the current height above the frame pointer, excluding
|
| + // the expression stack.
|
| + scope_stack_height_ = 2 + fun->scope()->num_stack_slots();
|
| + return_stack_height_ = scope_stack_height_;
|
| +
|
| bool function_in_register = true;
|
|
|
| Variable* arguments = fun->scope()->arguments()->AsVariable();
|
| @@ -156,10 +162,18 @@
|
|
|
| void FastCodeGenerator::EmitReturnSequence(int position) {
|
| Comment cmnt(masm_, "[ Return sequence");
|
| - if (return_label_.is_bound()) {
|
| - __ jmp(&return_label_);
|
| - } else {
|
| - __ bind(&return_label_);
|
| + if (return_label_ != &function_return_) { // Shadowed return
|
| + if (scope_stack_height_ > return_stack_height_) {
|
| + __ addq(rsp, Immediate(
|
| + (scope_stack_height_ - return_stack_height_) * kPointerSize));}
|
| + else {
|
| + ASSERT(scope_stack_height_ == return_stack_height_);
|
| + }
|
| + __ jmp(return_label_);
|
| + } else if (return_label_->is_bound()) { // Don't adjust stack for real return.
|
| + __ jmp(return_label_);
|
| + } else { // Emit actual return sequence
|
| + __ bind(return_label_);
|
| if (FLAG_trace) {
|
| __ push(rax);
|
| __ CallRuntime(Runtime::kTraceExit, 1);
|
|
|