| Index: src/execution.cc
|
| diff --git a/src/execution.cc b/src/execution.cc
|
| index 04ec9059f34d0311f5219148fdd4470a07ae9214..f9dfc6371facaddfee9e46ad18dbd4073571345b 100644
|
| --- a/src/execution.cc
|
| +++ b/src/execution.cc
|
| @@ -222,9 +222,7 @@ StackGuard::StackGuard() {
|
| // lower addresses.
|
| ExecutionAccess access;
|
| if (thread_local_.nesting_++ == 0) {
|
| - // Initial StackGuard is being set. We will set the stack limits based on
|
| - // the current stack pointer allowing the stack to grow kLimitSize from
|
| - // here.
|
| + // Initial StackGuard is being set.
|
|
|
| // Ensure that either the stack limits are unset (kIllegalLimit) or that
|
| // they indicate a pending interruption. The interrupt limit will be
|
| @@ -237,14 +235,27 @@ StackGuard::StackGuard() {
|
| (thread_local_.climit_ == kInterruptLimit &&
|
| thread_local_.interrupt_flags_ != 0));
|
|
|
| - uintptr_t limit = GENERATED_CODE_STACK_LIMIT(kLimitSize);
|
| - thread_local_.initial_jslimit_ = thread_local_.jslimit_ = limit;
|
| - Heap::SetStackLimit(limit);
|
| - // NOTE: The check for overflow is not safe as there is no guarantee that
|
| - // the running thread has its stack in all memory up to address 0x00000000.
|
| - thread_local_.initial_climit_ = thread_local_.climit_ =
|
| - reinterpret_cast<uintptr_t>(this) >= kLimitSize ?
|
| - reinterpret_cast<uintptr_t>(this) - kLimitSize : 0;
|
| + if (thread_local_.initial_jslimit_ == kIllegalLimit ||
|
| + thread_local_.initial_climit_ == kIllegalLimit) {
|
| + CHECK(thread_local_.initial_jslimit_ == kIllegalLimit);
|
| + CHECK(thread_local_.initial_climit_ == kIllegalLimit);
|
| +
|
| + // No limit has been set with ResourceConstraints. We will set
|
| + // the stack limits based on the current stack pointer allowing
|
| + // the stack to grow kLimitSize from here.
|
| + uintptr_t limit = GENERATED_CODE_STACK_LIMIT(kLimitSize);
|
| + thread_local_.initial_jslimit_ = limit;
|
| +
|
| + // NOTE: The check for overflow is not safe as there is no
|
| + // guarantee that the running thread has its stack in all memory
|
| + // up to address 0x00000000.
|
| + thread_local_.initial_climit_ =
|
| + reinterpret_cast<uintptr_t>(this) >= kLimitSize ?
|
| + reinterpret_cast<uintptr_t>(this) - kLimitSize : 0;
|
| + }
|
| + thread_local_.jslimit_ = thread_local_.initial_jslimit_;
|
| + thread_local_.climit_ = thread_local_.initial_climit_;
|
| + Heap::SetStackLimit(thread_local_.jslimit_);
|
|
|
| if (thread_local_.interrupt_flags_ != 0) {
|
| set_limits(kInterruptLimit, access);
|
| @@ -283,15 +294,7 @@ void StackGuard::EnableInterrupts() {
|
|
|
| void StackGuard::SetStackLimit(uintptr_t limit) {
|
| ExecutionAccess access;
|
| - // If the current limits are special (eg due to a pending interrupt) then
|
| - // leave them alone.
|
| - if (thread_local_.jslimit_ == thread_local_.initial_jslimit_) {
|
| - thread_local_.jslimit_ = limit;
|
| - Heap::SetStackLimit(limit);
|
| - }
|
| - if (thread_local_.climit_ == thread_local_.initial_climit_) {
|
| - thread_local_.climit_ = limit;
|
| - }
|
| + CHECK(thread_local_.nesting_ == 0);
|
| thread_local_.initial_climit_ = limit;
|
| thread_local_.initial_jslimit_ = limit;
|
| }
|
|
|