| 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 } | 797 } |
| 798 return; | 798 return; |
| 799 } | 799 } |
| 800 | 800 |
| 801 ValueGraphVisitor for_left_value(owner(), temp_index()); | 801 ValueGraphVisitor for_left_value(owner(), temp_index()); |
| 802 node->left()->Visit(&for_left_value); | 802 node->left()->Visit(&for_left_value); |
| 803 Append(for_left_value); | 803 Append(for_left_value); |
| 804 ValueGraphVisitor for_right_value(owner(), temp_index()); | 804 ValueGraphVisitor for_right_value(owner(), temp_index()); |
| 805 node->right()->Visit(&for_right_value); | 805 node->right()->Visit(&for_right_value); |
| 806 Append(for_right_value); | 806 Append(for_right_value); |
| 807 ZoneGrowableArray<Value*>* arguments = new ZoneGrowableArray<Value*>(2); | 807 RelationalOpComp* comp = new RelationalOpComp(node->token_index(), |
| 808 arguments->Add(for_left_value.value()); | 808 owner()->try_index(), |
| 809 arguments->Add(for_right_value.value()); | 809 node->kind(), |
| 810 const String& name = String::ZoneHandle(String::NewSymbol(node->Name())); | 810 for_left_value.value(), |
| 811 InstanceCallComp* call = new InstanceCallComp( | 811 for_right_value.value()); |
| 812 node->token_index(), owner()->try_index(), name, | 812 ReturnComputation(comp); |
| 813 arguments, Array::ZoneHandle(), 2); | |
| 814 ReturnComputation(call); | |
| 815 } | 813 } |
| 816 | 814 |
| 817 | 815 |
| 818 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { | 816 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { |
| 819 // "!" cannot be overloaded, therefore do not call operator. | 817 // "!" cannot be overloaded, therefore do not call operator. |
| 820 if (node->kind() == Token::kNOT) { | 818 if (node->kind() == Token::kNOT) { |
| 821 ValueGraphVisitor for_value(owner(), temp_index()); | 819 ValueGraphVisitor for_value(owner(), temp_index()); |
| 822 node->operand()->Visit(&for_value); | 820 node->operand()->Visit(&for_value); |
| 823 Append(for_value); | 821 Append(for_value); |
| 824 Value* value = for_value.value(); | 822 Value* value = for_value.value(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 EffectGraphVisitor for_initializer(owner(), temp_index()); | 1155 EffectGraphVisitor for_initializer(owner(), temp_index()); |
| 1158 node->initializer()->Visit(&for_initializer); | 1156 node->initializer()->Visit(&for_initializer); |
| 1159 Append(for_initializer); | 1157 Append(for_initializer); |
| 1160 ASSERT(is_open()); | 1158 ASSERT(is_open()); |
| 1161 | 1159 |
| 1162 // Compose body to set any jump labels. | 1160 // Compose body to set any jump labels. |
| 1163 EffectGraphVisitor for_body(owner(), temp_index()); | 1161 EffectGraphVisitor for_body(owner(), temp_index()); |
| 1164 TargetEntryInstr* body_entry = new TargetEntryInstr(); | 1162 TargetEntryInstr* body_entry = new TargetEntryInstr(); |
| 1165 for_body.AddInstruction(body_entry); | 1163 for_body.AddInstruction(body_entry); |
| 1166 node->body()->Visit(&for_body); | 1164 node->body()->Visit(&for_body); |
| 1165 if (for_body.is_open()) { |
| 1166 CheckStackOverflowComp* comp = |
| 1167 new CheckStackOverflowComp(node->token_index(), owner()->try_index()); |
| 1168 for_body.AddInstruction(new DoInstr(comp)); |
| 1169 } |
| 1167 | 1170 |
| 1168 // Join loop body, increment and compute their end instruction. | 1171 // Join loop body, increment and compute their end instruction. |
| 1169 ASSERT(!for_body.is_empty()); | 1172 ASSERT(!for_body.is_empty()); |
| 1170 Instruction* loop_increment_end = NULL; | 1173 Instruction* loop_increment_end = NULL; |
| 1171 EffectGraphVisitor for_increment(owner(), temp_index()); | 1174 EffectGraphVisitor for_increment(owner(), temp_index()); |
| 1172 if ((node->label()->join_for_continue() == NULL) && for_body.is_open()) { | 1175 if ((node->label()->join_for_continue() == NULL) && for_body.is_open()) { |
| 1173 // Do not insert an extra basic block. | 1176 // Do not insert an extra basic block. |
| 1174 node->increment()->Visit(&for_increment); | 1177 node->increment()->Visit(&for_increment); |
| 1175 for_body.Append(for_increment); | 1178 for_body.Append(for_increment); |
| 1176 loop_increment_end = for_body.exit(); | 1179 loop_increment_end = for_body.exit(); |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 char* chars = reinterpret_cast<char*>( | 2488 char* chars = reinterpret_cast<char*>( |
| 2486 Isolate::Current()->current_zone()->Allocate(len)); | 2489 Isolate::Current()->current_zone()->Allocate(len)); |
| 2487 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2490 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2488 const Error& error = Error::Handle( | 2491 const Error& error = Error::Handle( |
| 2489 LanguageError::New(String::Handle(String::New(chars)))); | 2492 LanguageError::New(String::Handle(String::New(chars)))); |
| 2490 Isolate::Current()->long_jump_base()->Jump(1, error); | 2493 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2491 } | 2494 } |
| 2492 | 2495 |
| 2493 | 2496 |
| 2494 } // namespace dart | 2497 } // namespace dart |
| OLD | NEW |