Chromium Code Reviews| 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/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 BranchInstr* branch = new BranchInstr(comp); | 679 BranchInstr* branch = new BranchInstr(comp); |
| 680 AddInstruction(branch); | 680 AddInstruction(branch); |
| 681 CloseFragment(); | 681 CloseFragment(); |
| 682 | 682 |
| 683 true_successor_addresses_.Add(branch->true_successor_address()); | 683 true_successor_addresses_.Add(branch->true_successor_address()); |
| 684 false_successor_addresses_.Add(branch->false_successor_address()); | 684 false_successor_addresses_.Add(branch->false_successor_address()); |
| 685 } | 685 } |
| 686 | 686 |
| 687 | 687 |
| 688 void TestGraphVisitor::MergeBranchWithComparison(ComparisonInstr* comp) { | 688 void TestGraphVisitor::MergeBranchWithComparison(ComparisonInstr* comp) { |
| 689 ControlInstruction* branch; | 689 BranchInstr* branch; |
| 690 if (Token::IsStrictEqualityOperator(comp->kind())) { | 690 if (Token::IsStrictEqualityOperator(comp->kind())) { |
| 691 branch = new BranchInstr(new StrictCompareInstr(comp->token_pos(), | 691 branch = new BranchInstr(new StrictCompareInstr(comp->token_pos(), |
| 692 comp->kind(), | 692 comp->kind(), |
| 693 comp->left(), | 693 comp->left(), |
| 694 comp->right())); | 694 comp->right())); |
| 695 } else if (Token::IsEqualityOperator(comp->kind()) && | 695 } else if (Token::IsEqualityOperator(comp->kind()) && |
| 696 (comp->left()->BindsToConstantNull() || | 696 (comp->left()->BindsToConstantNull() || |
| 697 comp->right()->BindsToConstantNull())) { | 697 comp->right()->BindsToConstantNull())) { |
| 698 branch = new BranchInstr(new StrictCompareInstr( | 698 branch = new BranchInstr(new StrictCompareInstr( |
| 699 comp->token_pos(), | 699 comp->token_pos(), |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1413 node->token_pos(), | 1413 node->token_pos(), |
| 1414 node->kind(), | 1414 node->kind(), |
| 1415 for_left_value.value(), | 1415 for_left_value.value(), |
| 1416 for_right_value.value(), | 1416 for_right_value.value(), |
| 1417 owner()->ic_data_array()); | 1417 owner()->ic_data_array()); |
| 1418 ReturnDefinition(comp); | 1418 ReturnDefinition(comp); |
| 1419 } | 1419 } |
| 1420 return; | 1420 return; |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 ZoneGrowableArray<PushArgumentInstr*>* arguments = | |
| 1424 new ZoneGrowableArray<PushArgumentInstr*>(2); | |
| 1425 | |
| 1423 ValueGraphVisitor for_left_value(owner(), temp_index()); | 1426 ValueGraphVisitor for_left_value(owner(), temp_index()); |
| 1424 node->left()->Visit(&for_left_value); | 1427 node->left()->Visit(&for_left_value); |
| 1425 Append(for_left_value); | 1428 Append(for_left_value); |
| 1429 PushArgumentInstr* push_left = PushArgument(for_left_value.value()); | |
| 1430 arguments->Add(push_left); | |
| 1431 | |
| 1426 ValueGraphVisitor for_right_value(owner(), temp_index()); | 1432 ValueGraphVisitor for_right_value(owner(), temp_index()); |
| 1427 node->right()->Visit(&for_right_value); | 1433 node->right()->Visit(&for_right_value); |
| 1428 Append(for_right_value); | 1434 Append(for_right_value); |
| 1429 RelationalOpInstr* comp = new RelationalOpInstr(node->token_pos(), | 1435 PushArgumentInstr* push_right = PushArgument(for_right_value.value()); |
| 1430 node->kind(), | 1436 arguments->Add(push_right); |
| 1431 for_left_value.value(), | 1437 |
| 1432 for_right_value.value(), | 1438 ASSERT(Token::IsRelationalOperator(node->kind())); |
| 1433 owner()->ic_data_array()); | 1439 InstanceCallInstr* comp = |
| 1440 new InstanceCallInstr(node->token_pos(), | |
| 1441 String::ZoneHandle( | |
| 1442 Symbols::New(Token::Str(node->kind()))), | |
|
Kevin Millikin (Google)
2013/09/03 13:23:55
node->Name() is the same as Token::Str(node->kind(
Florian Schneider
2013/09/03 13:55:06
Done.
| |
| 1443 node->kind(), | |
| 1444 arguments, | |
| 1445 Object::null_array(), | |
| 1446 2, | |
| 1447 owner()->ic_data_array()); | |
| 1434 ReturnDefinition(comp); | 1448 ReturnDefinition(comp); |
| 1435 } | 1449 } |
| 1436 | 1450 |
| 1437 | 1451 |
| 1438 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { | 1452 void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) { |
| 1439 // "!" cannot be overloaded, therefore do not call operator. | 1453 // "!" cannot be overloaded, therefore do not call operator. |
| 1440 if (node->kind() == Token::kNOT) { | 1454 if (node->kind() == Token::kNOT) { |
| 1441 ValueGraphVisitor for_value(owner(), temp_index()); | 1455 ValueGraphVisitor for_value(owner(), temp_index()); |
| 1442 node->operand()->Visit(&for_value); | 1456 node->operand()->Visit(&for_value); |
| 1443 Append(for_value); | 1457 Append(for_value); |
| (...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3808 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3822 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3809 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3823 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3810 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3824 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3811 const Error& error = Error::Handle( | 3825 const Error& error = Error::Handle( |
| 3812 LanguageError::New(String::Handle(String::New(chars)))); | 3826 LanguageError::New(String::Handle(String::New(chars)))); |
| 3813 Isolate::Current()->long_jump_base()->Jump(1, error); | 3827 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3814 } | 3828 } |
| 3815 | 3829 |
| 3816 | 3830 |
| 3817 } // namespace dart | 3831 } // namespace dart |
| OLD | NEW |