| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 cid = kSmiCid; | 595 cid = kSmiCid; |
| 596 } else { | 596 } else { |
| 597 // Shortcut for equality with null. | 597 // Shortcut for equality with null. |
| 598 ConstantInstr* right_const = right->AsConstant(); | 598 ConstantInstr* right_const = right->AsConstant(); |
| 599 ConstantInstr* left_const = left->AsConstant(); | 599 ConstantInstr* left_const = left->AsConstant(); |
| 600 if ((right_const != NULL && right_const->value().IsNull()) || | 600 if ((right_const != NULL && right_const->value().IsNull()) || |
| 601 (left_const != NULL && left_const->value().IsNull())) { | 601 (left_const != NULL && left_const->value().IsNull())) { |
| 602 StrictCompareInstr* comp = new (Z) | 602 StrictCompareInstr* comp = new (Z) |
| 603 StrictCompareInstr(call->token_pos(), Token::kEQ_STRICT, | 603 StrictCompareInstr(call->token_pos(), Token::kEQ_STRICT, |
| 604 new (Z) Value(left), new (Z) Value(right), | 604 new (Z) Value(left), new (Z) Value(right), |
| 605 false); // No number check. | 605 /* number_check = */ false, Thread::kNoDeoptId); |
| 606 ReplaceCall(call, comp); | 606 ReplaceCall(call, comp); |
| 607 return true; | 607 return true; |
| 608 } | 608 } |
| 609 return false; | 609 return false; |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 ASSERT(cid != kIllegalCid); | 612 ASSERT(cid != kIllegalCid); |
| 613 EqualityCompareInstr* comp = new (Z) | 613 EqualityCompareInstr* comp = new (Z) |
| 614 EqualityCompareInstr(call->token_pos(), op_kind, new (Z) Value(left), | 614 EqualityCompareInstr(call->token_pos(), op_kind, new (Z) Value(left), |
| 615 new (Z) Value(right), cid, call->deopt_id()); | 615 new (Z) Value(right), cid, call->deopt_id()); |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 } | 1349 } |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 if (TypeCheckAsClassEquality(type)) { | 1352 if (TypeCheckAsClassEquality(type)) { |
| 1353 LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left)); | 1353 LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left)); |
| 1354 InsertBefore(call, left_cid, NULL, FlowGraph::kValue); | 1354 InsertBefore(call, left_cid, NULL, FlowGraph::kValue); |
| 1355 const intptr_t type_cid = Class::Handle(Z, type.type_class()).id(); | 1355 const intptr_t type_cid = Class::Handle(Z, type.type_class()).id(); |
| 1356 ConstantInstr* cid = | 1356 ConstantInstr* cid = |
| 1357 flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid))); | 1357 flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(type_cid))); |
| 1358 | 1358 |
| 1359 StrictCompareInstr* check_cid = | 1359 StrictCompareInstr* check_cid = new (Z) StrictCompareInstr( |
| 1360 new (Z) StrictCompareInstr(call->token_pos(), Token::kEQ_STRICT, | 1360 call->token_pos(), Token::kEQ_STRICT, new (Z) Value(left_cid), |
| 1361 new (Z) Value(left_cid), new (Z) Value(cid), | 1361 new (Z) Value(cid), /* number_check = */ false, Thread::kNoDeoptId); |
| 1362 false); // No number check. | |
| 1363 ReplaceCall(call, check_cid); | 1362 ReplaceCall(call, check_cid); |
| 1364 return; | 1363 return; |
| 1365 } | 1364 } |
| 1366 | 1365 |
| 1367 InstanceOfInstr* instance_of = new (Z) InstanceOfInstr( | 1366 InstanceOfInstr* instance_of = new (Z) InstanceOfInstr( |
| 1368 call->token_pos(), new (Z) Value(left), | 1367 call->token_pos(), new (Z) Value(left), |
| 1369 new (Z) Value(instantiator_type_args), new (Z) Value(function_type_args), | 1368 new (Z) Value(instantiator_type_args), new (Z) Value(function_type_args), |
| 1370 type, call->deopt_id()); | 1369 type, call->deopt_id()); |
| 1371 ReplaceCall(call, instance_of); | 1370 ReplaceCall(call, instance_of); |
| 1372 } | 1371 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1772 // Discard the environment from the original instruction because the store | 1771 // Discard the environment from the original instruction because the store |
| 1773 // can't deoptimize. | 1772 // can't deoptimize. |
| 1774 instr->RemoveEnvironment(); | 1773 instr->RemoveEnvironment(); |
| 1775 ReplaceCall(instr, store); | 1774 ReplaceCall(instr, store); |
| 1776 return true; | 1775 return true; |
| 1777 } | 1776 } |
| 1778 | 1777 |
| 1779 | 1778 |
| 1780 } // namespace dart | 1779 } // namespace dart |
| 1781 #endif // DART_PRECOMPILED_RUNTIME | 1780 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |