Index: src/runtime/runtime-compiler.cc |
diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc |
index c79616873202bfd348fc4fdc89649f449028f3b5..a8c0b5f5e251c37334026d975108e0663569893a 100644 |
--- a/src/runtime/runtime-compiler.cc |
+++ b/src/runtime/runtime-compiler.cc |
@@ -248,7 +248,6 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { |
function->shared()->ast_node_count() > 512) |
? Compiler::CONCURRENT |
: Compiler::NOT_CONCURRENT; |
- Handle<Code> result = Handle<Code>::null(); |
OptimizedCompileJob* job = NULL; |
if (mode == Compiler::CONCURRENT) { |
@@ -269,22 +268,24 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { |
job = dispatcher->FindReadyOSRCandidate(function, ast_id); |
} |
+ MaybeHandle<Code> maybe_result; |
if (job != NULL) { |
if (FLAG_trace_osr) { |
PrintF("[OSR - Found ready: "); |
function->PrintName(); |
PrintF(" at AST id %d]\n", ast_id.ToInt()); |
} |
- result = Compiler::GetConcurrentlyOptimizedCode(job); |
+ maybe_result = Compiler::GetConcurrentlyOptimizedCode(job); |
} else if (IsSuitableForOnStackReplacement(isolate, function)) { |
if (FLAG_trace_osr) { |
PrintF("[OSR - Compiling: "); |
function->PrintName(); |
PrintF(" at AST id %d]\n", ast_id.ToInt()); |
} |
- MaybeHandle<Code> maybe_result = Compiler::GetOptimizedCode( |
+ maybe_result = Compiler::GetOptimizedCode( |
function, mode, ast_id, |
(mode == Compiler::NOT_CONCURRENT) ? frame : nullptr); |
+ Handle<Code> result; |
if (maybe_result.ToHandle(&result) && |
result.is_identical_to(isolate->builtins()->InOptimizationQueue())) { |
// Optimization is queued. Return to check later. |
@@ -296,7 +297,9 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { |
BackEdgeTable::Revert(isolate, *caller_code); |
// Check whether we ended up with usable optimized code. |
- if (!result.is_null() && result->kind() == Code::OPTIMIZED_FUNCTION) { |
+ Handle<Code> result; |
+ if (maybe_result.ToHandle(&result) && |
+ result->kind() == Code::OPTIMIZED_FUNCTION) { |
DeoptimizationInputData* data = |
DeoptimizationInputData::cast(result->deoptimization_data()); |