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

Side by Side Diff: src/assert-scope.h

Issue 2636903002: Assert that context creation doesn't throw (Closed)
Patch Set: updates Created 3 years, 11 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 | « src/api.cc ('k') | src/assert-scope.cc » ('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 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 #include "src/globals.h" 10 #include "src/globals.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 // Forward declarations. 15 // Forward declarations.
16 class Isolate; 16 class Isolate;
17 class PerThreadAssertData; 17 class PerThreadAssertData;
18 18
19 19
20 enum PerThreadAssertType { 20 enum PerThreadAssertType {
21 HEAP_ALLOCATION_ASSERT, 21 HEAP_ALLOCATION_ASSERT,
22 HANDLE_ALLOCATION_ASSERT, 22 HANDLE_ALLOCATION_ASSERT,
23 HANDLE_DEREFERENCE_ASSERT, 23 HANDLE_DEREFERENCE_ASSERT,
24 DEFERRED_HANDLE_DEREFERENCE_ASSERT, 24 DEFERRED_HANDLE_DEREFERENCE_ASSERT,
25 CODE_DEPENDENCY_CHANGE_ASSERT, 25 CODE_DEPENDENCY_CHANGE_ASSERT,
26 LAST_PER_THREAD_ASSERT_TYPE 26 LAST_PER_THREAD_ASSERT_TYPE
27 }; 27 };
28 28
29
30 enum PerIsolateAssertType { 29 enum PerIsolateAssertType {
31 JAVASCRIPT_EXECUTION_ASSERT, 30 JAVASCRIPT_EXECUTION_ASSERT,
32 JAVASCRIPT_EXECUTION_THROWS, 31 JAVASCRIPT_EXECUTION_THROWS,
33 DEOPTIMIZATION_ASSERT, 32 DEOPTIMIZATION_ASSERT,
34 COMPILATION_ASSERT 33 COMPILATION_ASSERT,
34 NO_EXCEPTION_ASSERT
35 }; 35 };
36 36
37 template <PerThreadAssertType kType, bool kAllow> 37 template <PerThreadAssertType kType, bool kAllow>
38 class PerThreadAssertScope { 38 class PerThreadAssertScope {
39 public: 39 public:
40 V8_EXPORT_PRIVATE PerThreadAssertScope(); 40 V8_EXPORT_PRIVATE PerThreadAssertScope();
41 V8_EXPORT_PRIVATE ~PerThreadAssertScope(); 41 V8_EXPORT_PRIVATE ~PerThreadAssertScope();
42 42
43 V8_EXPORT_PRIVATE static bool IsAllowed(); 43 V8_EXPORT_PRIVATE static bool IsAllowed();
44 44
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Per-isolate assert scopes. 140 // Per-isolate assert scopes.
141 141
142 // Scope to document where we do not expect javascript execution. 142 // Scope to document where we do not expect javascript execution.
143 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false> 143 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false>
144 DisallowJavascriptExecution; 144 DisallowJavascriptExecution;
145 145
146 // Scope to introduce an exception to DisallowJavascriptExecution. 146 // Scope to introduce an exception to DisallowJavascriptExecution.
147 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true> 147 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true>
148 AllowJavascriptExecution; 148 AllowJavascriptExecution;
149 149
150 // Scope to document where we do not expect javascript execution (debug only)
151 typedef PerIsolateAssertScopeDebugOnly<JAVASCRIPT_EXECUTION_ASSERT, false>
152 DisallowJavascriptExecutionDebugOnly;
153
154 // Scope to introduce an exception to DisallowJavascriptExecutionDebugOnly.
155 typedef PerIsolateAssertScopeDebugOnly<JAVASCRIPT_EXECUTION_ASSERT, true>
156 AllowJavascriptExecutionDebugOnly;
157
150 // Scope in which javascript execution leads to exception being thrown. 158 // Scope in which javascript execution leads to exception being thrown.
151 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false> 159 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false>
152 ThrowOnJavascriptExecution; 160 ThrowOnJavascriptExecution;
153 161
154 // Scope to introduce an exception to ThrowOnJavascriptExecution. 162 // Scope to introduce an exception to ThrowOnJavascriptExecution.
155 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true> 163 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true>
156 NoThrowOnJavascriptExecution; 164 NoThrowOnJavascriptExecution;
157 165
158 // Scope to document where we do not expect deoptimization. 166 // Scope to document where we do not expect deoptimization.
159 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, false> 167 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, false>
160 DisallowDeoptimization; 168 DisallowDeoptimization;
161 169
162 // Scope to introduce an exception to DisallowDeoptimization. 170 // Scope to introduce an exception to DisallowDeoptimization.
163 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, true> 171 typedef PerIsolateAssertScopeDebugOnly<DEOPTIMIZATION_ASSERT, true>
164 AllowDeoptimization; 172 AllowDeoptimization;
165 173
166 // Scope to document where we do not expect deoptimization. 174 // Scope to document where we do not expect deoptimization.
167 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false> 175 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false>
168 DisallowCompilation; 176 DisallowCompilation;
169 177
170 // Scope to introduce an exception to DisallowDeoptimization. 178 // Scope to introduce an exception to DisallowDeoptimization.
171 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true> 179 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true>
172 AllowCompilation; 180 AllowCompilation;
181
182 // Scope to document where we do not expect exceptions.
183 typedef PerIsolateAssertScopeDebugOnly<NO_EXCEPTION_ASSERT, false>
184 DisallowExceptions;
185
186 // Scope to introduce an exception to DisallowExceptions.
187 typedef PerIsolateAssertScopeDebugOnly<NO_EXCEPTION_ASSERT, true>
188 AllowExceptions;
173 } // namespace internal 189 } // namespace internal
174 } // namespace v8 190 } // namespace v8
175 191
176 #endif // V8_ASSERT_SCOPE_H_ 192 #endif // V8_ASSERT_SCOPE_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/assert-scope.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698