Commit 6ffadfd6 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Reland "[oilpan] Fix stack limit check for recursive tracing"

The limit was defined as ~0ul (unsigned long) which is unsigned 32bit on Windows
64bit and thus extended with 0 for uintptr_t. This results in bogus return of
StackFrameDepth::IsSafeToRecurse of true even though recursion might be disabled
due to stack pressure.

This reverts commit e5d92d31.

Tbr: haraken@chromium.org
Bug: chromium:798479
Change-Id: Id7a897af323e230e11c7a1417f383bc868f6fe05
Reviewed-on: https://chromium-review.googlesource.com/848896Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526738}
parent 6bec5ff5
......@@ -42,6 +42,7 @@
#include "platform/heap/HeapTestUtilities.h"
#include "platform/heap/SafePoint.h"
#include "platform/heap/SelfKeepAlive.h"
#include "platform/heap/StackFrameDepth.h"
#include "platform/heap/ThreadState.h"
#include "platform/heap/Visitor.h"
#include "platform/testing/UnitTestHelpers.h"
......@@ -6253,6 +6254,20 @@ TEST(HeapTest, StackGrowthDirection) {
EXPECT_EQ(kGrowsTowardsLower, StackGrowthDirection());
}
TEST(HeapTest, StackFrameDepthDisabledByDefault) {
StackFrameDepth depth;
// Only allow recursion after explicitly enabling the stack limit.
EXPECT_FALSE(depth.IsSafeToRecurse());
}
TEST(HeapTest, StackFrameDepthEnable) {
StackFrameDepth depth;
StackFrameDepthScope scope(&depth);
// The scope may fail to enable recursion when the stack is close to the
// limit. In all other cases we should be able to safely recurse.
EXPECT_TRUE(depth.IsSafeToRecurse() || !depth.IsEnabled());
}
class TestMixinAllocationA : public GarbageCollected<TestMixinAllocationA>,
public GarbageCollectedMixin {
USING_GARBAGE_COLLECTED_MIXIN(TestMixinAllocationA);
......
......@@ -77,7 +77,7 @@ class PLATFORM_EXPORT StackFrameDepth final {
// The stack pointer is assumed to grow towards lower addresses;
// |kMinimumStackLimit| then being the limit that a stack
// pointer will always exceed.
static const uintptr_t kMinimumStackLimit = ~0ul;
static const uintptr_t kMinimumStackLimit = ~uintptr_t{0};
static uintptr_t GetFallbackStackLimit();
......
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