Reviewers: jarin,
Description:
Fix bug in Runtime_CompileOptimized resulting from stack overflow.
[email protected]
BUG=446389
Please review this at https://codereview.chromium.org/844503002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+12, -1 lines):
M src/runtime/runtime-compiler.cc
Index: src/runtime/runtime-compiler.cc
diff --git a/src/runtime/runtime-compiler.cc
b/src/runtime/runtime-compiler.cc
index
ebd0c13f0f9b1ef2e2bb44d5bfcb4d017d5e041c..6526dcff8bf3dad096bb6470e541fddcedc4b966
100644
--- a/src/runtime/runtime-compiler.cc
+++ b/src/runtime/runtime-compiler.cc
@@ -69,9 +69,20 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized) {
concurrent ? Compiler::CONCURRENT : Compiler::NOT_CONCURRENT;
Handle<Code> code;
if (Compiler::GetOptimizedCode(function, unoptimized,
mode).ToHandle(&code)) {
+ // Optimization succeeded, return optimized code.
function->ReplaceCode(*code);
} else {
- function->ReplaceCode(function->shared()->code());
+ // Optimization failed, get unoptimized code.
+ if (isolate->has_pending_exception()) { // Possible stack overflow.
+ return isolate->heap()->exception();
+ }
+ code = Handle<Code>(function->shared()->code(), isolate);
+ if (code->kind() != Code::FUNCTION &&
+ code->kind() != Code::OPTIMIZED_FUNCTION) {
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, code, Compiler::GetUnoptimizedCode(function));
+ }
+ function->ReplaceCode(*code);
}
DCHECK(function->code()->kind() == Code::FUNCTION ||
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.