Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 target_entry->SetSuccessor(for_test.entry()); | 603 target_entry->SetSuccessor(for_test.entry()); |
| 604 body_exit->SetSuccessor(target_entry); | 604 body_exit->SetSuccessor(target_entry); |
| 605 } | 605 } |
| 606 | 606 |
| 607 *for_test.true_successor_address() = join; | 607 *for_test.true_successor_address() = join; |
| 608 exit_ = *for_test.false_successor_address() = new TargetEntryInstr(); | 608 exit_ = *for_test.false_successor_address() = new TargetEntryInstr(); |
| 609 } | 609 } |
| 610 | 610 |
| 611 | 611 |
| 612 void EffectGraphVisitor::VisitForNode(ForNode* node) { | 612 void EffectGraphVisitor::VisitForNode(ForNode* node) { |
| 613 Bailout("EffectGraphVisitor::VisitForNode"); | 613 EffectGraphVisitor for_initializer(owner(), temp_index()); |
| 614 node->initializer()->Visit(&for_initializer); | |
| 615 Append(for_initializer); | |
| 616 if (!is_open()) return; | |
|
srdjan
2012/03/08 17:55:12
Should this be an assert? Can we have initializers
Kevin Millikin (Google)
2012/03/09 08:52:53
Other than the throw in expression context issue t
| |
| 617 | |
| 618 EffectGraphVisitor for_body(owner(), temp_index()); | |
| 619 node->body()->Visit(&for_body); | |
| 620 if (for_body.is_open()) { | |
| 621 EffectGraphVisitor for_increment(owner(), temp_index()); | |
| 622 node->increment()->Visit(&for_increment); | |
| 623 for_body.Append(for_increment); | |
| 624 } | |
| 625 | |
| 626 if (node->condition() != NULL) { | |
| 627 TestGraphVisitor for_test(owner(), temp_index()); | |
| 628 node->condition()->Visit(&for_test); | |
| 629 TieLoop(for_test, for_body); | |
| 630 return; | |
| 631 } | |
| 632 | |
| 633 // Degenerate cases. An absent condition is implicitly true. No | |
| 634 // normal exit from loop => no back edge. | |
| 635 if (!for_body.is_open()) { | |
| 636 Append(for_body); | |
| 637 return; | |
| 638 } | |
| 639 JoinEntryInstr* join = new JoinEntryInstr(); | |
| 640 AddInstruction(join); | |
| 641 if (for_body.is_empty()) { | |
| 642 join->SetSuccessor(join); | |
| 643 } else { | |
| 644 join->SetSuccessor(for_body.entry()); | |
| 645 for_body.exit()->SetSuccessor(join); | |
| 646 } | |
| 647 CloseFragment(); | |
| 614 } | 648 } |
| 615 | 649 |
| 616 | 650 |
| 617 void EffectGraphVisitor::VisitJumpNode(JumpNode* node) { | 651 void EffectGraphVisitor::VisitJumpNode(JumpNode* node) { |
| 618 Bailout("EffectGraphVisitor::VisitJumpNode"); | 652 Bailout("EffectGraphVisitor::VisitJumpNode"); |
| 619 } | 653 } |
| 620 | 654 |
| 621 | 655 |
| 622 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { | 656 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { |
| 623 UNREACHABLE(); | 657 UNREACHABLE(); |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1176 char* chars = reinterpret_cast<char*>( | 1210 char* chars = reinterpret_cast<char*>( |
| 1177 Isolate::Current()->current_zone()->Allocate(len)); | 1211 Isolate::Current()->current_zone()->Allocate(len)); |
| 1178 OS::SNPrint(chars, len, kFormat, function_name, reason); | 1212 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 1179 const Error& error = Error::Handle( | 1213 const Error& error = Error::Handle( |
| 1180 LanguageError::New(String::Handle(String::New(chars)))); | 1214 LanguageError::New(String::Handle(String::New(chars)))); |
| 1181 Isolate::Current()->long_jump_base()->Jump(1, error); | 1215 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1182 } | 1216 } |
| 1183 | 1217 |
| 1184 | 1218 |
| 1185 } // namespace dart | 1219 } // namespace dart |
| OLD | NEW |