LCOV - code coverage report
Current view: top level - src/objects - property-array.h (source / functions) Hit Total Coverage
Test: app.info Lines: 2 2 100.0 %
Date: 2019-02-19 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // Copyright 2018 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_PROPERTY_ARRAY_H_
       6             : #define V8_OBJECTS_PROPERTY_ARRAY_H_
       7             : 
       8             : #include "src/objects/heap-object.h"
       9             : 
      10             : // Has to be the last include (doesn't have include guards):
      11             : #include "src/objects/object-macros.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : 
      16             : class PropertyArray : public HeapObject {
      17             :  public:
      18             :   // [length]: length of the array.
      19             :   inline int length() const;
      20             : 
      21             :   // Get the length using acquire loads.
      22             :   inline int synchronized_length() const;
      23             : 
      24             :   // This is only used on a newly allocated PropertyArray which
      25             :   // doesn't have an existing hash.
      26             :   inline void initialize_length(int length);
      27             : 
      28             :   inline void SetHash(int hash);
      29             :   inline int Hash() const;
      30             : 
      31             :   inline Object get(int index) const;
      32             : 
      33             :   inline void set(int index, Object value);
      34             :   // Setter with explicit barrier mode.
      35             :   inline void set(int index, Object value, WriteBarrierMode mode);
      36             : 
      37             :   // Gives access to raw memory which stores the array's data.
      38             :   inline ObjectSlot data_start();
      39             : 
      40             :   // Garbage collection support.
      41             :   static constexpr int SizeFor(int length) {
      42   586776013 :     return kHeaderSize + length * kTaggedSize;
      43             :   }
      44             :   static constexpr int OffsetOfElementAt(int index) { return SizeFor(index); }
      45             : 
      46             :   DECL_CAST(PropertyArray)
      47             :   DECL_PRINTER(PropertyArray)
      48             :   DECL_VERIFIER(PropertyArray)
      49             : 
      50             : // Layout description.
      51             : #define PROPERTY_ARRAY_FIELDS(V)       \
      52             :   V(kLengthAndHashOffset, kTaggedSize) \
      53             :   /* Header size. */                   \
      54             :   V(kHeaderSize, 0)
      55             : 
      56             :   DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, PROPERTY_ARRAY_FIELDS)
      57             : #undef PROPERTY_ARRAY_FIELDS
      58             : 
      59             :   // Garbage collection support.
      60             :   typedef FlexibleBodyDescriptor<kHeaderSize> BodyDescriptor;
      61             : 
      62             :   static const int kLengthFieldSize = 10;
      63             :   class LengthField : public BitField<int, 0, kLengthFieldSize> {};
      64             :   static const int kMaxLength = LengthField::kMax;
      65             :   class HashField : public BitField<int, kLengthFieldSize,
      66             :                                     kSmiValueSize - kLengthFieldSize - 1> {};
      67             : 
      68             :   static const int kNoHashSentinel = 0;
      69             : 
      70     5532283 :   OBJECT_CONSTRUCTORS(PropertyArray, HeapObject);
      71             : };
      72             : 
      73             : }  // namespace internal
      74             : }  // namespace v8
      75             : 
      76             : #include "src/objects/object-macros-undef.h"
      77             : 
      78             : #endif  // V8_OBJECTS_PROPERTY_ARRAY_H_

Generated by: LCOV version 1.10