v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
property-array.h
Go to the documentation of this file.
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
9
10// Has to be the last include (doesn't have include guards):
12
13namespace v8 {
14namespace internal {
15
16#include "torque-generated/src/objects/property-array-tq.inc"
17
19 : public TorqueGeneratedPropertyArray<PropertyArray, HeapObject> {
20 public:
21 // [length]: length of the array.
22 inline int length() const;
23 inline int length(AcquireLoadTag) const;
24
25 // This is only used on a newly allocated PropertyArray which
26 // doesn't have an existing hash.
27 inline void initialize_length(int length);
28
29 inline void SetHash(int hash);
30 inline int Hash() const;
31
32 inline Tagged<JSAny> get(int index) const;
33 inline Tagged<JSAny> get(PtrComprCageBase cage_base, int index) const;
34 inline Tagged<JSAny> get(int index, SeqCstAccessTag tag) const;
35 inline Tagged<JSAny> get(PtrComprCageBase cage_base, int index,
36 SeqCstAccessTag tag) const;
37
38 inline void set(int index, Tagged<Object> value);
39 inline void set(int index, Tagged<Object> value, SeqCstAccessTag tag);
40 // Setter with explicit barrier mode.
41 inline void set(int index, Tagged<Object> value, WriteBarrierMode mode);
42
43 inline Tagged<Object> Swap(int index, Tagged<Object> value,
44 SeqCstAccessTag tag);
45 inline Tagged<Object> Swap(PtrComprCageBase cage_base, int index,
47
48 inline Tagged<Object> CompareAndSwap(int index, Tagged<Object> expected,
49 Tagged<Object> value,
50 SeqCstAccessTag tag);
51
52 // Signature must be in sync with FixedArray::CopyElements().
53 inline static void CopyElements(Isolate* isolate, Tagged<PropertyArray> dst,
54 int dst_index, Tagged<PropertyArray> src,
55 int src_index, int len,
57
58 // Gives access to raw memory which stores the array's data.
59 inline ObjectSlot data_start();
60 inline ObjectSlot RawFieldOfElementAt(int index);
61
62 // Garbage collection support.
63 static constexpr int SizeFor(int length) {
64 return kHeaderSize + length * kTaggedSize;
65 }
66 static constexpr int OffsetOfElementAt(int index) { return SizeFor(index); }
67
70
71 // Garbage collection support.
73
74 static const int kLengthFieldSize = 10;
75 using LengthField = base::BitField<int, 0, kLengthFieldSize>;
76 static const int kMaxLength = LengthField::kMax;
77 using HashField = base::BitField<int, kLengthFieldSize,
79
80 static const int kNoHashSentinel = 0;
81
82 private:
83 DECL_INT_ACCESSORS(length_and_hash)
84
86
88};
89
90} // namespace internal
91} // namespace v8
92
93#include "src/objects/object-macros-undef.h"
94
95#endif // V8_OBJECTS_PROPERTY_ARRAY_H_
static void CopyElements(Isolate *isolate, Tagged< PropertyArray > dst, int dst_index, Tagged< PropertyArray > src, int src_index, int len, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Tagged< Object > Swap(int index, Tagged< Object > value, SeqCstAccessTag tag)
void set(int index, Tagged< Object > value)
Tagged< JSAny > get(PtrComprCageBase cage_base, int index) const
Tagged< Object > CompareAndSwap(int index, Tagged< Object > expected, Tagged< Object > value, SeqCstAccessTag tag)
static constexpr int OffsetOfElementAt(int index)
static const int kLengthFieldSize
Tagged< JSAny > get(int index) const
static constexpr int SizeFor(int length)
ObjectSlot RawFieldOfElementAt(int index)
Tagged< JSAny > get(PtrComprCageBase cage_base, int index, SeqCstAccessTag tag) const
static const int kNoHashSentinel
Tagged< JSAny > get(int index, SeqCstAccessTag tag) const
constexpr int kTaggedSize
Definition globals.h:542
@ UPDATE_WRITE_BARRIER
Definition objects.h:55
const int kSmiValueSize
#define DECL_VERIFIER(Name)
#define DECL_RELEASE_ACQUIRE_INT_ACCESSORS(name)
#define DECL_PRINTER(Name)
#define DECL_INT_ACCESSORS(name)
#define TQ_OBJECT_CONSTRUCTORS(Type)