| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 Bailout("EffectGraphVisitor::VisitJumpNode"); | 618 Bailout("EffectGraphVisitor::VisitJumpNode"); |
| 619 } | 619 } |
| 620 | 620 |
| 621 | 621 |
| 622 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { | 622 void EffectGraphVisitor::VisitArgumentListNode(ArgumentListNode* node) { |
| 623 UNREACHABLE(); | 623 UNREACHABLE(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 | 626 |
| 627 void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { | 627 void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { |
| 628 Bailout("EffectGraphVisitor::VisitArrayNode"); | 628 // Translate the array elements and collect their values. |
| 629 ZoneGrowableArray<Value*>* values = |
| 630 new ZoneGrowableArray<Value*>(node->length()); |
| 631 int index = temp_index(); |
| 632 for (int i = 0; i < node->length(); ++i) { |
| 633 ValueGraphVisitor for_value(owner(), index); |
| 634 node->ElementAt(i)->Visit(&for_value); |
| 635 Append(for_value); |
| 636 values->Add(for_value.value()); |
| 637 index = for_value.temp_index(); |
| 638 } |
| 639 CreateArrayComp* create = new CreateArrayComp(node, values); |
| 640 ReturnComputation(create); |
| 629 } | 641 } |
| 630 | 642 |
| 631 | 643 |
| 632 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { | 644 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { |
| 633 Bailout("EffectGraphVisitor::VisitClosureNode"); | 645 Bailout("EffectGraphVisitor::VisitClosureNode"); |
| 634 } | 646 } |
| 635 | 647 |
| 636 | 648 |
| 637 void EffectGraphVisitor::TranslateArgumentList( | 649 void EffectGraphVisitor::TranslateArgumentList( |
| 638 const ArgumentListNode& node, | 650 const ArgumentListNode& node, |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 } | 1102 } |
| 1091 | 1103 |
| 1092 | 1104 |
| 1093 void FlowGraphPrinter::VisitInstanceOf(InstanceOfComp* comp) { | 1105 void FlowGraphPrinter::VisitInstanceOf(InstanceOfComp* comp) { |
| 1094 comp->value()->Accept(this); | 1106 comp->value()->Accept(this); |
| 1095 OS::Print(" %s %s", | 1107 OS::Print(" %s %s", |
| 1096 comp->negate_result() ? "ISNOT" : "IS", | 1108 comp->negate_result() ? "ISNOT" : "IS", |
| 1097 String::Handle(comp->type().Name()).ToCString()); | 1109 String::Handle(comp->type().Name()).ToCString()); |
| 1098 } | 1110 } |
| 1099 | 1111 |
| 1112 |
| 1113 void FlowGraphPrinter::VisitCreateArray(CreateArrayComp* comp) { |
| 1114 OS::Print("CreateArray("); |
| 1115 for (int i = 0; i < comp->ElementCount(); ++i) { |
| 1116 if (i != 0) OS::Print(", "); |
| 1117 comp->ElementAt(i)->Accept(this); |
| 1118 } |
| 1119 OS::Print(")"); |
| 1120 } |
| 1121 |
| 1122 |
| 1100 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { | 1123 void FlowGraphPrinter::VisitJoinEntry(JoinEntryInstr* instr) { |
| 1101 OS::Print("%2d: [join]", instr->block_number()); | 1124 OS::Print("%2d: [join]", instr->block_number()); |
| 1102 } | 1125 } |
| 1103 | 1126 |
| 1104 | 1127 |
| 1105 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { | 1128 void FlowGraphPrinter::VisitTargetEntry(TargetEntryInstr* instr) { |
| 1106 OS::Print("%2d: [target]", instr->block_number()); | 1129 OS::Print("%2d: [target]", instr->block_number()); |
| 1107 } | 1130 } |
| 1108 | 1131 |
| 1109 | 1132 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 char* chars = reinterpret_cast<char*>( | 1199 char* chars = reinterpret_cast<char*>( |
| 1177 Isolate::Current()->current_zone()->Allocate(len)); | 1200 Isolate::Current()->current_zone()->Allocate(len)); |
| 1178 OS::SNPrint(chars, len, kFormat, function_name, reason); | 1201 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 1179 const Error& error = Error::Handle( | 1202 const Error& error = Error::Handle( |
| 1180 LanguageError::New(String::Handle(String::New(chars)))); | 1203 LanguageError::New(String::Handle(String::New(chars)))); |
| 1181 Isolate::Current()->long_jump_base()->Jump(1, error); | 1204 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1182 } | 1205 } |
| 1183 | 1206 |
| 1184 | 1207 |
| 1185 } // namespace dart | 1208 } // namespace dart |
| OLD | NEW |