OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project 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 V8_ASSERT_SCOPE_H_ | 5 #ifndef V8_ASSERT_SCOPE_H_ |
6 #define V8_ASSERT_SCOPE_H_ | 6 #define V8_ASSERT_SCOPE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include "src/base/macros.h" | 9 #include "src/base/macros.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 HANDLE_DEREFERENCE_ASSERT, | 22 HANDLE_DEREFERENCE_ASSERT, |
23 DEFERRED_HANDLE_DEREFERENCE_ASSERT, | 23 DEFERRED_HANDLE_DEREFERENCE_ASSERT, |
24 CODE_DEPENDENCY_CHANGE_ASSERT, | 24 CODE_DEPENDENCY_CHANGE_ASSERT, |
25 LAST_PER_THREAD_ASSERT_TYPE | 25 LAST_PER_THREAD_ASSERT_TYPE |
26 }; | 26 }; |
27 | 27 |
28 | 28 |
29 enum PerIsolateAssertType { | 29 enum PerIsolateAssertType { |
30 JAVASCRIPT_EXECUTION_ASSERT, | 30 JAVASCRIPT_EXECUTION_ASSERT, |
31 JAVASCRIPT_EXECUTION_THROWS, | 31 JAVASCRIPT_EXECUTION_THROWS, |
32 ALLOCATION_FAILURE_ASSERT, | |
33 DEOPTIMIZATION_ASSERT, | 32 DEOPTIMIZATION_ASSERT, |
34 COMPILATION_ASSERT | 33 COMPILATION_ASSERT |
35 }; | 34 }; |
36 | 35 |
37 | 36 |
38 template <PerThreadAssertType kType, bool kAllow> | 37 template <PerThreadAssertType kType, bool kAllow> |
39 class PerThreadAssertScope { | 38 class PerThreadAssertScope { |
40 public: | 39 public: |
41 PerThreadAssertScope(); | 40 PerThreadAssertScope(); |
42 ~PerThreadAssertScope(); | 41 ~PerThreadAssertScope(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 AllowJavascriptExecution; | 148 AllowJavascriptExecution; |
150 | 149 |
151 // Scope in which javascript execution leads to exception being thrown. | 150 // Scope in which javascript execution leads to exception being thrown. |
152 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false> | 151 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false> |
153 ThrowOnJavascriptExecution; | 152 ThrowOnJavascriptExecution; |
154 | 153 |
155 // Scope to introduce an exception to ThrowOnJavascriptExecution. | 154 // Scope to introduce an exception to ThrowOnJavascriptExecution. |
156 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true> | 155 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true> |
157 NoThrowOnJavascriptExecution; | 156 NoThrowOnJavascriptExecution; |
158 | 157 |
159 // Scope to document where we do not expect an allocation failure. | |
160 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, false> | |
161 DisallowAllocationFailure; | |
162 | |
163 // Scope to introduce an exception to DisallowAllocationFailure. | |
164 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, true> | |
165 AllowAllocationFailure; | |
166 | |
167 // Scope to document where we do not expect deoptimization. | 158 // Scope to document where we do not expect deoptimization. |
168 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, false> | 159 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, false> |
169 DisallowDeoptimization; | 160 DisallowDeoptimization; |
170 | 161 |
171 // Scope to introduce an exception to DisallowDeoptimization. | 162 // Scope to introduce an exception to DisallowDeoptimization. |
172 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, true> | 163 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, true> |
173 AllowDeoptimization; | 164 AllowDeoptimization; |
174 | 165 |
175 // Scope to document where we do not expect deoptimization. | 166 // Scope to document where we do not expect deoptimization. |
176 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false> | 167 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false> |
177 DisallowCompilation; | 168 DisallowCompilation; |
178 | 169 |
179 // Scope to introduce an exception to DisallowDeoptimization. | 170 // Scope to introduce an exception to DisallowDeoptimization. |
180 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true> | 171 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true> |
181 AllowCompilation; | 172 AllowCompilation; |
182 } } // namespace v8::internal | 173 } } // namespace v8::internal |
183 | 174 |
184 #endif // V8_ASSERT_SCOPE_H_ | 175 #endif // V8_ASSERT_SCOPE_H_ |
OLD | NEW |