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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 void ValueGraphVisitor::VisitTypeNode(TypeNode* node) { | 1220 void ValueGraphVisitor::VisitTypeNode(TypeNode* node) { |
1221 const AbstractType& type = node->type(); | 1221 const AbstractType& type = node->type(); |
1222 // Type may be malbounded, but not malformed. | 1222 // Type may be malbounded, but not malformed. |
1223 ASSERT(type.IsFinalized() && !type.IsMalformed()); | 1223 ASSERT(type.IsFinalized() && !type.IsMalformed()); |
1224 if (type.IsInstantiated()) { | 1224 if (type.IsInstantiated()) { |
1225 ReturnDefinition(new (Z) ConstantInstr(type)); | 1225 ReturnDefinition(new (Z) ConstantInstr(type)); |
1226 return; | 1226 return; |
1227 } | 1227 } |
1228 const TokenPosition token_pos = node->token_pos(); | 1228 const TokenPosition token_pos = node->token_pos(); |
1229 Value* instantiator_type_arguments = NULL; | 1229 Value* instantiator_type_arguments = NULL; |
1230 if (type.IsInstantiated(kClass)) { | 1230 if (type.IsInstantiated(kCurrentClass)) { |
1231 instantiator_type_arguments = BuildNullValue(token_pos); | 1231 instantiator_type_arguments = BuildNullValue(token_pos); |
1232 } else { | 1232 } else { |
1233 instantiator_type_arguments = BuildInstantiatorTypeArguments(token_pos); | 1233 instantiator_type_arguments = BuildInstantiatorTypeArguments(token_pos); |
1234 } | 1234 } |
1235 Value* function_type_arguments = NULL; | 1235 Value* function_type_arguments = NULL; |
1236 if (type.IsInstantiated(kCurrentFunction)) { | 1236 if (type.IsInstantiated(kCurrentFunction)) { |
1237 // TODO(regis): function_type_arguments = BuildNullValue((token_pos); | 1237 // TODO(regis): function_type_arguments = BuildNullValue((token_pos); |
1238 } else { | 1238 } else { |
1239 function_type_arguments = BuildFunctionTypeArguments(token_pos); | 1239 function_type_arguments = BuildFunctionTypeArguments(token_pos); |
1240 } | 1240 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 return; | 1414 return; |
1415 } | 1415 } |
1416 | 1416 |
1417 EffectGraphVisitor::VisitBinaryOpNode(node); | 1417 EffectGraphVisitor::VisitBinaryOpNode(node); |
1418 } | 1418 } |
1419 | 1419 |
1420 | 1420 |
1421 PushArgumentInstr* EffectGraphVisitor::PushInstantiatorTypeArguments( | 1421 PushArgumentInstr* EffectGraphVisitor::PushInstantiatorTypeArguments( |
1422 const AbstractType& type, | 1422 const AbstractType& type, |
1423 TokenPosition token_pos) { | 1423 TokenPosition token_pos) { |
1424 if (type.IsInstantiated(kClass)) { | 1424 if (type.IsInstantiated(kCurrentClass)) { |
1425 return PushArgument(BuildNullValue(token_pos)); | 1425 return PushArgument(BuildNullValue(token_pos)); |
1426 } else { | 1426 } else { |
1427 Value* instantiator_type_args = BuildInstantiatorTypeArguments(token_pos); | 1427 Value* instantiator_type_args = BuildInstantiatorTypeArguments(token_pos); |
1428 return PushArgument(instantiator_type_args); | 1428 return PushArgument(instantiator_type_args); |
1429 } | 1429 } |
1430 } | 1430 } |
1431 | 1431 |
1432 | 1432 |
1433 PushArgumentInstr* EffectGraphVisitor::PushFunctionTypeArguments( | 1433 PushArgumentInstr* EffectGraphVisitor::PushFunctionTypeArguments( |
1434 const AbstractType& type, | 1434 const AbstractType& type, |
(...skipping 15 matching lines...) Expand all Loading... |
1450 | 1450 |
1451 // Used for testing incoming arguments. | 1451 // Used for testing incoming arguments. |
1452 AssertAssignableInstr* EffectGraphVisitor::BuildAssertAssignable( | 1452 AssertAssignableInstr* EffectGraphVisitor::BuildAssertAssignable( |
1453 TokenPosition token_pos, | 1453 TokenPosition token_pos, |
1454 Value* value, | 1454 Value* value, |
1455 const AbstractType& dst_type, | 1455 const AbstractType& dst_type, |
1456 const String& dst_name) { | 1456 const String& dst_name) { |
1457 // Build the type check computation. | 1457 // Build the type check computation. |
1458 Value* instantiator_type_arguments = NULL; | 1458 Value* instantiator_type_arguments = NULL; |
1459 Value* function_type_arguments = NULL; | 1459 Value* function_type_arguments = NULL; |
1460 if (dst_type.IsInstantiated(kClass)) { | 1460 if (dst_type.IsInstantiated(kCurrentClass)) { |
1461 instantiator_type_arguments = BuildNullValue(token_pos); | 1461 instantiator_type_arguments = BuildNullValue(token_pos); |
1462 } else { | 1462 } else { |
1463 instantiator_type_arguments = BuildInstantiatorTypeArguments(token_pos); | 1463 instantiator_type_arguments = BuildInstantiatorTypeArguments(token_pos); |
1464 } | 1464 } |
1465 if (dst_type.IsInstantiated(kCurrentFunction)) { | 1465 if (dst_type.IsInstantiated(kCurrentFunction)) { |
1466 // TODO(regis): function_type_arguments = BuildNullValue(token_pos); | 1466 // TODO(regis): function_type_arguments = BuildNullValue(token_pos); |
1467 } else { | 1467 } else { |
1468 function_type_arguments = BuildFunctionTypeArguments(token_pos); | 1468 function_type_arguments = BuildFunctionTypeArguments(token_pos); |
1469 } | 1469 } |
1470 | 1470 |
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks); | 4355 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks); |
4356 ASSERT(found); | 4356 ASSERT(found); |
4357 } | 4357 } |
4358 | 4358 |
4359 | 4359 |
4360 void FlowGraphBuilder::Bailout(const char* reason) const { | 4360 void FlowGraphBuilder::Bailout(const char* reason) const { |
4361 parsed_function_.Bailout("FlowGraphBuilder", reason); | 4361 parsed_function_.Bailout("FlowGraphBuilder", reason); |
4362 } | 4362 } |
4363 | 4363 |
4364 } // namespace dart | 4364 } // namespace dart |
OLD | NEW |