v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
operation-typer.h
Go to the documentation of this file.
1// Copyright 2016 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_OPERATION_TYPER_H_
6#define V8_COMPILER_OPERATION_TYPER_H_
7
8#include "src/base/flags.h"
11
12#define TYPER_SUPPORTED_MACHINE_BINOP_LIST(V) \
13 V(Int32Add) \
14 V(Int32LessThanOrEqual) \
15 V(Int64Add) \
16 V(Int32Sub) \
17 V(Int64Sub) \
18 V(Load) \
19 V(Uint32Div) \
20 V(Uint64Div) \
21 V(Uint32LessThan) \
22 V(Uint32LessThanOrEqual) \
23 V(Uint64LessThan) \
24 V(Uint64LessThanOrEqual) \
25 V(Word32And) \
26 V(Word32Equal) \
27 V(Word32Or) \
28 V(Word32Shl) \
29 V(Word32Shr) \
30 V(Word64And) \
31 V(Word64Shl) \
32 V(Word64Shr)
33
34namespace v8 {
35namespace internal {
36
37// Forward declarations.
38class Isolate;
39class RangeType;
40class Zone;
41
42namespace compiler {
43
44// Forward declarations.
45class Operator;
46class Type;
47class TypeCache;
48
50 public:
52
53 // Typing Phi.
54 Type Merge(Type left, Type right);
55
56 Type ToPrimitive(Type type);
57 Type ToNumber(Type type);
58 Type ToNumberConvertBigInt(Type type);
59 Type ToBigInt(Type type);
60 Type ToBigIntConvertNumber(Type type);
61 Type ToNumeric(Type type);
62 Type ToBoolean(Type type);
63
64 Type WeakenRange(Type current_range, Type previous_range);
65
66// Unary operators.
67#define DECLARE_METHOD(Name) Type Name(Type type);
72 DECLARE_METHOD(ConvertReceiver)
73#undef DECLARE_METHOD
74
75// Numeric binary operators.
76#define DECLARE_METHOD(Name) Type Name(Type lhs, Type rhs);
82#undef DECLARE_METHOD
83
84 Type ChangeUint32ToUint64(Type input);
85
86 // Comparison operators.
87 Type SameValue(Type lhs, Type rhs);
88 Type SameValueNumbersOnly(Type lhs, Type rhs);
89 Type StrictEqual(Type lhs, Type rhs);
90
91 // Check operators.
92 Type CheckBounds(Type index, Type length);
93 Type CheckFloat64Hole(Type type);
94 Type CheckNumber(Type type);
95 Type CheckNumberFitsInt32(Type type);
96 Type ConvertTaggedHoleToUndefined(Type type);
97
98 Type TypeTypeGuard(const Operator* sigma_op, Type input);
99
101 kComparisonTrue = 1,
102 kComparisonFalse = 2,
103 kComparisonUndefined = 4
104 };
105
106 Type singleton_false() const { return singleton_false_; }
107 Type singleton_true() const { return singleton_true_; }
108
109 private:
111
113 Type Invert(Type);
114 Type FalsifyUndefined(ComparisonOutcome);
115
116 Type Rangify(Type);
117 Type AddRanger(double lhs_min, double lhs_max, double rhs_min,
118 double rhs_max);
119 Type SubtractRanger(double lhs_min, double lhs_max, double rhs_min,
120 double rhs_max);
121 Type MultiplyRanger(double lhs_min, double lhs_max, double rhs_min,
122 double rhs_max);
123
124 Zone* zone() const { return zone_; }
125
126 Zone* const zone_;
128
140};
141
142} // namespace compiler
143} // namespace internal
144} // namespace v8
145
146#endif // V8_COMPILER_OPERATION_TYPER_H_
friend Zone
Definition asm-types.cc:195
Zone * zone_
JSHeapBroker * broker
int ToNumber(Register reg)
#define SIMPLIFIED_BIGINT_UNOP_LIST(V)
Definition opcodes.h:434
#define SIMPLIFIED_BIGINT_BINOP_LIST(V)
Definition opcodes.h:367
#define SIMPLIFIED_NUMBER_UNOP_LIST(V)
Definition opcodes.h:397
#define SIMPLIFIED_SPECULATIVE_BIGINT_UNOP_LIST(V)
Definition opcodes.h:573
#define SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(V)
Definition opcodes.h:439
#define SIMPLIFIED_SPECULATIVE_BIGINT_BINOP_LIST(V)
Definition opcodes.h:561
#define SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(V)
Definition opcodes.h:379
#define SIMPLIFIED_NUMBER_BINOP_LIST(V)
Definition opcodes.h:349
#define DECLARE_METHOD(Name)
#define TYPER_SUPPORTED_MACHINE_BINOP_LIST(V)
#define V8_EXPORT_PRIVATE
Definition macros.h:460