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

Unified Diff: src/full-codegen.cc

Issue 9752002: This patch is an effort to simplify cascading jumps to return label in such case: Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 9 months 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/full-codegen.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen.cc
===================================================================
--- src/full-codegen.cc (revision 11089)
+++ src/full-codegen.cc (working copy)
@@ -782,6 +782,7 @@
void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
+ ImmediateReturnDisabled disable(this);
switch (expr->op()) {
case Token::COMMA:
return VisitComma(expr);
@@ -1050,6 +1051,7 @@
void FullCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
+ ImmediateReturnEnabled enable(this);
Comment cmnt(masm_, "[ ReturnStatement");
SetStatementPosition(stmt);
Expression* expr = stmt->expression();
@@ -1342,7 +1344,11 @@
NULL);
} else {
VisitInDuplicateContext(expr->then_expression());
- __ jmp(&done);
+ if (context()->IsReturnable()) {
+ __ jmp(&return_label_);
+ } else {
+ __ jmp(&done);
+ }
}
PrepareForBailoutForId(expr->ElseId(), NO_REGISTERS);
@@ -1351,7 +1357,7 @@
expr->else_expression_position());
VisitInDuplicateContext(expr->else_expression());
// If control flow falls through Visit, merge it with true case here.
- if (!context()->IsTest()) {
+ if (!context()->IsTest() && !context()->IsReturnable()) {
__ bind(&done);
}
}
« no previous file with comments | « src/full-codegen.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698