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/flow_graph_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
6 | 6 |
7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
8 #include "vm/block_scheduler.h" | 8 #include "vm/block_scheduler.h" |
9 #include "vm/branch_optimizer.h" | 9 #include "vm/branch_optimizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2395 new(Z) Value(left), | 2395 new(Z) Value(left), |
2396 new(Z) Value(right), | 2396 new(Z) Value(right), |
2397 call->deopt_id(), call->token_pos()); | 2397 call->deopt_id(), call->token_pos()); |
2398 flow_graph->AppendTo(*entry, double_bin_op, call->env(), FlowGraph::kValue); | 2398 flow_graph->AppendTo(*entry, double_bin_op, call->env(), FlowGraph::kValue); |
2399 *last = double_bin_op; | 2399 *last = double_bin_op; |
2400 | 2400 |
2401 return true; | 2401 return true; |
2402 } | 2402 } |
2403 | 2403 |
2404 | 2404 |
2405 static bool InlineDoubleTestOp(FlowGraph* flow_graph, | |
2406 Instruction* call, | |
2407 MethodRecognizer::Kind kind, | |
2408 TargetEntryInstr** entry, | |
2409 Definition** last) { | |
2410 if (!CanUnboxDouble()) { | |
2411 return false; | |
2412 } | |
2413 Definition* d = call->ArgumentAt(0); | |
2414 | |
2415 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), | |
2416 call->GetBlock()->try_index()); | |
2417 (*entry)->InheritDeoptTarget(Z, call); | |
2418 // Arguments are checked. No need for class check. | |
2419 | |
2420 DoubleTestOpInstr* double_test_op = | |
2421 new(Z) DoubleTestOpInstr(kind, | |
2422 new(Z) Value(d), | |
2423 call->deopt_id(), | |
2424 call->token_pos()); | |
2425 flow_graph->AppendTo( | |
2426 *entry, double_test_op, call->env(), FlowGraph::kValue); | |
2427 *last = double_test_op; | |
2428 | |
2429 return true; | |
2430 } | |
2431 | |
2432 | |
2433 static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, | 2405 static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, |
2434 Instruction* call, | 2406 Instruction* call, |
2435 TargetEntryInstr** entry, | 2407 TargetEntryInstr** entry, |
2436 Definition** last) { | 2408 Definition** last) { |
2437 Definition* left = call->ArgumentAt(0); | 2409 Definition* left = call->ArgumentAt(0); |
2438 Definition* right = call->ArgumentAt(1); | 2410 Definition* right = call->ArgumentAt(1); |
2439 | 2411 |
2440 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), | 2412 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
2441 call->GetBlock()->try_index()); | 2413 call->GetBlock()->try_index()); |
2442 (*entry)->InheritDeoptTarget(Z, call); | 2414 (*entry)->InheritDeoptTarget(Z, call); |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3670 return InlineStringBaseCharAt( | 3642 return InlineStringBaseCharAt( |
3671 flow_graph, call, receiver_cid, entry, last); | 3643 flow_graph, call, receiver_cid, entry, last); |
3672 case MethodRecognizer::kDoubleAdd: | 3644 case MethodRecognizer::kDoubleAdd: |
3673 return InlineDoubleOp(flow_graph, Token::kADD, call, entry, last); | 3645 return InlineDoubleOp(flow_graph, Token::kADD, call, entry, last); |
3674 case MethodRecognizer::kDoubleSub: | 3646 case MethodRecognizer::kDoubleSub: |
3675 return InlineDoubleOp(flow_graph, Token::kSUB, call, entry, last); | 3647 return InlineDoubleOp(flow_graph, Token::kSUB, call, entry, last); |
3676 case MethodRecognizer::kDoubleMul: | 3648 case MethodRecognizer::kDoubleMul: |
3677 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last); | 3649 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last); |
3678 case MethodRecognizer::kDoubleDiv: | 3650 case MethodRecognizer::kDoubleDiv: |
3679 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last); | 3651 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last); |
3680 case MethodRecognizer::kDouble_getIsNaN: | |
3681 case MethodRecognizer::kDouble_getIsInfinite: | |
3682 return InlineDoubleTestOp(flow_graph, call, kind, entry, last); | |
3683 case MethodRecognizer::kGrowableArraySetData: | 3652 case MethodRecognizer::kGrowableArraySetData: |
3684 ASSERT(receiver_cid == kGrowableObjectArrayCid); | 3653 ASSERT(receiver_cid == kGrowableObjectArrayCid); |
3685 ASSERT(ic_data.NumberOfChecks() == 1); | 3654 ASSERT(ic_data.NumberOfChecks() == 1); |
3686 return InlineGrowableArraySetter( | 3655 return InlineGrowableArraySetter( |
3687 flow_graph, GrowableObjectArray::data_offset(), kEmitStoreBarrier, | 3656 flow_graph, GrowableObjectArray::data_offset(), kEmitStoreBarrier, |
3688 call, entry, last); | 3657 call, entry, last); |
3689 case MethodRecognizer::kGrowableArraySetLength: | 3658 case MethodRecognizer::kGrowableArraySetLength: |
3690 ASSERT(receiver_cid == kGrowableObjectArrayCid); | 3659 ASSERT(receiver_cid == kGrowableObjectArrayCid); |
3691 ASSERT(ic_data.NumberOfChecks() == 1); | 3660 ASSERT(ic_data.NumberOfChecks() == 1); |
3692 return InlineGrowableArraySetter( | 3661 return InlineGrowableArraySetter( |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3836 return true; | 3805 return true; |
3837 } | 3806 } |
3838 | 3807 |
3839 default: | 3808 default: |
3840 return false; | 3809 return false; |
3841 } | 3810 } |
3842 } | 3811 } |
3843 | 3812 |
3844 | 3813 |
3845 } // namespace dart | 3814 } // namespace dart |
OLD | NEW |