v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
machine-graph.cc
Go to the documentation of this file.
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
6
8
9namespace v8 {
10namespace internal {
11namespace compiler {
12
14 return graph()->NewNode(common()->Int32Constant(value));
15}
16
18 return graph()->NewNode(common()->Int64Constant(value));
19}
20
22 Node** loc = cache_.FindInt32Constant(value);
23 if (*loc == nullptr) {
24 *loc = UniqueInt32Constant(value);
25 }
26 return *loc;
27}
28
30 Node** loc = cache_.FindInt64Constant(value);
31 if (*loc == nullptr) {
32 *loc = UniqueInt64Constant(value);
33 }
34 return *loc;
35}
36
38 return machine()->Is32() ? Int32Constant(static_cast<int32_t>(value))
39 : Int64Constant(static_cast<int64_t>(value));
40}
41
43 return machine()->Is32() ? Uint32Constant(static_cast<uint32_t>(value))
44 : Uint64Constant(static_cast<uint64_t>(value));
45}
46
48 return machine()->Is32() ? UniqueInt32Constant(static_cast<int32_t>(value))
49 : UniqueInt64Constant(static_cast<int64_t>(value));
50}
51
53 int32_t value32 = static_cast<int32_t>(value);
54 Node** loc = cache_.FindTaggedIndexConstant(value32);
55 if (*loc == nullptr) {
56 *loc = graph()->NewNode(common()->TaggedIndexConstant(value32));
57 }
58 return *loc;
59}
60
62 RelocInfo::Mode rmode) {
64 value, static_cast<RelocInfoMode>(rmode));
65 if (*loc == nullptr) {
66 *loc = graph()->NewNode(common()->RelocatableInt32Constant(value, rmode));
67 }
68 return *loc;
69}
70
72 RelocInfo::Mode rmode) {
74 value, static_cast<RelocInfoMode>(rmode));
75 if (*loc == nullptr) {
76 *loc = graph()->NewNode(common()->RelocatableInt64Constant(value, rmode));
77 }
78 return *loc;
79}
80
82 RelocInfo::Mode rmode) {
83 return kSystemPointerSize == 8
84 ? RelocatableInt64Constant(value, rmode)
85 : RelocatableInt32Constant(static_cast<int>(value), rmode);
86}
87
92
94 Node** loc = cache_.FindFloat32Constant(value);
95 if (*loc == nullptr) {
96 *loc = graph()->NewNode(common()->Float32Constant(value));
97 }
98 return *loc;
99}
100
102 Node** loc = cache_.FindFloat64Constant(value);
103 if (*loc == nullptr) {
104 *loc = graph()->NewNode(common()->Float64Constant(value));
105 }
106 return *loc;
107}
108
110 Node** loc = cache_.FindPointerConstant(value);
111 if (*loc == nullptr) {
112 *loc = graph()->NewNode(common()->PointerConstant(value));
113 }
114 return *loc;
115}
116
118 Node** loc = cache_.FindExternalConstant(reference);
119 if (*loc == nullptr) {
120 *loc = graph()->NewNode(common()->ExternalConstant(reference));
121 }
122 return *loc;
123}
124
128
129} // namespace compiler
130} // namespace internal
131} // namespace v8
static ExternalReference Create(const SCTableReference &table_ref)
Node ** FindRelocatableInt32Constant(int32_t value, RelocInfoMode rmode)
Node ** FindExternalConstant(ExternalReference value)
Node ** FindRelocatableInt64Constant(int64_t value, RelocInfoMode rmode)
Node * UintPtrConstant(uintptr_t value)
Node * RelocatableInt64Constant(int64_t value, RelocInfo::Mode rmode)
Node * Uint64Constant(uint64_t value)
Node * UniqueInt32Constant(int32_t value)
Node * UniqueInt64Constant(int64_t value)
Node * ExternalConstant(ExternalReference ref)
Node * RelocatableWasmBuiltinCallTarget(Builtin builtin)
CommonOperatorBuilder * common() const
Node * RelocatableIntPtrConstant(intptr_t value, RelocInfo::Mode rmode)
Node * TaggedIndexConstant(intptr_t value)
Node * IntPtrConstant(intptr_t value)
MachineOperatorBuilder * machine() const
Node * RelocatableInt32Constant(int32_t value, RelocInfo::Mode rmode)
Node * PointerConstant(intptr_t value)
Node * Uint32Constant(uint32_t value)
Node * UniqueIntPtrConstant(intptr_t value)
Node * NewNode(const Operator *op, int input_count, Node *const *inputs, bool incomplete=false)
constexpr int kSystemPointerSize
Definition globals.h:410
return value
Definition map-inl.h:893