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

Side by Side Diff: src/hydrogen.cc

Issue 15740007: Add for-of Crankshaft support Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase onto master; fix AstTyper for ForOfStatement Created 7 years, 6 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/flag-definitions.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 5433 matching lines...) Expand 10 before | Expand all | Expand 10 after
5444 break_info.break_block()); 5444 break_info.break_block());
5445 5445
5446 set_current_block(loop_exit); 5446 set_current_block(loop_exit);
5447 } 5447 }
5448 5448
5449 5449
5450 void HOptimizedGraphBuilder::VisitForOfStatement(ForOfStatement* stmt) { 5450 void HOptimizedGraphBuilder::VisitForOfStatement(ForOfStatement* stmt) {
5451 ASSERT(!HasStackOverflow()); 5451 ASSERT(!HasStackOverflow());
5452 ASSERT(current_block() != NULL); 5452 ASSERT(current_block() != NULL);
5453 ASSERT(current_block()->HasPredecessor()); 5453 ASSERT(current_block()->HasPredecessor());
5454 return Bailout("ForOfStatement"); 5454
5455 if (!FLAG_optimize_for_of) {
5456 return Bailout("ForOfStatement optimization is disabled");
5457 }
5458
5459 CHECK_ALIVE(VisitForValue(stmt->assign_iterator()));
5460 HValue *iterator = Pop();
5461
5462 IfBuilder nil_check(this);
5463 nil_check.If<HCompareObjectEqAndBranch>(iterator,
5464 graph()->GetConstantNull());
5465 nil_check.OrIf<HCompareObjectEqAndBranch>(iterator,
5466 graph()->GetConstantUndefined());
5467 nil_check.Then();
5468 nil_check.Else();
5469
5470 bool osr_entry = PreProcessOsrEntry(stmt);
5471 HBasicBlock* loop_entry = CreateLoopHeaderBlock();
5472 current_block()->Goto(loop_entry);
5473 set_current_block(loop_entry);
5474 if (osr_entry) graph()->set_osr_loop_entry(loop_entry);
5475
5476 CHECK_BAILOUT(VisitForEffect(stmt->next_result()));
5477
5478 BreakAndContinueInfo break_info(stmt);
5479 HBasicBlock* loop_body = graph()->CreateBasicBlock();
5480 HBasicBlock* loop_successor = graph()->CreateBasicBlock();
5481 break_info.set_continue_block(loop_entry);
5482
5483 CHECK_BAILOUT(VisitForControl(stmt->result_done(),
5484 loop_successor, loop_body));
5485
5486 if (loop_body->HasPredecessor()) {
5487 loop_body->SetJoinId(stmt->BodyId());
5488 set_current_block(loop_body);
5489 CHECK_BAILOUT(VisitForEffect(stmt->assign_each()));
5490 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info));
5491 }
5492 if (loop_successor->HasPredecessor()) {
5493 loop_successor->SetJoinId(stmt->ExitId());
5494 }
5495
5496 HBasicBlock* loop_exit = CreateLoop(stmt,
5497 loop_entry,
5498 current_block(),
5499 loop_successor,
5500 break_info.break_block());
5501
5502 set_current_block(loop_exit);
5503 nil_check.End();
5455 } 5504 }
5456 5505
5457 5506
5458 void HOptimizedGraphBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) { 5507 void HOptimizedGraphBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) {
5459 ASSERT(!HasStackOverflow()); 5508 ASSERT(!HasStackOverflow());
5460 ASSERT(current_block() != NULL); 5509 ASSERT(current_block() != NULL);
5461 ASSERT(current_block()->HasPredecessor()); 5510 ASSERT(current_block()->HasPredecessor());
5462 return Bailout("TryCatchStatement"); 5511 return Bailout("TryCatchStatement");
5463 } 5512 }
5464 5513
(...skipping 6144 matching lines...) Expand 10 before | Expand all | Expand 10 after
11609 } 11658 }
11610 } 11659 }
11611 11660
11612 #ifdef DEBUG 11661 #ifdef DEBUG
11613 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11662 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11614 if (allocator_ != NULL) allocator_->Verify(); 11663 if (allocator_ != NULL) allocator_->Verify();
11615 #endif 11664 #endif
11616 } 11665 }
11617 11666
11618 } } // namespace v8::internal 11667 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698