| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #define KIND_TO_STRING(class_name, function_name, enum_name) \ | 47 #define KIND_TO_STRING(class_name, function_name, enum_name) \ |
| 48 if (kind == k##enum_name) return #enum_name; | 48 if (kind == k##enum_name) return #enum_name; |
| 49 RECOGNIZED_LIST(KIND_TO_STRING) | 49 RECOGNIZED_LIST(KIND_TO_STRING) |
| 50 #undef KIND_TO_STRING | 50 #undef KIND_TO_STRING |
| 51 return "?"; | 51 return "?"; |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 // ==== Support for visiting flow graphs. | 55 // ==== Support for visiting flow graphs. |
| 56 #define DEFINE_ACCEPT(ShortName, ClassName) \ | 56 #define DEFINE_ACCEPT(ShortName, ClassName) \ |
| 57 void ClassName::Accept(FlowGraphVisitor* visitor) { \ | 57 void ClassName::Accept(FlowGraphVisitor* visitor, BindInstr* instr) { \ |
| 58 visitor->Visit##ShortName(this); \ | 58 visitor->Visit##ShortName(this, instr); \ |
| 59 } | 59 } |
| 60 | 60 |
| 61 FOR_EACH_COMPUTATION(DEFINE_ACCEPT) | 61 FOR_EACH_COMPUTATION(DEFINE_ACCEPT) |
| 62 | 62 |
| 63 #undef DEFINE_ACCEPT | 63 #undef DEFINE_ACCEPT |
| 64 | 64 |
| 65 | 65 |
| 66 #define DEFINE_ACCEPT(ShortName) \ | 66 #define DEFINE_ACCEPT(ShortName) \ |
| 67 Instruction* ShortName##Instr::Accept(FlowGraphVisitor* visitor) { \ | 67 Instruction* ShortName##Instr::Accept(FlowGraphVisitor* visitor) { \ |
| 68 visitor->Visit##ShortName(this); \ | 68 visitor->Visit##ShortName(this); \ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 void FlowGraphVisitor::VisitBlocks() { | 86 void FlowGraphVisitor::VisitBlocks() { |
| 87 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 87 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
| 88 Instruction* current = block_order_[i]->Accept(this); | 88 Instruction* current = block_order_[i]->Accept(this); |
| 89 while ((current != NULL) && !current->IsBlockEntry()) { | 89 while ((current != NULL) && !current->IsBlockEntry()) { |
| 90 current = current->Accept(this); | 90 current = current->Accept(this); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 void Computation::ReplaceWith(Computation* other) { | |
| 97 ASSERT(other->instr() == NULL); | |
| 98 ASSERT(instr() != NULL); | |
| 99 other->set_instr(other->instr()); | |
| 100 instr()->replace_computation(other); | |
| 101 set_instr(NULL); | |
| 102 } | |
| 103 | |
| 104 | |
| 105 intptr_t InstanceCallComp::InputCount() const { | 96 intptr_t InstanceCallComp::InputCount() const { |
| 106 return ArgumentCount(); | 97 return ArgumentCount(); |
| 107 } | 98 } |
| 108 | 99 |
| 109 | 100 |
| 110 intptr_t StaticCallComp::InputCount() const { | 101 intptr_t StaticCallComp::InputCount() const { |
| 111 return ArgumentCount(); | 102 return ArgumentCount(); |
| 112 } | 103 } |
| 113 | 104 |
| 114 | 105 |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1323 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1333 compiler->GenerateCall(token_pos(), try_index(), &label, | 1324 compiler->GenerateCall(token_pos(), try_index(), &label, |
| 1334 PcDescriptors::kOther); | 1325 PcDescriptors::kOther); |
| 1335 __ Drop(2); // Discard type arguments and receiver. | 1326 __ Drop(2); // Discard type arguments and receiver. |
| 1336 } | 1327 } |
| 1337 | 1328 |
| 1338 | 1329 |
| 1339 #undef __ | 1330 #undef __ |
| 1340 | 1331 |
| 1341 } // namespace dart | 1332 } // namespace dart |
| OLD | NEW |