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 | |
2405 static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, | 2433 static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, |
2406 Instruction* call, | 2434 Instruction* call, |
2407 TargetEntryInstr** entry, | 2435 TargetEntryInstr** entry, |
2408 Definition** last) { | 2436 Definition** last) { |
2409 Definition* left = call->ArgumentAt(0); | 2437 Definition* left = call->ArgumentAt(0); |
2410 Definition* right = call->ArgumentAt(1); | 2438 Definition* right = call->ArgumentAt(1); |
2411 | 2439 |
2412 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), | 2440 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
2413 call->GetBlock()->try_index()); | 2441 call->GetBlock()->try_index()); |
2414 (*entry)->InheritDeoptTarget(Z, call); | 2442 (*entry)->InheritDeoptTarget(Z, call); |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3642 return InlineStringBaseCharAt( | 3670 return InlineStringBaseCharAt( |
3643 flow_graph, call, receiver_cid, entry, last); | 3671 flow_graph, call, receiver_cid, entry, last); |
3644 case MethodRecognizer::kDoubleAdd: | 3672 case MethodRecognizer::kDoubleAdd: |
3645 return InlineDoubleOp(flow_graph, Token::kADD, call, entry, last); | 3673 return InlineDoubleOp(flow_graph, Token::kADD, call, entry, last); |
3646 case MethodRecognizer::kDoubleSub: | 3674 case MethodRecognizer::kDoubleSub: |
3647 return InlineDoubleOp(flow_graph, Token::kSUB, call, entry, last); | 3675 return InlineDoubleOp(flow_graph, Token::kSUB, call, entry, last); |
3648 case MethodRecognizer::kDoubleMul: | 3676 case MethodRecognizer::kDoubleMul: |
3649 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last); | 3677 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last); |
3650 case MethodRecognizer::kDoubleDiv: | 3678 case MethodRecognizer::kDoubleDiv: |
3651 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last); | 3679 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last); |
3680 case MethodRecognizer::kDoubleIsNaN: | |
Florian Schneider
2016/10/18 20:34:20
Handle DoubleIsNegative?
zra
2016/10/18 22:36:32
Acknowledged.
| |
3681 case MethodRecognizer::kDoubleIsInfinite: | |
3682 return InlineDoubleTestOp(flow_graph, call, kind, entry, last); | |
3652 case MethodRecognizer::kGrowableArraySetData: | 3683 case MethodRecognizer::kGrowableArraySetData: |
3653 ASSERT(receiver_cid == kGrowableObjectArrayCid); | 3684 ASSERT(receiver_cid == kGrowableObjectArrayCid); |
3654 ASSERT(ic_data.NumberOfChecks() == 1); | 3685 ASSERT(ic_data.NumberOfChecks() == 1); |
3655 return InlineGrowableArraySetter( | 3686 return InlineGrowableArraySetter( |
3656 flow_graph, GrowableObjectArray::data_offset(), kEmitStoreBarrier, | 3687 flow_graph, GrowableObjectArray::data_offset(), kEmitStoreBarrier, |
3657 call, entry, last); | 3688 call, entry, last); |
3658 case MethodRecognizer::kGrowableArraySetLength: | 3689 case MethodRecognizer::kGrowableArraySetLength: |
3659 ASSERT(receiver_cid == kGrowableObjectArrayCid); | 3690 ASSERT(receiver_cid == kGrowableObjectArrayCid); |
3660 ASSERT(ic_data.NumberOfChecks() == 1); | 3691 ASSERT(ic_data.NumberOfChecks() == 1); |
3661 return InlineGrowableArraySetter( | 3692 return InlineGrowableArraySetter( |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3805 return true; | 3836 return true; |
3806 } | 3837 } |
3807 | 3838 |
3808 default: | 3839 default: |
3809 return false; | 3840 return false; |
3810 } | 3841 } |
3811 } | 3842 } |
3812 | 3843 |
3813 | 3844 |
3814 } // namespace dart | 3845 } // namespace dart |
OLD | NEW |