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

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

Issue 13125002: Fix checked mode crash when clearing reaching type of a value. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.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_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 20 matching lines...) Expand all
31 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress"); 31 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress");
32 DEFINE_FLAG(bool, truncating_left_shift, true, 32 DEFINE_FLAG(bool, truncating_left_shift, true,
33 "Optimize left shift to truncate if possible"); 33 "Optimize left shift to truncate if possible");
34 DEFINE_FLAG(bool, use_cha, true, "Use class hierarchy analysis."); 34 DEFINE_FLAG(bool, use_cha, true, "Use class hierarchy analysis.");
35 DECLARE_FLAG(bool, eliminate_type_checks); 35 DECLARE_FLAG(bool, eliminate_type_checks);
36 DECLARE_FLAG(bool, enable_type_checks); 36 DECLARE_FLAG(bool, enable_type_checks);
37 DECLARE_FLAG(bool, trace_type_check_elimination); 37 DECLARE_FLAG(bool, trace_type_check_elimination);
38 38
39 39
40 40
41 // Optimize instance calls using ICData.
41 void FlowGraphOptimizer::ApplyICData() { 42 void FlowGraphOptimizer::ApplyICData() {
42 VisitBlocks(); 43 VisitBlocks();
43 } 44 }
44 45
45 46
47 // Optimize instance calls using cid.
46 // Attempts to convert an instance call (IC call) using propagated class-ids, 48 // Attempts to convert an instance call (IC call) using propagated class-ids,
47 // e.g., receiver class id. 49 // e.g., receiver class id, guarded-cid.
48 void FlowGraphOptimizer::ApplyClassIds() { 50 void FlowGraphOptimizer::ApplyClassIds() {
49 ASSERT(current_iterator_ == NULL); 51 ASSERT(current_iterator_ == NULL);
50 for (intptr_t i = 0; i < block_order_.length(); ++i) { 52 for (intptr_t i = 0; i < block_order_.length(); ++i) {
51 BlockEntryInstr* entry = block_order_[i]; 53 BlockEntryInstr* entry = block_order_[i];
52 ForwardInstructionIterator it(entry); 54 ForwardInstructionIterator it(entry);
53 current_iterator_ = &it; 55 current_iterator_ = &it;
54 for (; !it.Done(); it.Advance()) { 56 for (; !it.Done(); it.Advance()) {
55 Instruction* instr = it.Current(); 57 Instruction* instr = it.Current();
56 if (instr->IsInstanceCall()) { 58 if (instr->IsInstanceCall()) {
57 InstanceCallInstr* call = instr->AsInstanceCall(); 59 InstanceCallInstr* call = instr->AsInstanceCall();
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 load->set_result_cid(field.guarded_cid()); 1200 load->set_result_cid(field.guarded_cid());
1199 } 1201 }
1200 load->set_field(&Field::ZoneHandle(field.raw())); 1202 load->set_field(&Field::ZoneHandle(field.raw()));
1201 } 1203 }
1202 load->set_field_name(String::Handle(field.name()).ToCString()); 1204 load->set_field_name(String::Handle(field.name()).ToCString());
1203 1205
1204 // Discard the environment from the original instruction because the load 1206 // Discard the environment from the original instruction because the load
1205 // can't deoptimize. 1207 // can't deoptimize.
1206 call->RemoveEnvironment(); 1208 call->RemoveEnvironment();
1207 ReplaceCall(call, load); 1209 ReplaceCall(call, load);
1210
1211 if (load->result_cid() != kDynamicCid) {
1212 // Reset value types if guarded_cid was used.
1213 for (Value::Iterator it(load->input_use_list()); !it.Done(); it.Advance()) {
1214 it.Current()->SetReachingType(NULL);
1215 }
1216 }
1208 } 1217 }
1209 1218
1210 1219
1211 void FlowGraphOptimizer::InlineArrayLengthGetter(InstanceCallInstr* call, 1220 void FlowGraphOptimizer::InlineArrayLengthGetter(InstanceCallInstr* call,
1212 intptr_t length_offset, 1221 intptr_t length_offset,
1213 bool is_immutable, 1222 bool is_immutable,
1214 MethodRecognizer::Kind kind) { 1223 MethodRecognizer::Kind kind) {
1215 AddReceiverCheck(call); 1224 AddReceiverCheck(call);
1216 1225
1217 LoadFieldInstr* load = new LoadFieldInstr( 1226 LoadFieldInstr* load = new LoadFieldInstr(
(...skipping 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after
4614 if (changed) { 4623 if (changed) {
4615 // We may have changed the block order and the dominator tree. 4624 // We may have changed the block order and the dominator tree.
4616 flow_graph->DiscoverBlocks(); 4625 flow_graph->DiscoverBlocks();
4617 GrowableArray<BitVector*> dominance_frontier; 4626 GrowableArray<BitVector*> dominance_frontier;
4618 flow_graph->ComputeDominators(&dominance_frontier); 4627 flow_graph->ComputeDominators(&dominance_frontier);
4619 } 4628 }
4620 } 4629 }
4621 4630
4622 4631
4623 } // namespace dart 4632 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698