Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: third_party/WebKit/Source/platform/heap/StackFrameDepth.h

Issue 1778353002: If under stack pressure, do not enable eager stack use. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not reset s_stackFrameLimit Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef StackFrameDepth_h 5 #ifndef StackFrameDepth_h
6 #define StackFrameDepth_h 6 #define StackFrameDepth_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
(...skipping 16 matching lines...) Expand all
27 // all the ABIs currently supported do. 27 // all the ABIs currently supported do.
28 // 28 //
29 // A unit test checks that the assumption holds for a target 29 // A unit test checks that the assumption holds for a target
30 // (HeapTest.StackGrowthDirection.) 30 // (HeapTest.StackGrowthDirection.)
31 return currentStackFrame() > s_stackFrameLimit; 31 return currentStackFrame() > s_stackFrameLimit;
32 } 32 }
33 33
34 static void enableStackLimit(); 34 static void enableStackLimit();
35 static void disableStackLimit() 35 static void disableStackLimit()
36 { 36 {
37 s_stackFrameLimit = 0; 37 s_stackFrameLimit = 0;
sof 2016/03/10 13:43:13 Using 0 as the disabled limit value is strictly sp
38 #if ENABLE(ASSERT) 38 #if ENABLE(ASSERT)
39 s_isEnabled = false; 39 s_isEnabled = false;
40 #endif 40 #endif
41 } 41 }
42 42
43 #if ENABLE(ASSERT) 43 #if ENABLE(ASSERT)
44 inline static bool isEnabled() { return s_isEnabled; } 44 inline static bool isEnabled() { return s_isEnabled; }
45 inline static bool isAcceptableStackUse() 45 inline static bool isAcceptableStackUse()
46 { 46 {
47 // ASan adds extra stack usage leading to too noisy asserts. 47 // ASan adds extra stack usage leading to too noisy asserts.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 #endif 97 #endif
98 }; 98 };
99 99
100 class StackFrameDepthScope { 100 class StackFrameDepthScope {
101 STACK_ALLOCATED(); 101 STACK_ALLOCATED();
102 WTF_MAKE_NONCOPYABLE(StackFrameDepthScope); 102 WTF_MAKE_NONCOPYABLE(StackFrameDepthScope);
103 public: 103 public:
104 StackFrameDepthScope() 104 StackFrameDepthScope()
105 { 105 {
106 StackFrameDepth::enableStackLimit(); 106 StackFrameDepth::enableStackLimit();
107 ASSERT(StackFrameDepth::isSafeToRecurse()); 107 // Enabled unless under stack pressure.
108 ASSERT(StackFrameDepth::isSafeToRecurse() || !StackFrameDepth::isEnabled ());
108 } 109 }
109 110
110 ~StackFrameDepthScope() 111 ~StackFrameDepthScope()
111 { 112 {
112 StackFrameDepth::disableStackLimit(); 113 StackFrameDepth::disableStackLimit();
113 } 114 }
114 }; 115 };
115 116
116 } // namespace blink 117 } // namespace blink
117 118
118 #endif // StackFrameDepth_h 119 #endif // StackFrameDepth_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698