| 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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 // Deoptimization may be needed if result does not always fit in a Smi. | 2174 // Deoptimization may be needed if result does not always fit in a Smi. |
| 2175 deopt_id = (kSmiBits >= 32) ? Thread::kNoDeoptId : call->deopt_id(); | 2175 deopt_id = (kSmiBits >= 32) ? Thread::kNoDeoptId : call->deopt_id(); |
| 2176 } | 2176 } |
| 2177 | 2177 |
| 2178 // Array load and return. | 2178 // Array load and return. |
| 2179 intptr_t index_scale = Instance::ElementSizeFor(array_cid); | 2179 intptr_t index_scale = Instance::ElementSizeFor(array_cid); |
| 2180 *last = new(Z) LoadIndexedInstr(new(Z) Value(array), | 2180 *last = new(Z) LoadIndexedInstr(new(Z) Value(array), |
| 2181 new(Z) Value(index), | 2181 new(Z) Value(index), |
| 2182 index_scale, | 2182 index_scale, |
| 2183 array_cid, | 2183 array_cid, |
| 2184 true, // aligned |
| 2184 deopt_id, | 2185 deopt_id, |
| 2185 call->token_pos()); | 2186 call->token_pos()); |
| 2186 cursor = flow_graph->AppendTo( | 2187 cursor = flow_graph->AppendTo( |
| 2187 cursor, | 2188 cursor, |
| 2188 *last, | 2189 *last, |
| 2189 deopt_id != Thread::kNoDeoptId ? call->env() : NULL, | 2190 deopt_id != Thread::kNoDeoptId ? call->env() : NULL, |
| 2190 FlowGraph::kValue); | 2191 FlowGraph::kValue); |
| 2191 | 2192 |
| 2192 if (array_cid == kTypedDataFloat32ArrayCid) { | 2193 if (array_cid == kTypedDataFloat32ArrayCid) { |
| 2193 *last = new(Z) FloatToDoubleInstr(new(Z) Value(*last), deopt_id); | 2194 *last = new(Z) FloatToDoubleInstr(new(Z) Value(*last), deopt_id); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 FlowGraph::kValue); | 2359 FlowGraph::kValue); |
| 2359 } | 2360 } |
| 2360 | 2361 |
| 2361 const intptr_t index_scale = Instance::ElementSizeFor(array_cid); | 2362 const intptr_t index_scale = Instance::ElementSizeFor(array_cid); |
| 2362 *last = new(Z) StoreIndexedInstr(new(Z) Value(array), | 2363 *last = new(Z) StoreIndexedInstr(new(Z) Value(array), |
| 2363 new(Z) Value(index), | 2364 new(Z) Value(index), |
| 2364 new(Z) Value(stored_value), | 2365 new(Z) Value(stored_value), |
| 2365 needs_store_barrier, | 2366 needs_store_barrier, |
| 2366 index_scale, | 2367 index_scale, |
| 2367 array_cid, | 2368 array_cid, |
| 2369 true, // aligned |
| 2368 call->deopt_id(), | 2370 call->deopt_id(), |
| 2369 call->token_pos()); | 2371 call->token_pos()); |
| 2370 flow_graph->AppendTo(cursor, | 2372 flow_graph->AppendTo(cursor, |
| 2371 *last, | 2373 *last, |
| 2372 call->env(), | 2374 call->env(), |
| 2373 FlowGraph::kEffect); | 2375 FlowGraph::kEffect); |
| 2374 return true; | 2376 return true; |
| 2375 } | 2377 } |
| 2376 | 2378 |
| 2377 | 2379 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2588 if ((array_cid == kTypedDataInt32ArrayCid) || | 2590 if ((array_cid == kTypedDataInt32ArrayCid) || |
| 2589 (array_cid == kTypedDataUint32ArrayCid)) { | 2591 (array_cid == kTypedDataUint32ArrayCid)) { |
| 2590 // Deoptimization may be needed if result does not always fit in a Smi. | 2592 // Deoptimization may be needed if result does not always fit in a Smi. |
| 2591 deopt_id = (kSmiBits >= 32) ? Thread::kNoDeoptId : call->deopt_id(); | 2593 deopt_id = (kSmiBits >= 32) ? Thread::kNoDeoptId : call->deopt_id(); |
| 2592 } | 2594 } |
| 2593 | 2595 |
| 2594 *last = new(Z) LoadIndexedInstr(new(Z) Value(array), | 2596 *last = new(Z) LoadIndexedInstr(new(Z) Value(array), |
| 2595 new(Z) Value(index), | 2597 new(Z) Value(index), |
| 2596 1, | 2598 1, |
| 2597 view_cid, | 2599 view_cid, |
| 2600 false, // aligned |
| 2598 deopt_id, | 2601 deopt_id, |
| 2599 call->token_pos()); | 2602 call->token_pos()); |
| 2600 cursor = flow_graph->AppendTo( | 2603 cursor = flow_graph->AppendTo( |
| 2601 cursor, | 2604 cursor, |
| 2602 *last, | 2605 *last, |
| 2603 deopt_id != Thread::kNoDeoptId ? call->env() : NULL, | 2606 deopt_id != Thread::kNoDeoptId ? call->env() : NULL, |
| 2604 FlowGraph::kValue); | 2607 FlowGraph::kValue); |
| 2605 | 2608 |
| 2606 if (view_cid == kTypedDataFloat32ArrayCid) { | 2609 if (view_cid == kTypedDataFloat32ArrayCid) { |
| 2607 *last = new(Z) FloatToDoubleInstr(new(Z) Value(*last), deopt_id); | 2610 *last = new(Z) FloatToDoubleInstr(new(Z) Value(*last), deopt_id); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2759 FlowGraph::kValue); | 2762 FlowGraph::kValue); |
| 2760 } | 2763 } |
| 2761 | 2764 |
| 2762 StoreBarrierType needs_store_barrier = kNoStoreBarrier; | 2765 StoreBarrierType needs_store_barrier = kNoStoreBarrier; |
| 2763 *last = new(Z) StoreIndexedInstr(new(Z) Value(array), | 2766 *last = new(Z) StoreIndexedInstr(new(Z) Value(array), |
| 2764 new(Z) Value(index), | 2767 new(Z) Value(index), |
| 2765 new(Z) Value(stored_value), | 2768 new(Z) Value(stored_value), |
| 2766 needs_store_barrier, | 2769 needs_store_barrier, |
| 2767 1, // Index scale | 2770 1, // Index scale |
| 2768 view_cid, | 2771 view_cid, |
| 2772 false, // aligned |
| 2769 call->deopt_id(), | 2773 call->deopt_id(), |
| 2770 call->token_pos()); | 2774 call->token_pos()); |
| 2771 | 2775 |
| 2772 flow_graph->AppendTo(cursor, | 2776 flow_graph->AppendTo(cursor, |
| 2773 *last, | 2777 *last, |
| 2774 call->deopt_id() != Thread::kNoDeoptId ? | 2778 call->deopt_id() != Thread::kNoDeoptId ? |
| 2775 call->env() : NULL, | 2779 call->env() : NULL, |
| 2776 FlowGraph::kEffect); | 2780 FlowGraph::kEffect); |
| 2777 return true; | 2781 return true; |
| 2778 } | 2782 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2827 new Value(str), | 2831 new Value(str), |
| 2828 RawExternalTwoByteString::ExternalData::data_offset()); | 2832 RawExternalTwoByteString::ExternalData::data_offset()); |
| 2829 cursor = flow_graph->AppendTo(cursor, str, NULL, FlowGraph::kValue); | 2833 cursor = flow_graph->AppendTo(cursor, str, NULL, FlowGraph::kValue); |
| 2830 } | 2834 } |
| 2831 | 2835 |
| 2832 LoadIndexedInstr* load_indexed = new(Z) LoadIndexedInstr( | 2836 LoadIndexedInstr* load_indexed = new(Z) LoadIndexedInstr( |
| 2833 new(Z) Value(str), | 2837 new(Z) Value(str), |
| 2834 new(Z) Value(index), | 2838 new(Z) Value(index), |
| 2835 Instance::ElementSizeFor(cid), | 2839 Instance::ElementSizeFor(cid), |
| 2836 cid, | 2840 cid, |
| 2841 true, // aligned |
| 2837 Thread::kNoDeoptId, | 2842 Thread::kNoDeoptId, |
| 2838 call->token_pos()); | 2843 call->token_pos()); |
| 2839 | 2844 |
| 2840 cursor = flow_graph->AppendTo(cursor, load_indexed, NULL, FlowGraph::kValue); | 2845 cursor = flow_graph->AppendTo(cursor, load_indexed, NULL, FlowGraph::kValue); |
| 2841 ASSERT(cursor == load_indexed); | 2846 ASSERT(cursor == load_indexed); |
| 2842 return load_indexed; | 2847 return load_indexed; |
| 2843 } | 2848 } |
| 2844 | 2849 |
| 2845 | 2850 |
| 2846 static bool InlineStringBaseCharAt( | 2851 static bool InlineStringBaseCharAt( |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3819 Definition* str = call->ArgumentAt(0); | 3824 Definition* str = call->ArgumentAt(0); |
| 3820 Definition* index = call->ArgumentAt(1); | 3825 Definition* index = call->ArgumentAt(1); |
| 3821 Definition* value = call->ArgumentAt(2); | 3826 Definition* value = call->ArgumentAt(2); |
| 3822 *last = new(Z) StoreIndexedInstr( | 3827 *last = new(Z) StoreIndexedInstr( |
| 3823 new(Z) Value(str), | 3828 new(Z) Value(str), |
| 3824 new(Z) Value(index), | 3829 new(Z) Value(index), |
| 3825 new(Z) Value(value), | 3830 new(Z) Value(value), |
| 3826 kNoStoreBarrier, | 3831 kNoStoreBarrier, |
| 3827 1, // Index scale | 3832 1, // Index scale |
| 3828 kOneByteStringCid, | 3833 kOneByteStringCid, |
| 3834 true, // aligned |
| 3829 call->deopt_id(), | 3835 call->deopt_id(), |
| 3830 call->token_pos()); | 3836 call->token_pos()); |
| 3831 flow_graph->AppendTo(*entry, | 3837 flow_graph->AppendTo(*entry, |
| 3832 *last, | 3838 *last, |
| 3833 call->deopt_id() != Thread::kNoDeoptId ? | 3839 call->deopt_id() != Thread::kNoDeoptId ? |
| 3834 call->env() : NULL, | 3840 call->env() : NULL, |
| 3835 FlowGraph::kEffect); | 3841 FlowGraph::kEffect); |
| 3836 return true; | 3842 return true; |
| 3837 } | 3843 } |
| 3838 | 3844 |
| 3839 default: | 3845 default: |
| 3840 return false; | 3846 return false; |
| 3841 } | 3847 } |
| 3842 } | 3848 } |
| 3843 | 3849 |
| 3844 | 3850 |
| 3845 } // namespace dart | 3851 } // namespace dart |
| OLD | NEW |