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_FOREIGN_INL_H_
6 : #define V8_OBJECTS_FOREIGN_INL_H_
7 :
8 : #include "src/objects/foreign.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 51735682 : OBJECT_CONSTRUCTORS_IMPL(Foreign, HeapObject)
19 :
20 25867841 : CAST_ACCESSOR(Foreign)
21 :
22 : // static
23 : bool Foreign::IsNormalized(Object value) {
24 : if (value == Smi::kZero) return true;
25 : return Foreign::cast(value)->foreign_address() != kNullAddress;
26 : }
27 :
28 : Address Foreign::foreign_address() {
29 26085527 : return READ_UINTPTR_FIELD(this, kForeignAddressOffset);
30 : }
31 :
32 : void Foreign::set_foreign_address(Address value) {
33 11353701 : WRITE_UINTPTR_FIELD(this, kForeignAddressOffset, value);
34 : }
35 :
36 : } // namespace internal
37 : } // namespace v8
38 :
39 : #include "src/objects/object-macros-undef.h"
40 :
41 : #endif // V8_OBJECTS_FOREIGN_INL_H_
|