| 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/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (result.IsError()) { | 225 if (result.IsError()) { |
| 226 if (result.IsLanguageError()) { | 226 if (result.IsLanguageError()) { |
| 227 Exceptions::ThrowCompileTimeError(LanguageError::Cast(result)); | 227 Exceptions::ThrowCompileTimeError(LanguageError::Cast(result)); |
| 228 UNREACHABLE(); | 228 UNREACHABLE(); |
| 229 } | 229 } |
| 230 Exceptions::PropagateError(Error::Cast(result)); | 230 Exceptions::PropagateError(Error::Cast(result)); |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) { | 234 bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) { |
| 235 #if !defined(PRODUCT) |
| 235 if (FLAG_support_debugger) { | 236 if (FLAG_support_debugger) { |
| 236 Isolate* isolate = thread->isolate(); | 237 Isolate* isolate = thread->isolate(); |
| 237 if (isolate->debugger()->IsStepping() || | 238 if (isolate->debugger()->IsStepping() || |
| 238 isolate->debugger()->HasBreakpoint(function, thread->zone())) { | 239 isolate->debugger()->HasBreakpoint(function, thread->zone())) { |
| 239 // We cannot set breakpoints and single step in optimized code, | 240 // We cannot set breakpoints and single step in optimized code, |
| 240 // so do not optimize the function. | 241 // so do not optimize the function. |
| 241 function.set_usage_counter(0); | 242 function.set_usage_counter(0); |
| 242 return false; | 243 return false; |
| 243 } | 244 } |
| 244 } | 245 } |
| 246 #endif |
| 245 if (function.deoptimization_counter() >= | 247 if (function.deoptimization_counter() >= |
| 246 FLAG_max_deoptimization_counter_threshold) { | 248 FLAG_max_deoptimization_counter_threshold) { |
| 247 if (FLAG_trace_failed_optimization_attempts || | 249 if (FLAG_trace_failed_optimization_attempts || |
| 248 FLAG_stop_on_excessive_deoptimization) { | 250 FLAG_stop_on_excessive_deoptimization) { |
| 249 THR_Print("Too many deoptimizations: %s\n", | 251 THR_Print("Too many deoptimizations: %s\n", |
| 250 function.ToFullyQualifiedCString()); | 252 function.ToFullyQualifiedCString()); |
| 251 if (FLAG_stop_on_excessive_deoptimization) { | 253 if (FLAG_stop_on_excessive_deoptimization) { |
| 252 FATAL("Stop on excessive deoptimization"); | 254 FATAL("Stop on excessive deoptimization"); |
| 253 } | 255 } |
| 254 } | 256 } |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 per_compile_timer.Stop(); | 1345 per_compile_timer.Stop(); |
| 1344 | 1346 |
| 1345 if (trace_compiler) { | 1347 if (trace_compiler) { |
| 1346 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n", | 1348 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n", |
| 1347 function.ToFullyQualifiedCString(), | 1349 function.ToFullyQualifiedCString(), |
| 1348 Code::Handle(function.CurrentCode()).PayloadStart(), | 1350 Code::Handle(function.CurrentCode()).PayloadStart(), |
| 1349 Code::Handle(function.CurrentCode()).Size(), | 1351 Code::Handle(function.CurrentCode()).Size(), |
| 1350 per_compile_timer.TotalElapsedTime()); | 1352 per_compile_timer.TotalElapsedTime()); |
| 1351 } | 1353 } |
| 1352 | 1354 |
| 1355 #if !defined(PRODUCT) |
| 1353 if (FLAG_support_debugger) { | 1356 if (FLAG_support_debugger) { |
| 1354 isolate->debugger()->NotifyCompilation(function); | 1357 isolate->debugger()->NotifyCompilation(function); |
| 1355 } | 1358 } |
| 1359 #endif |
| 1356 | 1360 |
| 1357 if (FLAG_disassemble && FlowGraphPrinter::ShouldPrint(function)) { | 1361 if (FLAG_disassemble && FlowGraphPrinter::ShouldPrint(function)) { |
| 1358 Disassembler::DisassembleCode(function, result, optimized); | 1362 Disassembler::DisassembleCode(function, result, optimized); |
| 1359 } else if (FLAG_disassemble_optimized && optimized && | 1363 } else if (FLAG_disassemble_optimized && optimized && |
| 1360 FlowGraphPrinter::ShouldPrint(function)) { | 1364 FlowGraphPrinter::ShouldPrint(function)) { |
| 1361 Disassembler::DisassembleCode(function, result, true); | 1365 Disassembler::DisassembleCode(function, result, true); |
| 1362 } | 1366 } |
| 1363 | 1367 |
| 1364 return result.raw(); | 1368 return result.raw(); |
| 1365 } else { | 1369 } else { |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 } | 2289 } |
| 2286 | 2290 |
| 2287 bool BackgroundCompiler::IsDisabled() { | 2291 bool BackgroundCompiler::IsDisabled() { |
| 2288 UNREACHABLE(); | 2292 UNREACHABLE(); |
| 2289 return true; | 2293 return true; |
| 2290 } | 2294 } |
| 2291 | 2295 |
| 2292 #endif // DART_PRECOMPILED_RUNTIME | 2296 #endif // DART_PRECOMPILED_RUNTIME |
| 2293 | 2297 |
| 2294 } // namespace dart | 2298 } // namespace dart |
| OLD | NEW |