Commit 69aa868b authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[runtime] Reserve more stack space for compilation.

... to properly handle stack overflows near the hard stack limit.

Bug: chromium:716522
Change-Id: I6acdb29f039b9835bdf45b087d6561a05ed837bb
Reviewed-on: https://chromium-review.googlesource.com/517799
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45619}
parent e0dcd1ec
......@@ -3341,7 +3341,7 @@ bool Bootstrapper::CompileNative(Isolate* isolate, Vector<const char> name,
// environment has been at least partially initialized. Add a stack check
// before entering JS code to catch overflow early.
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(4 * KB)) {
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
isolate->StackOverflow();
return false;
}
......
......@@ -110,6 +110,8 @@ namespace internal {
#define V8_DEFAULT_STACK_SIZE_KB 984
#endif
// Minimum stack size in KB required by compilers.
const int kStackSpaceRequiredForCompilation = 40;
// Determine whether double field unboxing feature is enabled.
#if V8_TARGET_ARCH_64_BIT
......
......@@ -33,7 +33,9 @@ RUNTIME_FUNCTION(Runtime_CompileLazy) {
#endif
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
return isolate->StackOverflow();
}
if (!Compiler::Compile(function, Compiler::KEEP_EXCEPTION)) {
return isolate->heap()->exception();
}
......@@ -46,7 +48,9 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) {
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
return isolate->StackOverflow();
}
if (!Compiler::CompileOptimized(function, Compiler::CONCURRENT)) {
return isolate->heap()->exception();
}
......@@ -60,7 +64,9 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized_NotConcurrent) {
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
StackLimitCheck check(isolate);
if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow();
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
return isolate->StackOverflow();
}
if (!Compiler::CompileOptimized(function, Compiler::NOT_CONCURRENT)) {
return isolate->heap()->exception();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment