v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
representation-change.h
Go to the documentation of this file.
1// Copyright 2014 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_COMPILER_REPRESENTATION_CHANGE_H_
6#define V8_COMPILER_REPRESENTATION_CHANGE_H_
7
12
13namespace v8 {
14namespace internal {
15namespace compiler {
16
17// Foward declarations.
18class SimplifiedLoweringVerifier;
19class TypeCache;
20
21// Contains logic related to changing the representation of values for constants
22// and other nodes, as well as lowering Simplified->Machine operators.
23// Eagerly folds any representation changes for constants.
25 public:
28
29 // Changes representation from {output_type} to {use_rep}. The {truncation}
30 // parameter is only used for checking - if the changer cannot figure
31 // out signedness for the word32->float64 conversion, then we check that the
32 // uses truncate to word32 (so they do not care about signedness).
33 Node* GetRepresentationFor(Node* node, MachineRepresentation output_rep,
34 Type output_type, Node* use_node,
35 UseInfo use_info);
36 const Operator* Int32OperatorFor(IrOpcode::Value opcode);
37 const Operator* Int32OverflowOperatorFor(IrOpcode::Value opcode);
38 const Operator* AdditiveSafeIntegerOverflowOperatorFor(
39 IrOpcode::Value opcode);
40 const Operator* Int64OperatorFor(IrOpcode::Value opcode);
41 const Operator* Int64OverflowOperatorFor(IrOpcode::Value opcode);
42 const Operator* BigIntOperatorFor(IrOpcode::Value opcode);
43 const Operator* TaggedSignedOperatorFor(IrOpcode::Value opcode);
44 const Operator* Uint32OperatorFor(IrOpcode::Value opcode);
45 const Operator* Uint32OverflowOperatorFor(IrOpcode::Value opcode);
46 const Operator* Float64OperatorFor(IrOpcode::Value opcode);
47
49 return access.tag() != 0 ? MachineType::AnyTagged()
50 : MachineType::Pointer();
51 }
52
54 return access.tag() != 0 ? MachineType::AnyTagged()
55 : MachineType::Pointer();
56 }
57
58 bool verification_enabled() const { return verifier_ != nullptr; }
59
60 private:
65
66 friend class RepresentationChangerTester; // accesses the below fields.
67
68 bool testing_type_errors_; // If {true}, don't abort on a type error.
69 bool type_error_; // Set when a type error is detected.
70
76
77 Node* GetTaggedSignedRepresentationFor(Node* node,
78 MachineRepresentation output_rep,
79 Type output_type, Node* use_node,
80 UseInfo use_info);
81 Node* GetTaggedPointerRepresentationFor(Node* node,
82 MachineRepresentation output_rep,
83 Type output_type, Node* use_node,
84 UseInfo use_info);
85 Node* GetTaggedRepresentationFor(Node* node, MachineRepresentation output_rep,
86 Type output_type, Truncation truncation);
87 Node* GetFloat16RawBitsRepresentationFor(Node* node,
88 MachineRepresentation output_rep,
89 Type output_type, Node* use_node,
90 UseInfo use_info);
91 Node* GetFloat32RepresentationFor(Node* node,
92 MachineRepresentation output_rep,
93 Type output_type, Truncation truncation);
94 Node* GetFloat64RepresentationFor(Node* node,
95 MachineRepresentation output_rep,
96 Type output_type, Node* use_node,
97 UseInfo use_info);
98 Node* GetWord32RepresentationFor(Node* node, MachineRepresentation output_rep,
99 Type output_type, Node* use_node,
100 UseInfo use_info);
101 Node* GetBitRepresentationFor(Node* node, MachineRepresentation output_rep,
102 Type output_type);
103 Node* GetWord64RepresentationFor(Node* node, MachineRepresentation output_rep,
104 Type output_type, Node* use_node,
105 UseInfo use_info);
106 Node* TypeError(Node* node, MachineRepresentation output_rep,
107 Type output_type, MachineRepresentation use);
108 Node* MakeTruncatedInt32Constant(double value);
109 Node* InsertChangeBitToTagged(Node* node);
110 Node* InsertChangeFloat32ToFloat64(Node* node);
111 Node* InsertChangeFloat64ToInt32(Node* node);
112 Node* InsertChangeFloat64ToUint32(Node* node);
113 Node* InsertChangeInt32ToFloat64(Node* node);
114 Node* InsertChangeTaggedSignedToInt32(Node* node);
115 Node* InsertChangeTaggedToFloat64(Node* node);
116 Node* InsertChangeUint32ToFloat64(Node* node);
117 Node* InsertCheckedFloat64ToInt32(Node* node, CheckForMinusZeroMode check,
118 const FeedbackSource& feedback,
119 Node* use_node);
120 Node* InsertChangeFloat16RawBitsToFloat64Fallback(Node* node);
121 Node* InsertTruncateFloat64ToFloat16RawBitsFallback(Node* node);
122 Node* InsertConversion(Node* node, const Operator* op, Node* use_node);
123 Node* InsertTruncateInt64ToInt32(Node* node);
124 Node* InsertUnconditionalDeopt(Node* node, DeoptimizeReason reason,
125 const FeedbackSource& feedback = {});
126 Node* InsertTypeOverrideForVerifier(const Type& type, Node* node);
127
128 Node* Ieee754Fp16RawBitsToFp32RawBitsCode();
129 Node* Ieee754Fp64ToFp16RawBitsCode();
130 Operator const* Ieee754Fp16RawBitsToFp32RawBitsOperator();
131 Operator const* Ieee754Fp64ToFp16RawBitsOperator();
132
133 JSGraph* jsgraph() const { return jsgraph_; }
134 Isolate* isolate() const;
135 Factory* factory() const { return isolate()->factory(); }
136 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); }
137 MachineOperatorBuilder* machine() { return jsgraph()->machine(); }
138};
139
140} // namespace compiler
141} // namespace internal
142} // namespace v8
143
144#endif // V8_COMPILER_REPRESENTATION_CHANGE_H_
JSGraph * jsgraph
SetOncePointer< Operator const > ieee754_fp64_to_fp16_raw_bits_operator_
SetOncePointer< Node > ieee754_fp16_raw_bits_to_fp32_raw_bits_code_
SetOncePointer< Operator const > ieee754_fp16_raw_bits_to_fp32_raw_bits_operator_
MachineType TypeForBasePointer(const FieldAccess &access)
MachineType TypeForBasePointer(const ElementAccess &access)
Isolate * isolate
JSHeapBroker * broker
SimplifiedLoweringVerifier * verifier_
#define V8_EXPORT_PRIVATE
Definition macros.h:460