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_HEAP_OBJECT_INL_H_
6 : #define V8_OBJECTS_HEAP_OBJECT_INL_H_
7 :
8 : #include "src/objects/heap-object.h"
9 :
10 : #include "src/heap/heap-write-barrier-inl.h"
11 : // TODO(jkummerow): Get rid of this by moving NROSO::GetIsolate elsewhere.
12 : #include "src/isolate.h"
13 :
14 : // Has to be the last include (doesn't have include guards):
15 : #include "src/objects/object-macros.h"
16 :
17 : namespace v8 {
18 : namespace internal {
19 :
20 43470128353 : OBJECT_CONSTRUCTORS_IMPL(HeapObject, Object)
21 21917152824 : CAST_ACCESSOR(HeapObject)
22 :
23 5824 : HeapObject::HeapObject(Address ptr, AllowInlineSmiStorage allow_smi)
24 5824 : : Object(ptr) {
25 : SLOW_DCHECK(
26 : (allow_smi == AllowInlineSmiStorage::kAllowBeingASmi && IsSmi()) ||
27 : IsHeapObject());
28 5824 : }
29 :
30 161024214 : HeapObject HeapObject::FromAddress(Address address) {
31 : DCHECK_TAG_ALIGNED(address);
32 2346974944 : return HeapObject(address + kHeapObjectTag);
33 : }
34 :
35 : Heap* NeverReadOnlySpaceObject::GetHeap(const HeapObject object) {
36 543820671 : return GetHeapFromWritableObject(object);
37 : }
38 :
39 : Isolate* NeverReadOnlySpaceObject::GetIsolate(const HeapObject object) {
40 : return Isolate::FromHeap(GetHeap(object));
41 : }
42 :
43 : } // namespace internal
44 : } // namespace v8
45 :
46 : #include "src/objects/object-macros-undef.h"
47 :
48 : #endif // V8_OBJECTS_HEAP_OBJECT_INL_H_
|