Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 2d4ab93015e4f8a749fc8f4b61fbfe3976933869..88bc2349ed045d0bf360ac863d7bf18a9addd469 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -8434,8 +8434,9 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CompileUnoptimized) { |
// Compile the target function. |
ASSERT(function->shared()->allows_lazy_compilation()); |
- Handle<Code> code = Compiler::GetUnoptimizedCode(function); |
- RETURN_IF_EMPTY_HANDLE(isolate, code); |
+ Handle<Code> code; |
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, code, |
+ Compiler::GetUnoptimizedCode(function)); |
function->ReplaceCode(*code); |
// All done. Return the compiled code. |
@@ -8476,8 +8477,13 @@ RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CompileOptimized) { |
} else { |
Compiler::ConcurrencyMode mode = concurrent ? Compiler::CONCURRENT |
: Compiler::NOT_CONCURRENT; |
- Handle<Code> code = Compiler::GetOptimizedCode(function, unoptimized, mode); |
- function->ReplaceCode(code.is_null() ? *unoptimized : *code); |
+ Handle<Code> code; |
+ if (Compiler::GetOptimizedCode( |
+ function, unoptimized, mode).ToHandle(&code)) { |
+ function->ReplaceCode(*code); |
+ } else { |
+ function->ReplaceCode(*unoptimized); |
+ } |
} |
ASSERT(function->code()->kind() == Code::FUNCTION || |
@@ -8798,15 +8804,16 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { |
PrintF(" at AST id %d]\n", ast_id.ToInt()); |
} |
result = Compiler::GetConcurrentlyOptimizedCode(job); |
- } else if (result.is_null() && |
- IsSuitableForOnStackReplacement(isolate, function, caller_code)) { |
+ } else if (IsSuitableForOnStackReplacement(isolate, function, caller_code)) { |
if (FLAG_trace_osr) { |
PrintF("[OSR - Compiling: "); |
function->PrintName(); |
PrintF(" at AST id %d]\n", ast_id.ToInt()); |
} |
- result = Compiler::GetOptimizedCode(function, caller_code, mode, ast_id); |
- if (result.is_identical_to(isolate->builtins()->InOptimizationQueue())) { |
+ MaybeHandle<Code> maybe_result = Compiler::GetOptimizedCode( |
+ function, caller_code, mode, ast_id); |
+ if (maybe_result.ToHandle(&result) && |
+ result.is_identical_to(isolate->builtins()->InOptimizationQueue())) { |
// Optimization is queued. Return to check later. |
return NULL; |
} |