| 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 23 matching lines...) Expand all Loading... |
| 34 namespace v8 { | 34 namespace v8 { |
| 35 namespace internal { | 35 namespace internal { |
| 36 | 36 |
| 37 class Isolate; | 37 class Isolate; |
| 38 | 38 |
| 39 enum PerThreadAssertType { | 39 enum PerThreadAssertType { |
| 40 HEAP_ALLOCATION_ASSERT, | 40 HEAP_ALLOCATION_ASSERT, |
| 41 HANDLE_ALLOCATION_ASSERT, | 41 HANDLE_ALLOCATION_ASSERT, |
| 42 HANDLE_DEREFERENCE_ASSERT, | 42 HANDLE_DEREFERENCE_ASSERT, |
| 43 DEFERRED_HANDLE_DEREFERENCE_ASSERT, | 43 DEFERRED_HANDLE_DEREFERENCE_ASSERT, |
| 44 CODE_DEPENDENCY_CHANGE_ASSERT, |
| 44 LAST_PER_THREAD_ASSERT_TYPE | 45 LAST_PER_THREAD_ASSERT_TYPE |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 | 48 |
| 48 #ifdef DEBUG | 49 #ifdef DEBUG |
| 49 class PerThreadAssertData { | 50 class PerThreadAssertData { |
| 50 public: | 51 public: |
| 51 PerThreadAssertData() : nesting_level_(0) { | 52 PerThreadAssertData() : nesting_level_(0) { |
| 52 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) { | 53 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) { |
| 53 assert_states_[i] = true; | 54 assert_states_[i] = true; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 AllowHandleDereference; | 164 AllowHandleDereference; |
| 164 | 165 |
| 165 // Scope to document where we do not expect deferred handles to be dereferenced. | 166 // Scope to document where we do not expect deferred handles to be dereferenced. |
| 166 typedef PerThreadAssertScope<DEFERRED_HANDLE_DEREFERENCE_ASSERT, false> | 167 typedef PerThreadAssertScope<DEFERRED_HANDLE_DEREFERENCE_ASSERT, false> |
| 167 DisallowDeferredHandleDereference; | 168 DisallowDeferredHandleDereference; |
| 168 | 169 |
| 169 // Scope to introduce an exception to DisallowDeferredHandleDereference. | 170 // Scope to introduce an exception to DisallowDeferredHandleDereference. |
| 170 typedef PerThreadAssertScope<DEFERRED_HANDLE_DEREFERENCE_ASSERT, true> | 171 typedef PerThreadAssertScope<DEFERRED_HANDLE_DEREFERENCE_ASSERT, true> |
| 171 AllowDeferredHandleDereference; | 172 AllowDeferredHandleDereference; |
| 172 | 173 |
| 174 // Scope to document where we do not expect deferred handles to be dereferenced. |
| 175 typedef PerThreadAssertScope<CODE_DEPENDENCY_CHANGE_ASSERT, false> |
| 176 DisallowCodeDependencyChange; |
| 177 |
| 178 // Scope to introduce an exception to DisallowDeferredHandleDereference. |
| 179 typedef PerThreadAssertScope<CODE_DEPENDENCY_CHANGE_ASSERT, true> |
| 180 AllowCodeDependencyChange; |
| 181 |
| 173 } } // namespace v8::internal | 182 } } // namespace v8::internal |
| 174 | 183 |
| 175 #endif // V8_ASSERT_SCOPE_H_ | 184 #endif // V8_ASSERT_SCOPE_H_ |
| OLD | NEW |