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 30609124 : OBJECT_CONSTRUCTORS_IMPL(HeapObject, Object)
21 10530903 : CAST_ACCESSOR(HeapObject)
22 :
23 : HeapObject::HeapObject(Address ptr, AllowInlineSmiStorage allow_smi)
24 : : Object(ptr) {
25 : SLOW_DCHECK(
26 : (allow_smi == AllowInlineSmiStorage::kAllowBeingASmi && IsSmi()) ||
27 : IsHeapObject());
28 : }
29 :
30 : // static
31 402416 : HeapObject HeapObject::FromAddress(Address address) {
32 : DCHECK_TAG_ALIGNED(address);
33 2233556800 : return HeapObject(address + kHeapObjectTag);
34 : }
35 :
36 : // static
37 : Heap* NeverReadOnlySpaceObject::GetHeap(const HeapObject object) {
38 : return GetHeapFromWritableObject(object);
39 : }
40 :
41 : // static
42 : Isolate* NeverReadOnlySpaceObject::GetIsolate(const HeapObject object) {
43 : return Isolate::FromHeap(GetHeap(object));
44 : }
45 :
46 : } // namespace internal
47 : } // namespace v8
48 :
49 : #include "src/objects/object-macros-undef.h"
50 :
51 : #endif // V8_OBJECTS_HEAP_OBJECT_INL_H_
|