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/base/flags.h" |
8 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
9 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 // Forward declarations. | 15 // Forward declarations. |
| 16 class CompilationDependencies; |
15 class Factory; | 17 class Factory; |
16 | 18 |
17 | 19 |
18 namespace compiler { | 20 namespace compiler { |
19 | 21 |
20 // Forward declarations. | 22 // Forward declarations. |
21 class CommonOperatorBuilder; | 23 class CommonOperatorBuilder; |
22 class JSGraph; | 24 class JSGraph; |
23 class JSOperatorBuilder; | 25 class JSOperatorBuilder; |
24 class MachineOperatorBuilder; | 26 class MachineOperatorBuilder; |
25 class SimplifiedOperatorBuilder; | 27 class SimplifiedOperatorBuilder; |
26 | 28 |
27 | 29 |
28 // Lowers JS-level operators to simplified operators based on types. | 30 // Lowers JS-level operators to simplified operators based on types. |
29 class JSTypedLowering final : public AdvancedReducer { | 31 class JSTypedLowering final : public AdvancedReducer { |
30 public: | 32 public: |
31 JSTypedLowering(Editor* editor, JSGraph* jsgraph, Zone* zone); | 33 // Flags that control the mode of operation. |
| 34 enum Flag { |
| 35 kNoFlags = 0u, |
| 36 kDeoptimizationEnabled = 1u << 0, |
| 37 }; |
| 38 typedef base::Flags<Flag> Flags; |
| 39 |
| 40 JSTypedLowering(Editor* editor, CompilationDependencies* dependencies, |
| 41 Flags flags, JSGraph* jsgraph, Zone* zone); |
32 ~JSTypedLowering() final {} | 42 ~JSTypedLowering() final {} |
33 | 43 |
34 Reduction Reduce(Node* node) final; | 44 Reduction Reduce(Node* node) final; |
35 | 45 |
36 private: | 46 private: |
37 friend class JSBinopReduction; | 47 friend class JSBinopReduction; |
38 | 48 |
39 Reduction ReduceJSAdd(Node* node); | 49 Reduction ReduceJSAdd(Node* node); |
40 Reduction ReduceJSModulus(Node* node); | 50 Reduction ReduceJSModulus(Node* node); |
41 Reduction ReduceJSBitwiseOr(Node* node); | 51 Reduction ReduceJSBitwiseOr(Node* node); |
42 Reduction ReduceJSMultiply(Node* node); | 52 Reduction ReduceJSMultiply(Node* node); |
43 Reduction ReduceJSComparison(Node* node); | 53 Reduction ReduceJSComparison(Node* node); |
44 Reduction ReduceJSLoadNamed(Node* node); | 54 Reduction ReduceJSLoadNamed(Node* node); |
45 Reduction ReduceJSLoadProperty(Node* node); | 55 Reduction ReduceJSLoadProperty(Node* node); |
46 Reduction ReduceJSStoreProperty(Node* node); | 56 Reduction ReduceJSStoreProperty(Node* node); |
| 57 Reduction ReduceJSInstanceOf(Node* node); |
47 Reduction ReduceJSLoadContext(Node* node); | 58 Reduction ReduceJSLoadContext(Node* node); |
48 Reduction ReduceJSStoreContext(Node* node); | 59 Reduction ReduceJSStoreContext(Node* node); |
49 Reduction ReduceJSEqual(Node* node, bool invert); | 60 Reduction ReduceJSEqual(Node* node, bool invert); |
50 Reduction ReduceJSStrictEqual(Node* node, bool invert); | 61 Reduction ReduceJSStrictEqual(Node* node, bool invert); |
51 Reduction ReduceJSUnaryNot(Node* node); | 62 Reduction ReduceJSUnaryNot(Node* node); |
52 Reduction ReduceJSToBoolean(Node* node); | 63 Reduction ReduceJSToBoolean(Node* node); |
53 Reduction ReduceJSToNumberInput(Node* input); | 64 Reduction ReduceJSToNumberInput(Node* input); |
54 Reduction ReduceJSToNumber(Node* node); | 65 Reduction ReduceJSToNumber(Node* node); |
55 Reduction ReduceJSToStringInput(Node* input); | 66 Reduction ReduceJSToStringInput(Node* input); |
56 Reduction ReduceJSToString(Node* node); | 67 Reduction ReduceJSToString(Node* node); |
(...skipping 23 matching lines...) Expand all Loading... |
80 bool* has_aliased_arguments); | 91 bool* has_aliased_arguments); |
81 | 92 |
82 Factory* factory() const; | 93 Factory* factory() const; |
83 Graph* graph() const; | 94 Graph* graph() const; |
84 JSGraph* jsgraph() const { return jsgraph_; } | 95 JSGraph* jsgraph() const { return jsgraph_; } |
85 Isolate* isolate() const; | 96 Isolate* isolate() const; |
86 JSOperatorBuilder* javascript() const; | 97 JSOperatorBuilder* javascript() const; |
87 CommonOperatorBuilder* common() const; | 98 CommonOperatorBuilder* common() const; |
88 SimplifiedOperatorBuilder* simplified() const; | 99 SimplifiedOperatorBuilder* simplified() const; |
89 MachineOperatorBuilder* machine() const; | 100 MachineOperatorBuilder* machine() const; |
| 101 CompilationDependencies* dependencies() const; |
| 102 Flags flags() const { return flags_; } |
90 | 103 |
91 // Limits up to which context allocations are inlined. | 104 // Limits up to which context allocations are inlined. |
92 static const int kFunctionContextAllocationLimit = 16; | 105 static const int kFunctionContextAllocationLimit = 16; |
93 static const int kBlockContextAllocationLimit = 16; | 106 static const int kBlockContextAllocationLimit = 16; |
94 | 107 |
| 108 CompilationDependencies* dependencies_; |
| 109 Flags flags_; |
95 JSGraph* jsgraph_; | 110 JSGraph* jsgraph_; |
96 Type* shifted_int32_ranges_[4]; | 111 Type* shifted_int32_ranges_[4]; |
97 }; | 112 }; |
98 | 113 |
| 114 DEFINE_OPERATORS_FOR_FLAGS(JSTypedLowering::Flags) |
| 115 |
99 } // namespace compiler | 116 } // namespace compiler |
100 } // namespace internal | 117 } // namespace internal |
101 } // namespace v8 | 118 } // namespace v8 |
102 | 119 |
103 #endif // V8_COMPILER_JS_TYPED_LOWERING_H_ | 120 #endif // V8_COMPILER_JS_TYPED_LOWERING_H_ |
OLD | NEW |