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

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

Issue 13529021: Fix guarded_cid handling: add field to list of guarded_field at LoadField creation time. (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/flow_graph.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Transform to SSA (virtual register 0 and no inlining arguments). 160 // Transform to SSA (virtual register 0 and no inlining arguments).
161 flow_graph->ComputeSSA(0, NULL); 161 flow_graph->ComputeSSA(0, NULL);
162 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 162 DEBUG_ASSERT(flow_graph->VerifyUseLists());
163 } 163 }
164 164
165 if (FLAG_print_flow_graph || 165 if (FLAG_print_flow_graph ||
166 (optimized && FLAG_print_flow_graph_optimized)) { 166 (optimized && FLAG_print_flow_graph_optimized)) {
167 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); 167 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
168 } 168 }
169 169
170 const ZoneGrowableArray<Field*>* guarded_fields = NULL; 170 GrowableArray<Field*> guarded_fields(10);
Vyacheslav Egorov (Google) 2013/04/05 19:35:00 Please move a comment that was on FieldDependencie
srdjan 2013/04/05 20:41:24 Done.
171
172 if (optimized) { 171 if (optimized) {
173 TimerScope timer(FLAG_compiler_stats, 172 TimerScope timer(FLAG_compiler_stats,
174 &CompilerStats::graphoptimizer_timer, 173 &CompilerStats::graphoptimizer_timer,
175 isolate); 174 isolate);
176 175
177 FlowGraphOptimizer optimizer(flow_graph); 176 FlowGraphOptimizer optimizer(flow_graph, &guarded_fields);
178 optimizer.ApplyICData(); 177 optimizer.ApplyICData();
179 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 178 DEBUG_ASSERT(flow_graph->VerifyUseLists());
180 179
181 // Optimize (a << b) & c patterns. Must occur before 180 // Optimize (a << b) & c patterns. Must occur before
182 // 'SelectRepresentations' which inserts conversion nodes. 181 // 'SelectRepresentations' which inserts conversion nodes.
183 // TODO(srdjan): Moved before inlining until environment use list can 182 // TODO(srdjan): Moved before inlining until environment use list can
184 // be used to detect when shift-left is outside the scope of bit-and. 183 // be used to detect when shift-left is outside the scope of bit-and.
185 optimizer.TryOptimizeLeftShiftWithBitAndPattern(); 184 optimizer.TryOptimizeLeftShiftWithBitAndPattern();
186 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 185 DEBUG_ASSERT(flow_graph->VerifyUseLists());
187 186
188 // Inlining (mutates the flow graph) 187 // Inlining (mutates the flow graph)
189 if (FLAG_use_inlining) { 188 if (FLAG_use_inlining) {
190 TimerScope timer(FLAG_compiler_stats, 189 TimerScope timer(FLAG_compiler_stats,
191 &CompilerStats::graphinliner_timer); 190 &CompilerStats::graphinliner_timer);
192 FlowGraphInliner inliner(flow_graph); 191 FlowGraphInliner inliner(flow_graph, &guarded_fields);
193 inliner.Inline(); 192 inliner.Inline();
194 // Use lists are maintained and validated by the inliner. 193 // Use lists are maintained and validated by the inliner.
195 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 194 DEBUG_ASSERT(flow_graph->VerifyUseLists());
196 } 195 }
197 196
198 guarded_fields = flow_graph->FieldDependencies();
199
200 // Propagate types and eliminate more type tests. 197 // Propagate types and eliminate more type tests.
201 if (FLAG_propagate_types) { 198 if (FLAG_propagate_types) {
202 FlowGraphTypePropagator propagator(flow_graph); 199 FlowGraphTypePropagator propagator(flow_graph);
203 propagator.Propagate(); 200 propagator.Propagate();
204 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 201 DEBUG_ASSERT(flow_graph->VerifyUseLists());
205 } 202 }
206 203
207 // Use propagated class-ids to optimize further. 204 // Use propagated class-ids to optimize further.
208 optimizer.ApplyClassIds(); 205 optimizer.ApplyClassIds();
209 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 206 DEBUG_ASSERT(flow_graph->VerifyUseLists());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 graph_compiler.FinalizeStaticCallTargetsTable(code); 315 graph_compiler.FinalizeStaticCallTargetsTable(code);
319 316
320 if (optimized) { 317 if (optimized) {
321 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); 318 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode()));
322 function.SetCode(code); 319 function.SetCode(code);
323 if (FLAG_trace_compiler) { 320 if (FLAG_trace_compiler) {
324 OS::Print("--> patching entry %#"Px"\n", 321 OS::Print("--> patching entry %#"Px"\n",
325 Code::Handle(function.unoptimized_code()).EntryPoint()); 322 Code::Handle(function.unoptimized_code()).EntryPoint());
326 } 323 }
327 324
328 for (intptr_t i = 0; i < guarded_fields->length(); i++) { 325 for (intptr_t i = 0; i < guarded_fields.length(); i++) {
329 const Field& field = *(*guarded_fields)[i]; 326 const Field& field = *guarded_fields[i];
330 field.RegisterDependentCode(code); 327 field.RegisterDependentCode(code);
331 } 328 }
332 } else { 329 } else {
333 function.set_unoptimized_code(code); 330 function.set_unoptimized_code(code);
334 function.SetCode(code); 331 function.SetCode(code);
335 ASSERT(CodePatcher::CodeIsPatchable(code)); 332 ASSERT(CodePatcher::CodeIsPatchable(code));
336 } 333 }
337 } 334 }
338 is_compiled = true; 335 is_compiled = true;
339 } else { 336 } else {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 Object::Handle(isolate->object_store()->sticky_error()); 684 Object::Handle(isolate->object_store()->sticky_error());
688 isolate->object_store()->clear_sticky_error(); 685 isolate->object_store()->clear_sticky_error();
689 isolate->set_long_jump_base(base); 686 isolate->set_long_jump_base(base);
690 return result.raw(); 687 return result.raw();
691 } 688 }
692 UNREACHABLE(); 689 UNREACHABLE();
693 return Object::null(); 690 return Object::null();
694 } 691 }
695 692
696 } // namespace dart 693 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698