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 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 24 matching lines...) Expand all Loading... |
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 |
| 45 void Release(); |
| 46 |
45 private: | 47 private: |
46 PerThreadAssertData* data_; | 48 PerThreadAssertData* data_; |
47 bool old_state_; | 49 bool old_state_; |
48 | 50 |
49 DISALLOW_COPY_AND_ASSIGN(PerThreadAssertScope); | 51 DISALLOW_COPY_AND_ASSIGN(PerThreadAssertScope); |
50 }; | 52 }; |
51 | 53 |
52 | 54 |
53 template <PerIsolateAssertType type, bool allow> | 55 template <PerIsolateAssertType type, bool allow> |
54 class PerIsolateAssertScope { | 56 class PerIsolateAssertScope { |
(...skipping 14 matching lines...) Expand all Loading... |
69 | 71 |
70 | 72 |
71 template <PerThreadAssertType type, bool allow> | 73 template <PerThreadAssertType type, bool allow> |
72 #ifdef DEBUG | 74 #ifdef DEBUG |
73 class PerThreadAssertScopeDebugOnly : public | 75 class PerThreadAssertScopeDebugOnly : public |
74 PerThreadAssertScope<type, allow> { | 76 PerThreadAssertScope<type, allow> { |
75 #else | 77 #else |
76 class PerThreadAssertScopeDebugOnly { | 78 class PerThreadAssertScopeDebugOnly { |
77 public: | 79 public: |
78 PerThreadAssertScopeDebugOnly() { } | 80 PerThreadAssertScopeDebugOnly() { } |
| 81 void Release() {} |
79 #endif | 82 #endif |
80 }; | 83 }; |
81 | 84 |
82 | 85 |
83 template <PerIsolateAssertType type, bool allow> | 86 template <PerIsolateAssertType type, bool allow> |
84 #ifdef DEBUG | 87 #ifdef DEBUG |
85 class PerIsolateAssertScopeDebugOnly : public | 88 class PerIsolateAssertScopeDebugOnly : public |
86 PerIsolateAssertScope<type, allow> { | 89 PerIsolateAssertScope<type, allow> { |
87 public: | 90 public: |
88 explicit PerIsolateAssertScopeDebugOnly(Isolate* isolate) | 91 explicit PerIsolateAssertScopeDebugOnly(Isolate* isolate) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false> | 170 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, false> |
168 DisallowCompilation; | 171 DisallowCompilation; |
169 | 172 |
170 // Scope to introduce an exception to DisallowDeoptimization. | 173 // Scope to introduce an exception to DisallowDeoptimization. |
171 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true> | 174 typedef PerIsolateAssertScopeDebugOnly<COMPILATION_ASSERT, true> |
172 AllowCompilation; | 175 AllowCompilation; |
173 } // namespace internal | 176 } // namespace internal |
174 } // namespace v8 | 177 } // namespace v8 |
175 | 178 |
176 #endif // V8_ASSERT_SCOPE_H_ | 179 #endif // V8_ASSERT_SCOPE_H_ |
OLD | NEW |