• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 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_TAGGED_VALUE_INL_H_
6 #define V8_OBJECTS_TAGGED_VALUE_INL_H_
7 
8 #include "src/objects/tagged-value.h"
9 
10 #include "include/v8-internal.h"
11 #include "src/common/ptr-compr-inl.h"
12 #include "src/objects/maybe-object.h"
13 #include "src/objects/objects.h"
14 #include "src/objects/oddball.h"
15 #include "src/objects/tagged-impl-inl.h"
16 #include "src/roots/roots-inl.h"
17 
18 namespace v8 {
19 namespace internal {
20 
StrongTaggedValue(Object o)21 inline StrongTaggedValue::StrongTaggedValue(Object o)
22     :
23 #ifdef V8_COMPRESS_POINTERS
24       TaggedImpl(CompressTagged(o.ptr()))
25 #else
26       TaggedImpl(o.ptr())
27 #endif
28 {
29 }
30 
ToObject(Isolate * isolate,StrongTaggedValue object)31 Object StrongTaggedValue::ToObject(Isolate* isolate, StrongTaggedValue object) {
32 #ifdef V8_COMPRESS_POINTERS
33   return Object(DecompressTaggedAny(isolate, object.ptr()));
34 #else
35   return Object(object.ptr());
36 #endif
37 }
38 
TaggedValue(MaybeObject o)39 inline TaggedValue::TaggedValue(MaybeObject o)
40     :
41 #ifdef V8_COMPRESS_POINTERS
42       TaggedImpl(CompressTagged(o.ptr()))
43 #else
44       TaggedImpl(o.ptr())
45 #endif
46 {
47 }
48 
ToMaybeObject(Isolate * isolate,TaggedValue object)49 MaybeObject TaggedValue::ToMaybeObject(Isolate* isolate, TaggedValue object) {
50 #ifdef V8_COMPRESS_POINTERS
51   return MaybeObject(DecompressTaggedAny(isolate, object.ptr()));
52 #else
53   return MaybeObject(object.ptr());
54 #endif
55 }
56 
57 }  // namespace internal
58 }  // namespace v8
59 
60 #endif  // V8_OBJECTS_TAGGED_VALUE_INL_H_
61