Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "platform/heap/StackFrameDepth.h" | |
| 7 | |
| 8 namespace blink { | |
| 9 | |
| 10 static const char* s_avoidOptimization = nullptr; | |
| 11 NEVER_INLINE static uintptr_t estimateStackFrameBaseOnCallee(const char* dummy) | |
| 12 { | |
| 13 s_avoidOptimization = dummy; | |
| 14 return StackFrameDepth::estimateCurrentStackFrame(); | |
| 15 } | |
| 16 | |
| 17 void StackFrameDepth::configureLimit() | |
|
haraken
2015/01/08 01:14:22
Can we add NEVER_INLINE to configureLimit and remo
kouhei (in TOK)
2015/01/08 03:29:54
No. We want %rbp after dummy[] is pushed.
| |
| 18 { | |
| 19 // Allocate a large object in stack and query stack frame pointer after it. | |
| 20 const size_t kTypicalPointersPerFrame = 4; // Return address + 3 local varia ble/argument | |
| 21 char dummy[kMaxDepth * kTypicalPointersPerFrame * sizeof(void*)]; | |
| 22 m_safeStackFrame = estimateStackFrameBaseOnCallee(dummy); | |
| 23 | |
| 24 // Assert that the stack frame can be used. | |
| 25 dummy[sizeof(dummy)-1] = 0; | |
|
haraken
2015/01/08 01:14:22
Add spaces around '-'.
haraken
2015/01/08 01:14:22
I guess if we move this code up to line 22, s_avoi
kouhei (in TOK)
2015/01/08 03:29:54
Done.
| |
| 26 } | |
| 27 | |
| 28 } // namespace blink | |
| OLD | NEW |