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_H_
6 #define V8_OBJECTS_TAGGED_VALUE_H_
7 
8 #include "src/objects/objects.h"
9 
10 #include "include/v8-internal.h"
11 #include "src/objects/tagged-impl.h"
12 
13 namespace v8 {
14 namespace internal {
15 
16 // Almost same as Object but this one deals with in-heap and potentially
17 // compressed representation of Objects and provide only limited functionality
18 // which doesn't require decompression.
19 class StrongTaggedValue
20     : public TaggedImpl<HeapObjectReferenceType::STRONG, Tagged_t> {
21  public:
StrongTaggedValue()22   constexpr StrongTaggedValue() : TaggedImpl() {}
StrongTaggedValue(Tagged_t ptr)23   explicit constexpr StrongTaggedValue(Tagged_t ptr) : TaggedImpl(ptr) {}
24   explicit StrongTaggedValue(Object o);
25 
26   inline static Object ToObject(Isolate* isolate, StrongTaggedValue object);
27 };
28 
29 // Almost same as MaybeObject but this one deals with in-heap and potentially
30 // compressed representation of Objects and provide only limited functionality
31 // which doesn't require decompression.
32 class TaggedValue : public TaggedImpl<HeapObjectReferenceType::WEAK, Tagged_t> {
33  public:
TaggedValue()34   constexpr TaggedValue() : TaggedImpl() {}
TaggedValue(Tagged_t ptr)35   explicit constexpr TaggedValue(Tagged_t ptr) : TaggedImpl(ptr) {}
36   explicit TaggedValue(MaybeObject o);
37 
38   inline static MaybeObject ToMaybeObject(Isolate* isolate, TaggedValue object);
39 };
40 
41 }  // namespace internal
42 }  // namespace v8
43 
44 #endif  // V8_OBJECTS_TAGGED_VALUE_H_
45