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