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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/full-codegen.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 const Runtime::Function* function = expr->function(); 775 const Runtime::Function* function = expr->function();
776 ASSERT(function != NULL); 776 ASSERT(function != NULL);
777 ASSERT(function->intrinsic_type == Runtime::INLINE); 777 ASSERT(function->intrinsic_type == Runtime::INLINE);
778 InlineFunctionGenerator generator = 778 InlineFunctionGenerator generator =
779 FindInlineFunctionGenerator(function->function_id); 779 FindInlineFunctionGenerator(function->function_id);
780 ((*this).*(generator))(expr); 780 ((*this).*(generator))(expr);
781 } 781 }
782 782
783 783
784 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { 784 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
785 ImmediateReturnDisabled disable(this);
785 switch (expr->op()) { 786 switch (expr->op()) {
786 case Token::COMMA: 787 case Token::COMMA:
787 return VisitComma(expr); 788 return VisitComma(expr);
788 case Token::OR: 789 case Token::OR:
789 case Token::AND: 790 case Token::AND:
790 return VisitLogicalExpression(expr); 791 return VisitLogicalExpression(expr);
791 default: 792 default:
792 return VisitArithmeticExpression(expr); 793 return VisitArithmeticExpression(expr);
793 } 794 }
794 } 795 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1044 }
1044 StoreToFrameField(StandardFrameConstants::kContextOffset, 1045 StoreToFrameField(StandardFrameConstants::kContextOffset,
1045 context_register()); 1046 context_register());
1046 } 1047 }
1047 1048
1048 __ jmp(current->AsBreakable()->break_label()); 1049 __ jmp(current->AsBreakable()->break_label());
1049 } 1050 }
1050 1051
1051 1052
1052 void FullCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { 1053 void FullCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
1054 ImmediateReturnEnabled enable(this);
1053 Comment cmnt(masm_, "[ ReturnStatement"); 1055 Comment cmnt(masm_, "[ ReturnStatement");
1054 SetStatementPosition(stmt); 1056 SetStatementPosition(stmt);
1055 Expression* expr = stmt->expression(); 1057 Expression* expr = stmt->expression();
1056 VisitForAccumulatorValue(expr); 1058 VisitForAccumulatorValue(expr);
1057 1059
1058 // Exit all nested statements. 1060 // Exit all nested statements.
1059 NestedStatement* current = nesting_stack_; 1061 NestedStatement* current = nesting_stack_;
1060 int stack_depth = 0; 1062 int stack_depth = 0;
1061 int context_length = 0; 1063 int context_length = 0;
1062 while (current != NULL) { 1064 while (current != NULL) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 SetExpressionPosition(expr->then_expression(), 1337 SetExpressionPosition(expr->then_expression(),
1336 expr->then_expression_position()); 1338 expr->then_expression_position());
1337 if (context()->IsTest()) { 1339 if (context()->IsTest()) {
1338 const TestContext* for_test = TestContext::cast(context()); 1340 const TestContext* for_test = TestContext::cast(context());
1339 VisitForControl(expr->then_expression(), 1341 VisitForControl(expr->then_expression(),
1340 for_test->true_label(), 1342 for_test->true_label(),
1341 for_test->false_label(), 1343 for_test->false_label(),
1342 NULL); 1344 NULL);
1343 } else { 1345 } else {
1344 VisitInDuplicateContext(expr->then_expression()); 1346 VisitInDuplicateContext(expr->then_expression());
1345 __ jmp(&done); 1347 if (context()->IsReturnable()) {
1348 __ jmp(&return_label_);
1349 } else {
1350 __ jmp(&done);
1351 }
1346 } 1352 }
1347 1353
1348 PrepareForBailoutForId(expr->ElseId(), NO_REGISTERS); 1354 PrepareForBailoutForId(expr->ElseId(), NO_REGISTERS);
1349 __ bind(&false_case); 1355 __ bind(&false_case);
1350 SetExpressionPosition(expr->else_expression(), 1356 SetExpressionPosition(expr->else_expression(),
1351 expr->else_expression_position()); 1357 expr->else_expression_position());
1352 VisitInDuplicateContext(expr->else_expression()); 1358 VisitInDuplicateContext(expr->else_expression());
1353 // If control flow falls through Visit, merge it with true case here. 1359 // If control flow falls through Visit, merge it with true case here.
1354 if (!context()->IsTest()) { 1360 if (!context()->IsTest() && !context()->IsReturnable()) {
1355 __ bind(&done); 1361 __ bind(&done);
1356 } 1362 }
1357 } 1363 }
1358 1364
1359 1365
1360 void FullCodeGenerator::VisitLiteral(Literal* expr) { 1366 void FullCodeGenerator::VisitLiteral(Literal* expr) {
1361 Comment cmnt(masm_, "[ Literal"); 1367 Comment cmnt(masm_, "[ Literal");
1362 context()->Plug(expr->handle()); 1368 context()->Plug(expr->handle());
1363 } 1369 }
1364 1370
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 } 1428 }
1423 1429
1424 return false; 1430 return false;
1425 } 1431 }
1426 1432
1427 1433
1428 #undef __ 1434 #undef __
1429 1435
1430 1436
1431 } } // namespace v8::internal 1437 } } // namespace v8::internal
OLDNEW
« 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