| 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 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2453 new(Z) Value(left), | 2453 new(Z) Value(left), |
| 2454 new(Z) Value(right), | 2454 new(Z) Value(right), |
| 2455 call->deopt_id(), call->token_pos()); | 2455 call->deopt_id(), call->token_pos()); |
| 2456 flow_graph->AppendTo(*entry, double_bin_op, call->env(), FlowGraph::kValue); | 2456 flow_graph->AppendTo(*entry, double_bin_op, call->env(), FlowGraph::kValue); |
| 2457 *last = double_bin_op; | 2457 *last = double_bin_op; |
| 2458 | 2458 |
| 2459 return true; | 2459 return true; |
| 2460 } | 2460 } |
| 2461 | 2461 |
| 2462 | 2462 |
| 2463 static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph, |
| 2464 Instruction* call, |
| 2465 TargetEntryInstr** entry, |
| 2466 Definition** last) { |
| 2467 Definition* left = call->ArgumentAt(0); |
| 2468 Definition* right = call->ArgumentAt(1); |
| 2469 |
| 2470 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
| 2471 call->GetBlock()->try_index()); |
| 2472 (*entry)->InheritDeoptTarget(Z, call); |
| 2473 // Right arguments is known to be smi: other._bitAndFromSmi(this); |
| 2474 BinarySmiOpInstr* smi_op = |
| 2475 new(Z) BinarySmiOpInstr(Token::kBIT_AND, |
| 2476 new(Z) Value(left), |
| 2477 new(Z) Value(right), |
| 2478 call->deopt_id()); |
| 2479 flow_graph->AppendTo(*entry, smi_op, call->env(), FlowGraph::kValue); |
| 2480 *last = smi_op; |
| 2481 |
| 2482 return true; |
| 2483 } |
| 2484 |
| 2485 |
| 2463 static bool InlineGrowableArraySetter(FlowGraph* flow_graph, | 2486 static bool InlineGrowableArraySetter(FlowGraph* flow_graph, |
| 2464 intptr_t offset, | 2487 intptr_t offset, |
| 2465 StoreBarrierType store_barrier_type, | 2488 StoreBarrierType store_barrier_type, |
| 2466 Instruction* call, | 2489 Instruction* call, |
| 2467 TargetEntryInstr** entry, | 2490 TargetEntryInstr** entry, |
| 2468 Definition** last) { | 2491 Definition** last) { |
| 2469 Definition* array = call->ArgumentAt(0); | 2492 Definition* array = call->ArgumentAt(0); |
| 2470 Definition* value = call->ArgumentAt(1); | 2493 Definition* value = call->ArgumentAt(1); |
| 2471 | 2494 |
| 2472 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), | 2495 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3220 ASSERT(ic_data.NumberOfChecks() == 1); | 3243 ASSERT(ic_data.NumberOfChecks() == 1); |
| 3221 return InlineGrowableArraySetter( | 3244 return InlineGrowableArraySetter( |
| 3222 flow_graph, GrowableObjectArray::data_offset(), kEmitStoreBarrier, | 3245 flow_graph, GrowableObjectArray::data_offset(), kEmitStoreBarrier, |
| 3223 call, entry, last); | 3246 call, entry, last); |
| 3224 case MethodRecognizer::kGrowableArraySetLength: | 3247 case MethodRecognizer::kGrowableArraySetLength: |
| 3225 ASSERT(receiver_cid == kGrowableObjectArrayCid); | 3248 ASSERT(receiver_cid == kGrowableObjectArrayCid); |
| 3226 ASSERT(ic_data.NumberOfChecks() == 1); | 3249 ASSERT(ic_data.NumberOfChecks() == 1); |
| 3227 return InlineGrowableArraySetter( | 3250 return InlineGrowableArraySetter( |
| 3228 flow_graph, GrowableObjectArray::length_offset(), kNoStoreBarrier, | 3251 flow_graph, GrowableObjectArray::length_offset(), kNoStoreBarrier, |
| 3229 call, entry, last); | 3252 call, entry, last); |
| 3253 case MethodRecognizer::kSmi_bitAndFromSmi: |
| 3254 return InlineSmiBitAndFromSmi(flow_graph, call, entry, last); |
| 3230 default: | 3255 default: |
| 3231 return false; | 3256 return false; |
| 3232 } | 3257 } |
| 3233 } | 3258 } |
| 3234 | 3259 |
| 3235 | 3260 |
| 3236 } // namespace dart | 3261 } // namespace dart |
| OLD | NEW |