| 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" | |
| 10 #include "src/compiler/machine-operator.h" | |
| 11 #include "src/compiler/node.h" | |
| 12 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
| 13 | 10 |
| 14 namespace v8 { | 11 namespace v8 { |
| 15 namespace internal { | 12 namespace internal { |
| 16 namespace compiler { | 13 namespace compiler { |
| 17 | 14 |
| 15 // Forward declarations. |
| 16 class CommonOperatorBuilder; |
| 17 class JSGraph; |
| 18 class JSOperatorBuilder; |
| 19 class MachineOperatorBuilder; |
| 20 |
| 21 |
| 18 // Lowers JS-level operators to simplified operators based on types. | 22 // Lowers JS-level operators to simplified operators based on types. |
| 19 class JSTypedLowering FINAL : public Reducer { | 23 class JSTypedLowering FINAL : public Reducer { |
| 20 public: | 24 public: |
| 21 explicit JSTypedLowering(JSGraph* jsgraph); | 25 explicit JSTypedLowering(JSGraph* jsgraph); |
| 22 ~JSTypedLowering() {} | 26 ~JSTypedLowering() FINAL {} |
| 23 | 27 |
| 24 Reduction Reduce(Node* node) OVERRIDE; | 28 Reduction Reduce(Node* node) FINAL; |
| 25 | |
| 26 JSGraph* jsgraph() { return jsgraph_; } | |
| 27 Graph* graph() { return jsgraph_->graph(); } | |
| 28 Zone* zone() { return jsgraph_->zone(); } | |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 friend class JSBinopReduction; | 31 friend class JSBinopReduction; |
| 32 | 32 |
| 33 Reduction ReplaceEagerly(Node* old, Node* node); | 33 Reduction ReplaceEagerly(Node* old, Node* node); |
| 34 Reduction ReduceJSAdd(Node* node); | 34 Reduction ReduceJSAdd(Node* node); |
| 35 Reduction ReduceJSBitwiseOr(Node* node); | 35 Reduction ReduceJSBitwiseOr(Node* node); |
| 36 Reduction ReduceJSMultiply(Node* node); | 36 Reduction ReduceJSMultiply(Node* node); |
| 37 Reduction ReduceJSComparison(Node* node); | 37 Reduction ReduceJSComparison(Node* node); |
| 38 Reduction ReduceJSLoadProperty(Node* node); | 38 Reduction ReduceJSLoadProperty(Node* node); |
| 39 Reduction ReduceJSStoreProperty(Node* node); | 39 Reduction ReduceJSStoreProperty(Node* node); |
| 40 Reduction ReduceJSLoadContext(Node* node); | 40 Reduction ReduceJSLoadContext(Node* node); |
| 41 Reduction ReduceJSStoreContext(Node* node); | 41 Reduction ReduceJSStoreContext(Node* node); |
| 42 Reduction ReduceJSEqual(Node* node, bool invert); | 42 Reduction ReduceJSEqual(Node* node, bool invert); |
| 43 Reduction ReduceJSStrictEqual(Node* node, bool invert); | 43 Reduction ReduceJSStrictEqual(Node* node, bool invert); |
| 44 Reduction ReduceJSToBooleanInput(Node* input); |
| 45 Reduction ReduceJSToBoolean(Node* node); |
| 44 Reduction ReduceJSToNumberInput(Node* input); | 46 Reduction ReduceJSToNumberInput(Node* input); |
| 45 Reduction ReduceJSToNumber(Node* node); | 47 Reduction ReduceJSToNumber(Node* node); |
| 46 Reduction ReduceJSToStringInput(Node* input); | 48 Reduction ReduceJSToStringInput(Node* input); |
| 47 Reduction ReduceJSToBooleanInput(Node* input); | 49 Reduction ReduceJSToString(Node* node); |
| 48 Reduction ReduceJSToBoolean(Node* node); | |
| 49 Reduction ReduceNumberBinop(Node* node, const Operator* numberOp); | 50 Reduction ReduceNumberBinop(Node* node, const Operator* numberOp); |
| 50 Reduction ReduceI32Binop(Node* node, bool left_signed, bool right_signed, | 51 Reduction ReduceInt32Binop(Node* node, const Operator* intOp); |
| 51 const Operator* intOp); | 52 Reduction ReduceUI32Shift(Node* node, Signedness left_signedness, |
| 52 Reduction ReduceI32Shift(Node* node, bool left_signed, | 53 const Operator* shift_op); |
| 53 const Operator* shift_op); | |
| 54 | 54 |
| 55 Node* Word32Shl(Node* const lhs, int32_t const rhs); | 55 Node* Word32Shl(Node* const lhs, int32_t const rhs); |
| 56 | 56 |
| 57 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } | 57 Factory* factory() const; |
| 58 CommonOperatorBuilder* common() { return jsgraph_->common(); } | 58 Graph* graph() const; |
| 59 JSGraph* jsgraph() const { return jsgraph_; } |
| 60 JSOperatorBuilder* javascript() const; |
| 61 CommonOperatorBuilder* common() const; |
| 59 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 62 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
| 60 MachineOperatorBuilder* machine() { return jsgraph_->machine(); } | 63 MachineOperatorBuilder* machine() const; |
| 61 | 64 |
| 62 JSGraph* jsgraph_; | 65 JSGraph* jsgraph_; |
| 63 SimplifiedOperatorBuilder simplified_; | 66 SimplifiedOperatorBuilder simplified_; |
| 64 Type* zero_range_; | 67 Type* zero_range_; |
| 65 Type* one_range_; | 68 Type* one_range_; |
| 66 Type* zero_thirtyone_range_; | 69 Type* zero_thirtyone_range_; |
| 67 Type* shifted_int32_ranges_[4]; | 70 Type* shifted_int32_ranges_[4]; |
| 68 }; | 71 }; |
| 69 | 72 |
| 70 } // namespace compiler | 73 } // namespace compiler |
| 71 } // namespace internal | 74 } // namespace internal |
| 72 } // namespace v8 | 75 } // namespace v8 |
| 73 | 76 |
| 74 #endif // V8_COMPILER_JS_TYPED_LOWERING_H_ | 77 #endif // V8_COMPILER_JS_TYPED_LOWERING_H_ |
| OLD | NEW |