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 #ifndef DART_PRECOMPILED_RUNTIME | 4 #ifndef DART_PRECOMPILED_RUNTIME |
5 #include "vm/jit_optimizer.h" | 5 #include "vm/jit_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 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 } | 1536 } |
1537 | 1537 |
1538 if (Token::IsTypeCastOperator(op_kind)) { | 1538 if (Token::IsTypeCastOperator(op_kind)) { |
1539 ReplaceWithTypeCast(instr); | 1539 ReplaceWithTypeCast(instr); |
1540 return; | 1540 return; |
1541 } | 1541 } |
1542 | 1542 |
1543 const ICData& unary_checks = | 1543 const ICData& unary_checks = |
1544 ICData::ZoneHandle(Z, instr->ic_data()->AsUnaryClassChecks()); | 1544 ICData::ZoneHandle(Z, instr->ic_data()->AsUnaryClassChecks()); |
1545 | 1545 |
| 1546 const bool is_dense = CheckClassInstr::IsDenseCidRange(unary_checks); |
| 1547 const intptr_t number_of_checks = unary_checks.NumberOfChecks(); |
| 1548 if (op_kind == Token::kEQ && |
| 1549 number_of_checks > FLAG_max_equality_polymorphic_checks && !is_dense && |
| 1550 flow_graph()->InstanceCallNeedsClassCheck( |
| 1551 instr, RawFunction::kRegularFunction)) { |
| 1552 // Too many checks, it will be megamorphic which needs unary checks. |
| 1553 instr->set_ic_data(&unary_checks); |
| 1554 return; |
| 1555 } |
| 1556 |
1546 if ((op_kind == Token::kASSIGN_INDEX) && TryReplaceWithIndexedOp(instr)) { | 1557 if ((op_kind == Token::kASSIGN_INDEX) && TryReplaceWithIndexedOp(instr)) { |
1547 return; | 1558 return; |
1548 } | 1559 } |
1549 if ((op_kind == Token::kINDEX) && TryReplaceWithIndexedOp(instr)) { | 1560 if ((op_kind == Token::kINDEX) && TryReplaceWithIndexedOp(instr)) { |
1550 return; | 1561 return; |
1551 } | 1562 } |
1552 | 1563 |
1553 if (op_kind == Token::kEQ && TryReplaceWithEqualityOp(instr, op_kind)) { | 1564 if (op_kind == Token::kEQ && TryReplaceWithEqualityOp(instr, op_kind)) { |
1554 return; | 1565 return; |
1555 } | 1566 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 // Discard the environment from the original instruction because the store | 1881 // Discard the environment from the original instruction because the store |
1871 // can't deoptimize. | 1882 // can't deoptimize. |
1872 instr->RemoveEnvironment(); | 1883 instr->RemoveEnvironment(); |
1873 ReplaceCall(instr, store); | 1884 ReplaceCall(instr, store); |
1874 return true; | 1885 return true; |
1875 } | 1886 } |
1876 | 1887 |
1877 | 1888 |
1878 } // namespace dart | 1889 } // namespace dart |
1879 #endif // DART_PRECOMPILED_RUNTIME | 1890 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |