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/property-cell-inl.h" 10 #include "src/objects/smi.h" 11 12 namespace v8 { 13 namespace internal { 14 15 #define DEFINE_PROTECTOR_ON_ISOLATE_CHECK(name, root_index, unused_cell) \ 16 bool Protectors::Is##name##Intact(Isolate* isolate) { \ 17 PropertyCell cell = \ 18 PropertyCell::cast(isolate->root(RootIndex::k##root_index)); \ 19 return cell.value().IsSmi() && \ 20 Smi::ToInt(cell.value()) == kProtectorValid; \ 21 } 22 DECLARED_PROTECTORS_ON_ISOLATE(DEFINE_PROTECTOR_ON_ISOLATE_CHECK) 23 #undef DEFINE_PROTECTORS_ON_ISOLATE_CHECK 24 25 } // namespace internal 26 } // namespace v8 27 28 #endif // V8_EXECUTION_PROTECTORS_INL_H_ 29