1 // Copyright 2015 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.
5 #ifndef V8_COMPILER_JS_INTRINSIC_LOWERING_H_
6 #define V8_COMPILER_JS_INTRINSIC_LOWERING_H_
8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph-reducer.h"
10 #include "src/compiler/simplified-operator.h"
16 // Forward declarations.
17 class CommonOperatorBuilder;
18 class JSOperatorBuilder;
20 class MachineOperatorBuilder;
23 // Lowers certain JS-level runtime calls.
24 class JSIntrinsicLowering final : public AdvancedReducer {
26 enum DeoptimizationMode { kDeoptimizationEnabled, kDeoptimizationDisabled };
28 JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph,
29 DeoptimizationMode mode);
30 ~JSIntrinsicLowering() final {}
32 Reduction Reduce(Node* node) final;
35 Reduction ReduceConstructDouble(Node* node);
36 Reduction ReduceDateField(Node* node);
37 Reduction ReduceDeoptimizeNow(Node* node);
38 Reduction ReduceDoubleHi(Node* node);
39 Reduction ReduceDoubleLo(Node* node);
40 Reduction ReduceHeapObjectGetMap(Node* node);
41 Reduction ReduceIncrementStatsCounter(Node* node);
42 Reduction ReduceIsMinusZero(Node* node);
43 Reduction ReduceIsInstanceType(Node* node, InstanceType instance_type);
44 Reduction ReduceIsNonNegativeSmi(Node* node);
45 Reduction ReduceIsSmi(Node* node);
46 Reduction ReduceJSValueGetValue(Node* node);
47 Reduction ReduceMapGetInstanceType(Node* node);
48 Reduction ReduceMathClz32(Node* node);
49 Reduction ReduceMathFloor(Node* node);
50 Reduction ReduceMathSqrt(Node* node);
51 Reduction ReduceSeqStringGetChar(Node* node, String::Encoding encoding);
52 Reduction ReduceSeqStringSetChar(Node* node, String::Encoding encoding);
53 Reduction ReduceStringGetLength(Node* node);
54 Reduction ReduceUnLikely(Node* node, BranchHint hint);
55 Reduction ReduceValueOf(Node* node);
56 Reduction ReduceFixedArrayGet(Node* node);
57 Reduction ReduceFixedArraySet(Node* node);
58 Reduction ReduceGetTypeFeedbackVector(Node* node);
59 Reduction ReduceGetCallerJSFunction(Node* node);
60 Reduction ReduceThrowNotDateError(Node* node);
61 Reduction ReduceCallFunction(Node* node);
63 Reduction Change(Node* node, const Operator* op);
64 Reduction Change(Node* node, const Operator* op, Node* a, Node* b);
65 Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c);
66 Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c,
68 Reduction ChangeToUndefined(Node* node, Node* effect = nullptr);
71 JSGraph* jsgraph() const { return jsgraph_; }
72 CommonOperatorBuilder* common() const;
73 JSOperatorBuilder* javascript() const;
74 MachineOperatorBuilder* machine() const;
75 DeoptimizationMode mode() const { return mode_; }
76 SimplifiedOperatorBuilder* simplified() { return &simplified_; }
78 JSGraph* const jsgraph_;
79 DeoptimizationMode const mode_;
80 SimplifiedOperatorBuilder simplified_;
83 } // namespace compiler
84 } // namespace internal
87 #endif // V8_COMPILER_JS_INTRINSIC_LOWERING_H_