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

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

Issue 15904010: Fix issue 3874: non-deterministic AST generation caused by exceptions being thrown during parsing (… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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_inliner.cc » ('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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (FLAG_trace_compiler) { 235 if (FLAG_trace_compiler) {
236 OS::Print("--> restoring entry at %#"Px"\n", 236 OS::Print("--> restoring entry at %#"Px"\n",
237 Code::Handle(function.unoptimized_code()).EntryPoint()); 237 Code::Handle(function.unoptimized_code()).EntryPoint());
238 } 238 }
239 } 239 }
240 240
241 241
242 // Return false if bailed out. 242 // Return false if bailed out.
243 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function, 243 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
244 bool optimized) { 244 bool optimized) {
245 if (optimized && !parsed_function.function().is_optimizable()) {
246 return false;
247 }
245 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); 248 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer);
246 bool is_compiled = false; 249 bool is_compiled = false;
247 Isolate* isolate = Isolate::Current(); 250 Isolate* isolate = Isolate::Current();
248 HANDLESCOPE(isolate); 251 HANDLESCOPE(isolate);
249 const intptr_t prev_deopt_id = isolate->deopt_id(); 252 const intptr_t prev_deopt_id = isolate->deopt_id();
250 isolate->set_deopt_id(0); 253 isolate->set_deopt_id(0);
251 LongJump* old_base = isolate->long_jump_base(); 254 LongJump* old_base = isolate->long_jump_base();
252 LongJump bailout_jump; 255 LongJump bailout_jump;
253 isolate->set_long_jump_base(&bailout_jump); 256 isolate->set_long_jump_base(&bailout_jump);
254 if (setjmp(*bailout_jump.Set()) == 0) { 257 if (setjmp(*bailout_jump.Set()) == 0) {
(...skipping 19 matching lines...) Expand all
274 } 277 }
275 } 278 }
276 279
277 // Build the flow graph. 280 // Build the flow graph.
278 FlowGraphBuilder builder(parsed_function, 281 FlowGraphBuilder builder(parsed_function,
279 ic_data_array, 282 ic_data_array,
280 NULL); // NULL = not inlining. 283 NULL); // NULL = not inlining.
281 flow_graph = builder.BuildGraph(); 284 flow_graph = builder.BuildGraph();
282 } 285 }
283 286
287 if (FLAG_print_flow_graph ||
288 (optimized && FLAG_print_flow_graph_optimized)) {
289 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
290 }
291
284 if (optimized) { 292 if (optimized) {
285 TimerScope timer(FLAG_compiler_stats, 293 TimerScope timer(FLAG_compiler_stats,
286 &CompilerStats::ssa_timer, 294 &CompilerStats::ssa_timer,
287 isolate); 295 isolate);
288 // Transform to SSA (virtual register 0 and no inlining arguments). 296 // Transform to SSA (virtual register 0 and no inlining arguments).
289 flow_graph->ComputeSSA(0, NULL); 297 flow_graph->ComputeSSA(0, NULL);
290 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 298 DEBUG_ASSERT(flow_graph->VerifyUseLists());
299 if (FLAG_print_flow_graph || FLAG_print_flow_graph_optimized) {
300 FlowGraphPrinter::PrintGraph("After SSA", flow_graph);
301 }
291 } 302 }
292 303
293 if (FLAG_print_flow_graph ||
294 (optimized && FLAG_print_flow_graph_optimized)) {
295 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
296 }
297 304
298 // Collect all instance fields that are loaded in the graph and 305 // Collect all instance fields that are loaded in the graph and
299 // have non-generic type feedback attached to them that can 306 // have non-generic type feedback attached to them that can
300 // potentially affect optimizations. 307 // potentially affect optimizations.
301 GrowableArray<const Field*> guarded_fields(10); 308 GrowableArray<const Field*> guarded_fields(10);
302 if (optimized) { 309 if (optimized) {
303 TimerScope timer(FLAG_compiler_stats, 310 TimerScope timer(FLAG_compiler_stats,
304 &CompilerStats::graphoptimizer_timer, 311 &CompilerStats::graphoptimizer_timer,
305 isolate); 312 isolate);
306 313
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 Object::Handle(isolate->object_store()->sticky_error()); 871 Object::Handle(isolate->object_store()->sticky_error());
865 isolate->object_store()->clear_sticky_error(); 872 isolate->object_store()->clear_sticky_error();
866 isolate->set_long_jump_base(base); 873 isolate->set_long_jump_base(base);
867 return result.raw(); 874 return result.raw();
868 } 875 }
869 UNREACHABLE(); 876 UNREACHABLE();
870 return Object::null(); 877 return Object::null();
871 } 878 }
872 879
873 } // namespace dart 880 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698