Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 4be483a88edf88a314095c5d7cefa8262e0b2860..b36d2663ac0545ee89e5f814d136aa3fa0df3501 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -308,20 +308,9 @@ void CompilationInfo::PrintAstForTesting() { |
// Implementation of OptimizedCompileJob |
OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
+ DisallowJavascriptExecution no_js(isolate()); |
DCHECK(info()->IsOptimizing()); |
- // Do not use Crankshaft/TurboFan if we need to be able to set break points. |
- if (info()->shared_info()->HasDebugInfo()) { |
- return AbortOptimization(kFunctionBeingDebugged); |
- } |
- |
- // Limit the number of times we try to optimize functions. |
- const int kMaxOptCount = |
- FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
- if (info()->shared_info()->opt_count() > kMaxOptCount) { |
- return AbortOptimization(kOptimizedTooManyTimes); |
- } |
- |
if (FLAG_trace_opt) { |
OFStream os(stdout); |
os << "[compiling method " << Brief(*info()->closure()) << " using " |
@@ -833,6 +822,20 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, |
info->SetOptimizingForOsr(osr_ast_id); |
+ // Do not use Crankshaft/TurboFan if we need to be able to set break points. |
+ if (info->shared_info()->HasDebugInfo()) { |
+ info->AbortOptimization(kFunctionBeingDebugged); |
+ return MaybeHandle<Code>(); |
+ } |
+ |
+ // Limit the number of times we try to optimize functions. |
+ const int kMaxOptCount = |
+ FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
+ if (info->shared_info()->opt_count() > kMaxOptCount) { |
+ info->AbortOptimization(kOptimizedTooManyTimes); |
+ return MaybeHandle<Code>(); |
+ } |
+ |
if (mode == Compiler::CONCURRENT) { |
if (GetOptimizedCodeLater(info.get())) { |
info.Detach(); // The background recompile job owns this now. |