| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 Object::Handle(isolate->object_store()->sticky_error()); | 875 Object::Handle(isolate->object_store()->sticky_error()); |
| 869 isolate->object_store()->clear_sticky_error(); | 876 isolate->object_store()->clear_sticky_error(); |
| 870 isolate->set_long_jump_base(base); | 877 isolate->set_long_jump_base(base); |
| 871 return result.raw(); | 878 return result.raw(); |
| 872 } | 879 } |
| 873 UNREACHABLE(); | 880 UNREACHABLE(); |
| 874 return Object::null(); | 881 return Object::null(); |
| 875 } | 882 } |
| 876 | 883 |
| 877 } // namespace dart | 884 } // namespace dart |
| OLD | NEW |