| Index: Source/platform/heap/StackFrameDepth.cpp
|
| diff --git a/Source/platform/heap/StackFrameDepth.cpp b/Source/platform/heap/StackFrameDepth.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..55f710fe0a02596786ac64c7d85a8b86187177b7
|
| --- /dev/null
|
| +++ b/Source/platform/heap/StackFrameDepth.cpp
|
| @@ -0,0 +1,26 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "platform/heap/StackFrameDepth.h"
|
| +
|
| +namespace blink {
|
| +
|
| +void StackFrameDepth::configureLimit()
|
| +{
|
| + if (!isEstimationSupported()) {
|
| + m_depth = 0;
|
| + return;
|
| + }
|
| +
|
| + // Allocate a large object in stack and query stack frame pointer after it.
|
| + const size_t kTypicalNumberOfPointerPerFrame = 4; // Return address + 3 local variables/argument
|
| + char dummy[kMaxDepth * kTypicalNumberOfPointerPerFrame * sizeof(void*)];
|
| + m_safeStackFrame = StackFrameDepth::estimateCurrentStackFrame();
|
| +
|
| + // Assert that the stack frame can be used.
|
| + dummy[sizeof(dummy)-1] = 0;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|