| 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 "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/utils.h" | 10 #include "src/utils.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (data_ == NULL) { | 67 if (data_ == NULL) { |
| 68 data_ = new PerThreadAssertData(); | 68 data_ = new PerThreadAssertData(); |
| 69 SetThreadLocalData(data_); | 69 SetThreadLocalData(data_); |
| 70 } | 70 } |
| 71 data_->increment_level(); | 71 data_->increment_level(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 ~PerThreadAssertScopeBase() { | 74 ~PerThreadAssertScopeBase() { |
| 75 if (!data_->decrement_level()) return; | 75 if (!data_->decrement_level()) return; |
| 76 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) { | 76 for (int i = 0; i < LAST_PER_THREAD_ASSERT_TYPE; i++) { |
| 77 ASSERT(data_->get(static_cast<PerThreadAssertType>(i))); | 77 DCHECK(data_->get(static_cast<PerThreadAssertType>(i))); |
| 78 } | 78 } |
| 79 delete data_; | 79 delete data_; |
| 80 SetThreadLocalData(NULL); | 80 SetThreadLocalData(NULL); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static PerThreadAssertData* GetAssertData() { | 83 static PerThreadAssertData* GetAssertData() { |
| 84 return reinterpret_cast<PerThreadAssertData*>( | 84 return reinterpret_cast<PerThreadAssertData*>( |
| 85 base::Thread::GetThreadLocal(thread_local_key)); | 85 base::Thread::GetThreadLocal(thread_local_key)); |
| 86 } | 86 } |
| 87 | 87 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Scope to document where we do not expect deoptimization. | 258 // Scope to document where we do not expect deoptimization. |
| 259 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false> | 259 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false> |
| 260 DisallowCompilation; | 260 DisallowCompilation; |
| 261 | 261 |
| 262 // Scope to introduce an exception to DisallowDeoptimization. | 262 // Scope to introduce an exception to DisallowDeoptimization. |
| 263 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true> | 263 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true> |
| 264 AllowCompilation; | 264 AllowCompilation; |
| 265 } } // namespace v8::internal | 265 } } // namespace v8::internal |
| 266 | 266 |
| 267 #endif // V8_ASSERT_SCOPE_H_ | 267 #endif // V8_ASSERT_SCOPE_H_ |
| OLD | NEW |