OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 HANDLE_ALLOCATION_ASSERT, | 42 HANDLE_ALLOCATION_ASSERT, |
43 HANDLE_DEREFERENCE_ASSERT, | 43 HANDLE_DEREFERENCE_ASSERT, |
44 DEFERRED_HANDLE_DEREFERENCE_ASSERT, | 44 DEFERRED_HANDLE_DEREFERENCE_ASSERT, |
45 CODE_DEPENDENCY_CHANGE_ASSERT, | 45 CODE_DEPENDENCY_CHANGE_ASSERT, |
46 LAST_PER_THREAD_ASSERT_TYPE | 46 LAST_PER_THREAD_ASSERT_TYPE |
47 }; | 47 }; |
48 | 48 |
49 | 49 |
50 enum PerIsolateAssertType { | 50 enum PerIsolateAssertType { |
51 JAVASCRIPT_EXECUTION_ASSERT, | 51 JAVASCRIPT_EXECUTION_ASSERT, |
| 52 JAVASCRIPT_EXECUTION_THROWS, |
52 ALLOCATION_FAILURE_ASSERT | 53 ALLOCATION_FAILURE_ASSERT |
53 }; | 54 }; |
54 | 55 |
55 | 56 |
56 class PerThreadAssertData { | 57 class PerThreadAssertData { |
57 public: | 58 public: |
58 PerThreadAssertData() : nesting_level_(0) { | 59 PerThreadAssertData() : nesting_level_(0) { |
59 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) { | 60 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) { |
60 assert_states_[i] = true; | 61 assert_states_[i] = true; |
61 } | 62 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Per-isolate assert scopes. | 245 // Per-isolate assert scopes. |
245 | 246 |
246 // Scope to document where we do not expect javascript execution. | 247 // Scope to document where we do not expect javascript execution. |
247 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false> | 248 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false> |
248 DisallowJavascriptExecution; | 249 DisallowJavascriptExecution; |
249 | 250 |
250 // Scope to introduce an exception to DisallowJavascriptExecution. | 251 // Scope to introduce an exception to DisallowJavascriptExecution. |
251 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true> | 252 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true> |
252 AllowJavascriptExecution; | 253 AllowJavascriptExecution; |
253 | 254 |
| 255 // Scope in which javascript execution leads to exception being thrown. |
| 256 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false> |
| 257 ThrowOnJavascriptExecution; |
| 258 |
| 259 // Scope to introduce an exception to ThrowOnJavascriptExecution. |
| 260 typedef PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true> |
| 261 NoThrowOnJavascriptExecution; |
| 262 |
254 // Scope to document where we do not expect an allocation failure. | 263 // Scope to document where we do not expect an allocation failure. |
255 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, false> | 264 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, false> |
256 DisallowAllocationFailure; | 265 DisallowAllocationFailure; |
257 | 266 |
258 // Scope to introduce an exception to DisallowAllocationFailure. | 267 // Scope to introduce an exception to DisallowAllocationFailure. |
259 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, true> | 268 typedef PerIsolateAssertScopeDebugOnly<ALLOCATION_FAILURE_ASSERT, true> |
260 AllowAllocationFailure; | 269 AllowAllocationFailure; |
261 | 270 |
262 } } // namespace v8::internal | 271 } } // namespace v8::internal |
263 | 272 |
264 #endif // V8_ASSERT_SCOPE_H_ | 273 #endif // V8_ASSERT_SCOPE_H_ |
OLD | NEW |