| 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);
|
| }
|
| }
|
|
|