1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_MARKER_CELL_H 17 #define ECMASCRIPT_MARKER_CELL_H 18 19 #include "ecmascript/ecma_macros.h" 20 #include "ecmascript/js_handle.h" 21 #include "ecmascript/js_tagged_value.h" 22 23 namespace panda { 24 namespace ecmascript { 25 class MarkerCell : public TaggedObject { 26 public: Cast(TaggedObject * object)27 static MarkerCell *Cast(TaggedObject *object) 28 { 29 ASSERT(JSTaggedValue(object).IsMarkerCell()); 30 return static_cast<MarkerCell *>(object); 31 } 32 33 static constexpr size_t BIT_FIELD_OFFSET = TaggedObjectSize(); 34 ACCESSORS_BIT_FIELD(BitField, BIT_FIELD_OFFSET, LAST_OFFSET) 35 DEFINE_ALIGN_SIZE(LAST_OFFSET); 36 DECL_VISIT_PRIMITIVE_OBJECT() 37 38 // define BitField 39 static constexpr size_t IS_DETECTOR_INVALID_BITS = 1; 40 FIRST_BIT_FIELD(BitField, IsDetectorInvalid, bool, IS_DETECTOR_INVALID_BITS); 41 DECL_DUMP()42 DECL_DUMP() 43 44 inline void InvalidatePropertyDetector() 45 { 46 SetIsDetectorInvalid(true); 47 } 48 }; 49 50 } // namespace ecmascript 51 } // namespace panda 52 53 #endif // ECMASCRIPT_MARKER_CELL_H 54