| 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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 Join(for_test, for_true, for_right); | 1453 Join(for_test, for_true, for_right); |
| 1454 } | 1454 } |
| 1455 ReturnDefinition(BuildLoadExprTemp(node->token_pos())); | 1455 ReturnDefinition(BuildLoadExprTemp(node->token_pos())); |
| 1456 return; | 1456 return; |
| 1457 } | 1457 } |
| 1458 | 1458 |
| 1459 EffectGraphVisitor::VisitBinaryOpNode(node); | 1459 EffectGraphVisitor::VisitBinaryOpNode(node); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 | 1462 |
| 1463 static const String& BinaryOpAndMaskName(BinaryOpNode* node) { | |
| 1464 if (node->kind() == Token::kSHL) { | |
| 1465 return Library::PrivateCoreLibName(Symbols::_leftShiftWithMask32()); | |
| 1466 } | |
| 1467 UNIMPLEMENTED(); | |
| 1468 return String::ZoneHandle(Thread::Current()->zone(), String::null()); | |
| 1469 } | |
| 1470 | |
| 1471 | |
| 1472 // <Expression> :: BinaryOp { kind: Token::Kind | |
| 1473 // left: <Expression> | |
| 1474 // right: <Expression> | |
| 1475 // mask32: constant } | |
| 1476 void EffectGraphVisitor::VisitBinaryOpWithMask32Node( | |
| 1477 BinaryOpWithMask32Node* node) { | |
| 1478 ASSERT((node->kind() != Token::kAND) && (node->kind() != Token::kOR)); | |
| 1479 ValueGraphVisitor for_left_value(owner()); | |
| 1480 node->left()->Visit(&for_left_value); | |
| 1481 Append(for_left_value); | |
| 1482 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); | |
| 1483 | |
| 1484 ValueGraphVisitor for_right_value(owner()); | |
| 1485 node->right()->Visit(&for_right_value); | |
| 1486 Append(for_right_value); | |
| 1487 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); | |
| 1488 | |
| 1489 Value* mask_value = Bind(new(Z) ConstantInstr( | |
| 1490 Integer::ZoneHandle(Z, Integer::New(node->mask32(), Heap::kOld)))); | |
| 1491 PushArgumentInstr* push_mask = PushArgument(mask_value); | |
| 1492 | |
| 1493 ZoneGrowableArray<PushArgumentInstr*>* arguments = | |
| 1494 new(Z) ZoneGrowableArray<PushArgumentInstr*>(3); | |
| 1495 arguments->Add(push_left); | |
| 1496 arguments->Add(push_right); | |
| 1497 // Call to special method 'BinaryOpAndMaskName(node)'. | |
| 1498 arguments->Add(push_mask); | |
| 1499 const intptr_t kNumArgsChecked = 2; | |
| 1500 InstanceCallInstr* call = new(Z) InstanceCallInstr(node->token_pos(), | |
| 1501 BinaryOpAndMaskName(node), | |
| 1502 Token::kILLEGAL, | |
| 1503 arguments, | |
| 1504 Object::null_array(), | |
| 1505 kNumArgsChecked, | |
| 1506 owner()->ic_data_array()); | |
| 1507 ReturnDefinition(call); | |
| 1508 } | |
| 1509 | |
| 1510 | |
| 1511 void EffectGraphVisitor::BuildTypecheckPushArguments( | 1463 void EffectGraphVisitor::BuildTypecheckPushArguments( |
| 1512 TokenPosition token_pos, | 1464 TokenPosition token_pos, |
| 1513 PushArgumentInstr** push_instantiator_type_arguments_result) { | 1465 PushArgumentInstr** push_instantiator_type_arguments_result) { |
| 1514 const Class& instantiator_class = Class::Handle( | 1466 const Class& instantiator_class = Class::Handle( |
| 1515 Z, owner()->function().Owner()); | 1467 Z, owner()->function().Owner()); |
| 1516 // Since called only when type tested against is not instantiated. | 1468 // Since called only when type tested against is not instantiated. |
| 1517 ASSERT(instantiator_class.IsGeneric()); | 1469 ASSERT(instantiator_class.IsGeneric()); |
| 1518 Value* instantiator_type_arguments = NULL; | 1470 Value* instantiator_type_arguments = NULL; |
| 1519 Value* instantiator = BuildInstantiator(token_pos); | 1471 Value* instantiator = BuildInstantiator(token_pos); |
| 1520 if (instantiator == NULL) { | 1472 if (instantiator == NULL) { |
| (...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4667 Script::Handle(function.script()), | 4619 Script::Handle(function.script()), |
| 4668 function.token_pos(), | 4620 function.token_pos(), |
| 4669 Report::AtLocation, | 4621 Report::AtLocation, |
| 4670 "FlowGraphBuilder Bailout: %s %s", | 4622 "FlowGraphBuilder Bailout: %s %s", |
| 4671 String::Handle(function.name()).ToCString(), | 4623 String::Handle(function.name()).ToCString(), |
| 4672 reason); | 4624 reason); |
| 4673 UNREACHABLE(); | 4625 UNREACHABLE(); |
| 4674 } | 4626 } |
| 4675 | 4627 |
| 4676 } // namespace dart | 4628 } // namespace dart |
| OLD | NEW |