5 #ifndef V8_ASSERT_SCOPE_H_ 6 #define V8_ASSERT_SCOPE_H_ 10 #include "src/base/macros.h" 11 #include "src/globals.h" 12 #include "src/pointer-with-payload.h" 19 class PerThreadAssertData;
23 static constexpr
int value = 1;
26 enum PerThreadAssertType {
27 HEAP_ALLOCATION_ASSERT,
28 HANDLE_ALLOCATION_ASSERT,
29 HANDLE_DEREFERENCE_ASSERT,
30 DEFERRED_HANDLE_DEREFERENCE_ASSERT,
31 CODE_DEPENDENCY_CHANGE_ASSERT,
32 LAST_PER_THREAD_ASSERT_TYPE
35 enum PerIsolateAssertType {
36 JAVASCRIPT_EXECUTION_ASSERT,
37 JAVASCRIPT_EXECUTION_THROWS,
38 JAVASCRIPT_EXECUTION_DUMP,
39 DEOPTIMIZATION_ASSERT,
44 template <PerThreadAssertType kType,
bool kAllow>
50 V8_EXPORT_PRIVATE
static bool IsAllowed();
58 data_and_old_state_.SetPointer(data);
62 return data_and_old_state_.GetPointer();
65 V8_INLINE
void set_old_state(
bool old_state) {
66 return data_and_old_state_.SetPayload(old_state);
69 V8_INLINE
bool old_state()
const {
return data_and_old_state_.GetPayload(); }
75 template <PerIsolateAssertType type,
bool allow>
81 static bool IsAllowed(
Isolate* isolate);
93 template <PerThreadAssertType type,
bool allow>
108 template <PerIsolateAssertType type,
bool allow>
136 #define DISALLOW_HEAP_ALLOCATION(name) DisallowHeapAllocation name 138 #define DISALLOW_HEAP_ALLOCATION(name) 236 #endif // V8_ASSERT_SCOPE_H_