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 :
12 : // Has to be the last include (doesn't have include guards):
13 : #include "src/objects/object-macros.h"
14 :
15 : namespace v8 {
16 : namespace internal {
17 :
18 : HeapObject::HeapObject(Address ptr, AllowInlineSmiStorage allow_smi)
19 : : Object(ptr) {
20 : SLOW_DCHECK(
21 : (allow_smi == AllowInlineSmiStorage::kAllowBeingASmi && IsSmi()) ||
22 : IsHeapObject());
23 : }
24 :
25 160247331 : HeapObject HeapObject::FromAddress(Address address) {
26 : DCHECK_TAG_ALIGNED(address);
27 2349645186 : return HeapObject(address + kHeapObjectTag);
28 : }
29 :
30 : Heap* NeverReadOnlySpaceObject::GetHeap(const HeapObject object) {
31 599035441 : return GetHeapFromWritableObject(object);
32 : }
33 :
34 : Isolate* NeverReadOnlySpaceObject::GetIsolate(const HeapObject object) {
35 : return GetHeap(object)->isolate();
36 : }
37 :
38 : } // namespace internal
39 : } // namespace v8
40 :
41 : #include "src/objects/object-macros-undef.h"
42 :
43 : #endif // V8_OBJECTS_HEAP_OBJECT_INL_H_
|