Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: src/x64/fast-codegen-x64.cc

Issue 397010: A start on allowing non-local control flow, for exceptions, try-finally, and ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/jump-target.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/jump-target.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698