OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_JS_TYPED_LOWERING_H_ | 5 #ifndef V8_COMPILER_JS_TYPED_LOWERING_H_ |
6 #define V8_COMPILER_JS_TYPED_LOWERING_H_ | 6 #define V8_COMPILER_JS_TYPED_LOWERING_H_ |
7 | 7 |
8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
11 #include "src/compiler/node.h" | 11 #include "src/compiler/node.h" |
12 #include "src/compiler/simplified-operator.h" | 12 #include "src/compiler/simplified-operator.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 // Lowers JS-level operators to simplified operators based on types. | 18 // Lowers JS-level operators to simplified operators based on types. |
19 class JSTypedLowering FINAL : public Reducer { | 19 class JSTypedLowering FINAL : public Reducer { |
20 public: | 20 public: |
21 explicit JSTypedLowering(JSGraph* jsgraph) | 21 explicit JSTypedLowering(JSGraph* jsgraph); |
22 : jsgraph_(jsgraph), simplified_(jsgraph->zone()) {} | |
23 virtual ~JSTypedLowering(); | 22 virtual ~JSTypedLowering(); |
24 | 23 |
25 virtual Reduction Reduce(Node* node) OVERRIDE; | 24 virtual Reduction Reduce(Node* node) OVERRIDE; |
26 | 25 |
27 JSGraph* jsgraph() { return jsgraph_; } | 26 JSGraph* jsgraph() { return jsgraph_; } |
28 Graph* graph() { return jsgraph_->graph(); } | 27 Graph* graph() { return jsgraph_->graph(); } |
29 Zone* zone() { return jsgraph_->zone(); } | 28 Zone* zone() { return jsgraph_->zone(); } |
30 | 29 |
31 private: | 30 private: |
32 friend class JSBinopReduction; | 31 friend class JSBinopReduction; |
33 | 32 |
34 Reduction ReplaceEagerly(Node* old, Node* node); | 33 Reduction ReplaceEagerly(Node* old, Node* node); |
35 Reduction ReplaceWith(Node* node) { return Reducer::Replace(node); } | 34 Reduction ReplaceWith(Node* node) { return Reducer::Replace(node); } |
36 Reduction ReduceJSAdd(Node* node); | 35 Reduction ReduceJSAdd(Node* node); |
| 36 Reduction ReduceJSBitwiseOr(Node* node); |
| 37 Reduction ReduceJSMultiply(Node* node); |
37 Reduction ReduceJSComparison(Node* node); | 38 Reduction ReduceJSComparison(Node* node); |
38 Reduction ReduceJSLoadProperty(Node* node); | 39 Reduction ReduceJSLoadProperty(Node* node); |
39 Reduction ReduceJSStoreProperty(Node* node); | 40 Reduction ReduceJSStoreProperty(Node* node); |
40 Reduction ReduceJSEqual(Node* node, bool invert); | 41 Reduction ReduceJSEqual(Node* node, bool invert); |
41 Reduction ReduceJSStrictEqual(Node* node, bool invert); | 42 Reduction ReduceJSStrictEqual(Node* node, bool invert); |
42 Reduction ReduceJSToNumberInput(Node* input); | 43 Reduction ReduceJSToNumberInput(Node* input); |
43 Reduction ReduceJSToStringInput(Node* input); | 44 Reduction ReduceJSToStringInput(Node* input); |
44 Reduction ReduceJSToBooleanInput(Node* input); | 45 Reduction ReduceJSToBooleanInput(Node* input); |
45 Reduction ReduceNumberBinop(Node* node, const Operator* numberOp); | 46 Reduction ReduceNumberBinop(Node* node, const Operator* numberOp); |
46 Reduction ReduceI32Binop(Node* node, bool left_signed, bool right_signed, | 47 Reduction ReduceI32Binop(Node* node, bool left_signed, bool right_signed, |
47 const Operator* intOp); | 48 const Operator* intOp); |
48 Reduction ReduceI32Shift(Node* node, bool left_signed, | 49 Reduction ReduceI32Shift(Node* node, bool left_signed, |
49 const Operator* shift_op); | 50 const Operator* shift_op); |
50 | 51 |
51 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } | 52 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } |
52 CommonOperatorBuilder* common() { return jsgraph_->common(); } | 53 CommonOperatorBuilder* common() { return jsgraph_->common(); } |
53 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 54 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
54 MachineOperatorBuilder* machine() { return jsgraph_->machine(); } | 55 MachineOperatorBuilder* machine() { return jsgraph_->machine(); } |
55 | 56 |
56 JSGraph* jsgraph_; | 57 JSGraph* jsgraph_; |
57 SimplifiedOperatorBuilder simplified_; | 58 SimplifiedOperatorBuilder simplified_; |
| 59 Type* zero_range_; |
| 60 Type* one_range_; |
58 }; | 61 }; |
59 | 62 |
60 } // namespace compiler | 63 } // namespace compiler |
61 } // namespace internal | 64 } // namespace internal |
62 } // namespace v8 | 65 } // namespace v8 |
63 | 66 |
64 #endif // V8_COMPILER_JS_TYPED_LOWERING_H_ | 67 #endif // V8_COMPILER_JS_TYPED_LOWERING_H_ |
OLD | NEW |