| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/aot_optimizer.h" | 5 #include "vm/aot_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 } | 1542 } |
| 1543 TestCidsInstr* test_cids = new (Z) TestCidsInstr( | 1543 TestCidsInstr* test_cids = new (Z) TestCidsInstr( |
| 1544 call->token_pos(), Token::kIS, new (Z) Value(left), *results, | 1544 call->token_pos(), Token::kIS, new (Z) Value(left), *results, |
| 1545 can_deopt ? call->deopt_id() : Thread::kNoDeoptId); | 1545 can_deopt ? call->deopt_id() : Thread::kNoDeoptId); |
| 1546 // Remove type. | 1546 // Remove type. |
| 1547 ReplaceCall(call, test_cids); | 1547 ReplaceCall(call, test_cids); |
| 1548 return; | 1548 return; |
| 1549 } | 1549 } |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 InstanceOfInstr* instance_of = | 1552 InstanceOfInstr* instance_of = new (Z) InstanceOfInstr( |
| 1553 new (Z) InstanceOfInstr(call->token_pos(), new (Z) Value(left), | 1553 call->token_pos(), new (Z) Value(left), new (Z) Value(type_args), |
| 1554 new (Z) Value(type_args), type, call->deopt_id()); | 1554 NULL, // TODO(regis): Pass function type args. |
| 1555 type, call->deopt_id()); |
| 1555 ReplaceCall(call, instance_of); | 1556 ReplaceCall(call, instance_of); |
| 1556 } | 1557 } |
| 1557 | 1558 |
| 1558 | 1559 |
| 1559 // TODO(srdjan): Apply optimizations as in ReplaceWithInstanceOf (TestCids). | 1560 // TODO(srdjan): Apply optimizations as in ReplaceWithInstanceOf (TestCids). |
| 1560 void AotOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) { | 1561 void AotOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) { |
| 1561 ASSERT(Token::IsTypeCastOperator(call->token_kind())); | 1562 ASSERT(Token::IsTypeCastOperator(call->token_kind())); |
| 1562 Definition* left = call->ArgumentAt(0); | 1563 Definition* left = call->ArgumentAt(0); |
| 1563 Definition* type_args = call->ArgumentAt(1); | 1564 Definition* type_args = call->ArgumentAt(1); |
| 1564 const AbstractType& type = | 1565 const AbstractType& type = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1585 push->RemoveFromGraph(); | 1586 push->RemoveFromGraph(); |
| 1586 } | 1587 } |
| 1587 // Remove call, replace it with 'left'. | 1588 // Remove call, replace it with 'left'. |
| 1588 call->ReplaceUsesWith(left); | 1589 call->ReplaceUsesWith(left); |
| 1589 ASSERT(current_iterator()->Current() == call); | 1590 ASSERT(current_iterator()->Current() == call); |
| 1590 current_iterator()->RemoveCurrentFromGraph(); | 1591 current_iterator()->RemoveCurrentFromGraph(); |
| 1591 return; | 1592 return; |
| 1592 } | 1593 } |
| 1593 } | 1594 } |
| 1594 AssertAssignableInstr* assert_as = new (Z) AssertAssignableInstr( | 1595 AssertAssignableInstr* assert_as = new (Z) AssertAssignableInstr( |
| 1595 call->token_pos(), new (Z) Value(left), new (Z) Value(type_args), type, | 1596 call->token_pos(), new (Z) Value(left), new (Z) Value(type_args), |
| 1596 Symbols::InTypeCast(), call->deopt_id()); | 1597 NULL, // TODO(regis): Pass function type arguments. |
| 1598 type, Symbols::InTypeCast(), call->deopt_id()); |
| 1597 ReplaceCall(call, assert_as); | 1599 ReplaceCall(call, assert_as); |
| 1598 } | 1600 } |
| 1599 | 1601 |
| 1600 | 1602 |
| 1601 bool AotOptimizer::IsAllowedForInlining(intptr_t call_deopt_id) { | 1603 bool AotOptimizer::IsAllowedForInlining(intptr_t call_deopt_id) { |
| 1602 if (!use_speculative_inlining_) return false; | 1604 if (!use_speculative_inlining_) return false; |
| 1603 for (intptr_t i = 0; i < inlining_black_list_->length(); ++i) { | 1605 for (intptr_t i = 0; i < inlining_black_list_->length(); ++i) { |
| 1604 if ((*inlining_black_list_)[i] == call_deopt_id) return false; | 1606 if ((*inlining_black_list_)[i] == call_deopt_id) return false; |
| 1605 } | 1607 } |
| 1606 return true; | 1608 return true; |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 FlowGraph::kEffect); | 2132 FlowGraph::kEffect); |
| 2131 current_iterator()->RemoveCurrentFromGraph(); | 2133 current_iterator()->RemoveCurrentFromGraph(); |
| 2132 } | 2134 } |
| 2133 } | 2135 } |
| 2134 } | 2136 } |
| 2135 } | 2137 } |
| 2136 | 2138 |
| 2137 #endif // DART_PRECOMPILER | 2139 #endif // DART_PRECOMPILER |
| 2138 | 2140 |
| 2139 } // namespace dart | 2141 } // namespace dart |
| OLD | NEW |