1 // Copyright 2017 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_OBJECTS_DATA_HANDLER_INL_H_ 6 #define V8_OBJECTS_DATA_HANDLER_INL_H_ 7 8 #include "src/objects-inl.h" // Needed for write barriers 9 #include "src/objects/data-handler.h" 10 11 // Has to be the last include (doesn't have include guards): 12 #include "src/objects/object-macros.h" 13 14 namespace v8 { 15 namespace internal { 16 17 ACCESSORS(DataHandler, smi_handler, Object, kSmiHandlerOffset) 18 ACCESSORS(DataHandler, validity_cell, Object, kValidityCellOffset) 19 20 int DataHandler::data_field_count() const { 21 return (map()->instance_size() - kSizeWithData0) / kPointerSize; 22 } 23 24 WEAK_ACCESSORS_CHECKED(DataHandler, data1, kData1Offset, 25 map()->instance_size() >= kSizeWithData1) 26 WEAK_ACCESSORS_CHECKED(DataHandler, data2, kData2Offset, 27 map()->instance_size() >= kSizeWithData2) 28 WEAK_ACCESSORS_CHECKED(DataHandler, data3, kData3Offset, 29 map()->instance_size() >= kSizeWithData3) 30 31 } // namespace internal 32 } // namespace v8 33 34 #include "src/objects/object-macros-undef.h" 35 36 #endif // V8_OBJECTS_DATA_HANDLER_INL_H_ 37