1 // Copyright 2019 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_EXECUTION_PROTECTORS_INL_H_ 6 #define V8_EXECUTION_PROTECTORS_INL_H_ 7 8 #include "src/execution/protectors.h" 9 #include "src/objects/contexts-inl.h" 10 #include "src/objects/property-cell-inl.h" 11 #include "src/objects/smi.h" 12 13 namespace v8 { 14 namespace internal { 15 16 #define DEFINE_PROTECTOR_ON_ISOLATE_CHECK(name, root_index, unused_cell) \ 17 bool Protectors::Is##name##Intact(Isolate* isolate) { \ 18 PropertyCell cell = \ 19 PropertyCell::cast(isolate->root(RootIndex::k##root_index)); \ 20 return cell.value().IsSmi() && \ 21 Smi::ToInt(cell.value()) == kProtectorValid; \ 22 } 23 DECLARED_PROTECTORS_ON_ISOLATE(DEFINE_PROTECTOR_ON_ISOLATE_CHECK) 24 #undef DEFINE_PROTECTORS_ON_ISOLATE_CHECK 25 26 } // namespace internal 27 } // namespace v8 28 29 #endif // V8_EXECUTION_PROTECTORS_INL_H_ 30