Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: runtime/vm/flow_graph_inliner.cc

Issue 2152683003: Revert "VM: Array bounds checks that don't deoptimize for precompiled code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/constant_propagator.cc ('k') | runtime/vm/flow_graph_type_propagator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 // Quick access to the current one. 2040 // Quick access to the current one.
2041 #undef Z 2041 #undef Z
2042 #define Z (flow_graph->zone()) 2042 #define Z (flow_graph->zone())
2043 2043
2044 static intptr_t PrepareInlineIndexedOp(FlowGraph* flow_graph, 2044 static intptr_t PrepareInlineIndexedOp(FlowGraph* flow_graph,
2045 Instruction* call, 2045 Instruction* call,
2046 intptr_t array_cid, 2046 intptr_t array_cid,
2047 Definition** array, 2047 Definition** array,
2048 Definition* index, 2048 Definition* index,
2049 Instruction** cursor) { 2049 Instruction** cursor) {
2050 // Insert index smi check.
2051 *cursor = flow_graph->AppendTo(
2052 *cursor,
2053 new(Z) CheckSmiInstr(new(Z) Value(index),
2054 call->deopt_id(),
2055 call->token_pos()),
2056 call->env(),
2057 FlowGraph::kEffect);
2058
2050 // Insert array length load and bounds check. 2059 // Insert array length load and bounds check.
2051 LoadFieldInstr* length = 2060 LoadFieldInstr* length =
2052 new(Z) LoadFieldInstr( 2061 new(Z) LoadFieldInstr(
2053 new(Z) Value(*array), 2062 new(Z) Value(*array),
2054 CheckArrayBoundInstr::LengthOffsetFor(array_cid), 2063 CheckArrayBoundInstr::LengthOffsetFor(array_cid),
2055 Type::ZoneHandle(Z, Type::SmiType()), 2064 Type::ZoneHandle(Z, Type::SmiType()),
2056 call->token_pos()); 2065 call->token_pos());
2057 length->set_is_immutable( 2066 length->set_is_immutable(
2058 CheckArrayBoundInstr::IsFixedLengthArrayType(array_cid)); 2067 CheckArrayBoundInstr::IsFixedLengthArrayType(array_cid));
2059 length->set_result_cid(kSmiCid); 2068 length->set_result_cid(kSmiCid);
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 2513
2505 2514
2506 static intptr_t PrepareInlineByteArrayBaseOp( 2515 static intptr_t PrepareInlineByteArrayBaseOp(
2507 FlowGraph* flow_graph, 2516 FlowGraph* flow_graph,
2508 Instruction* call, 2517 Instruction* call,
2509 intptr_t array_cid, 2518 intptr_t array_cid,
2510 intptr_t view_cid, 2519 intptr_t view_cid,
2511 Definition** array, 2520 Definition** array,
2512 Definition* byte_index, 2521 Definition* byte_index,
2513 Instruction** cursor) { 2522 Instruction** cursor) {
2523 // Insert byte_index smi check.
2524 *cursor = flow_graph->AppendTo(*cursor,
2525 new(Z) CheckSmiInstr(
2526 new(Z) Value(byte_index),
2527 call->deopt_id(),
2528 call->token_pos()),
2529 call->env(),
2530 FlowGraph::kEffect);
2531
2514 LoadFieldInstr* length = 2532 LoadFieldInstr* length =
2515 new(Z) LoadFieldInstr( 2533 new(Z) LoadFieldInstr(
2516 new(Z) Value(*array), 2534 new(Z) Value(*array),
2517 CheckArrayBoundInstr::LengthOffsetFor(array_cid), 2535 CheckArrayBoundInstr::LengthOffsetFor(array_cid),
2518 Type::ZoneHandle(Z, Type::SmiType()), 2536 Type::ZoneHandle(Z, Type::SmiType()),
2519 call->token_pos()); 2537 call->token_pos());
2520 length->set_is_immutable(true); 2538 length->set_is_immutable(true);
2521 length->set_result_cid(kSmiCid); 2539 length->set_result_cid(kSmiCid);
2522 length->set_recognized_kind( 2540 length->set_recognized_kind(
2523 LoadFieldInstr::RecognizedKindFromArrayCid(array_cid)); 2541 LoadFieldInstr::RecognizedKindFromArrayCid(array_cid));
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 2822
2805 2823
2806 // Returns the LoadIndexedInstr. 2824 // Returns the LoadIndexedInstr.
2807 static Definition* PrepareInlineStringIndexOp( 2825 static Definition* PrepareInlineStringIndexOp(
2808 FlowGraph* flow_graph, 2826 FlowGraph* flow_graph,
2809 Instruction* call, 2827 Instruction* call,
2810 intptr_t cid, 2828 intptr_t cid,
2811 Definition* str, 2829 Definition* str,
2812 Definition* index, 2830 Definition* index,
2813 Instruction* cursor) { 2831 Instruction* cursor) {
2832
2833 cursor = flow_graph->AppendTo(cursor,
2834 new(Z) CheckSmiInstr(
2835 new(Z) Value(index),
2836 call->deopt_id(),
2837 call->token_pos()),
2838 call->env(),
2839 FlowGraph::kEffect);
2840
2814 // Load the length of the string. 2841 // Load the length of the string.
2815 // Treat length loads as mutable (i.e. affected by side effects) to avoid 2842 // Treat length loads as mutable (i.e. affected by side effects) to avoid
2816 // hoisting them since we can't hoist the preceding class-check. This 2843 // hoisting them since we can't hoist the preceding class-check. This
2817 // is because of externalization of strings that affects their class-id. 2844 // is because of externalization of strings that affects their class-id.
2818 LoadFieldInstr* length = new(Z) LoadFieldInstr( 2845 LoadFieldInstr* length = new(Z) LoadFieldInstr(
2819 new(Z) Value(str), 2846 new(Z) Value(str),
2820 String::length_offset(), 2847 String::length_offset(),
2821 Type::ZoneHandle(Z, Type::SmiType()), 2848 Type::ZoneHandle(Z, Type::SmiType()),
2822 str->token_pos()); 2849 str->token_pos());
2823 length->set_result_cid(kSmiCid); 2850 length->set_result_cid(kSmiCid);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 call, entry, last); 3254 call, entry, last);
3228 case MethodRecognizer::kSmi_bitAndFromSmi: 3255 case MethodRecognizer::kSmi_bitAndFromSmi:
3229 return InlineSmiBitAndFromSmi(flow_graph, call, entry, last); 3256 return InlineSmiBitAndFromSmi(flow_graph, call, entry, last);
3230 default: 3257 default:
3231 return false; 3258 return false;
3232 } 3259 }
3233 } 3260 }
3234 3261
3235 3262
3236 } // namespace dart 3263 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/constant_propagator.cc ('k') | runtime/vm/flow_graph_type_propagator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698