| 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/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/code_descriptors.h" | 9 #include "vm/code_descriptors.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 | 1035 |
| 1036 ASSERT(!is_open()); | 1036 ASSERT(!is_open()); |
| 1037 exit_ = exit_instruction; | 1037 exit_ = exit_instruction; |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 | 1040 |
| 1041 // <Statement> ::= While { label: SourceLabel | 1041 // <Statement> ::= While { label: SourceLabel |
| 1042 // condition: <Expression> | 1042 // condition: <Expression> |
| 1043 // body: <Sequence> } | 1043 // body: <Sequence> } |
| 1044 // The fragment is composed as follows: | 1044 // The fragment is composed as follows: |
| 1045 // a) continue-join (optional) | 1045 // a) loop-join |
| 1046 // b) loop-join | 1046 // b) [ test ] -> (body-entry-target, loop-exit-target) |
| 1047 // c) [ test ] -> (body-entry-target, loop-exit-target) | 1047 // c) body-entry-target |
| 1048 // d) body-entry-target | 1048 // d) [ body ] -> (continue-join) |
| 1049 // e) [ body ] -> (loop-join) | 1049 // e) continue-join -> (loop-join) |
| 1050 // f) loop-exit-target | 1050 // f) loop-exit-target |
| 1051 // g) break-join (optional) | 1051 // g) break-join (optional) |
| 1052 void EffectGraphVisitor::VisitWhileNode(WhileNode* node) { | 1052 void EffectGraphVisitor::VisitWhileNode(WhileNode* node) { |
| 1053 TestGraphVisitor for_test(owner(), | 1053 TestGraphVisitor for_test(owner(), |
| 1054 temp_index(), | 1054 temp_index(), |
| 1055 node->condition()->token_pos()); | 1055 node->condition()->token_pos()); |
| 1056 node->condition()->Visit(&for_test); | 1056 node->condition()->Visit(&for_test); |
| 1057 ASSERT(!for_test.is_empty()); // Language spec. | 1057 ASSERT(!for_test.is_empty()); // Language spec. |
| 1058 | 1058 |
| 1059 EffectGraphVisitor for_body(owner(), temp_index()); | 1059 EffectGraphVisitor for_body(owner(), temp_index()); |
| 1060 for_body.Do( | 1060 for_body.Do( |
| 1061 new CheckStackOverflowComp(node->token_pos(), owner()->try_index())); | 1061 new CheckStackOverflowComp(node->token_pos(), owner()->try_index())); |
| 1062 node->body()->Visit(&for_body); | 1062 node->body()->Visit(&for_body); |
| 1063 | 1063 |
| 1064 // Labels are set after body traversal. | 1064 // Labels are set after body traversal. |
| 1065 SourceLabel* lbl = node->label(); | 1065 SourceLabel* lbl = node->label(); |
| 1066 ASSERT(lbl != NULL); | 1066 ASSERT(lbl != NULL); |
| 1067 JoinEntryInstr* join = lbl->join_for_continue(); | 1067 JoinEntryInstr* join = lbl->join_for_continue(); |
| 1068 if (join != NULL) { | 1068 if (join != NULL) { |
| 1069 Goto(join); | 1069 if (for_body.is_open()) for_body.Goto(join); |
| 1070 exit_ = join; | 1070 for_body.exit_ = join; |
| 1071 } | 1071 } |
| 1072 TieLoop(for_test, for_body); | 1072 TieLoop(for_test, for_body); |
| 1073 join = lbl->join_for_break(); | 1073 join = lbl->join_for_break(); |
| 1074 if (join != NULL) { | 1074 if (join != NULL) { |
| 1075 Goto(join); | 1075 Goto(join); |
| 1076 exit_ = join; | 1076 exit_ = join; |
| 1077 } | 1077 } |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 | 1080 |
| (...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 char* chars = reinterpret_cast<char*>( | 2679 char* chars = reinterpret_cast<char*>( |
| 2680 Isolate::Current()->current_zone()->Allocate(len)); | 2680 Isolate::Current()->current_zone()->Allocate(len)); |
| 2681 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2681 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2682 const Error& error = Error::Handle( | 2682 const Error& error = Error::Handle( |
| 2683 LanguageError::New(String::Handle(String::New(chars)))); | 2683 LanguageError::New(String::Handle(String::New(chars)))); |
| 2684 Isolate::Current()->long_jump_base()->Jump(1, error); | 2684 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2685 } | 2685 } |
| 2686 | 2686 |
| 2687 | 2687 |
| 2688 } // namespace dart | 2688 } // namespace dart |
| OLD | NEW |