OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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_CALL_REDUCER_H_ | 5 #ifndef V8_COMPILER_JS_CALL_REDUCER_H_ |
6 #define V8_COMPILER_JS_CALL_REDUCER_H_ | 6 #define V8_COMPILER_JS_CALL_REDUCER_H_ |
7 | 7 |
| 8 #include "src/base/flags.h" |
8 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 namespace compiler { | 13 namespace compiler { |
13 | 14 |
14 // Forward declarations. | 15 // Forward declarations. |
| 16 class CommonOperatorBuilder; |
15 class JSGraph; | 17 class JSGraph; |
16 class JSOperatorBuilder; | 18 class JSOperatorBuilder; |
| 19 class SimplifiedOperatorBuilder; |
17 | 20 |
18 | 21 |
19 // Performs strength reduction on {JSCallFunction} nodes, which might allow | 22 // Performs strength reduction on {JSCallFunction} nodes, which might allow |
20 // inlining or other optimizations to be performed afterwards. | 23 // inlining or other optimizations to be performed afterwards. |
21 class JSCallReducer final : public Reducer { | 24 class JSCallReducer final : public Reducer { |
22 public: | 25 public: |
23 explicit JSCallReducer(JSGraph* jsgraph) : jsgraph_(jsgraph) {} | 26 // Flags that control the mode of operation. |
| 27 enum Flag { |
| 28 kNoFlags = 0u, |
| 29 kDeoptimizationEnabled = 1u << 0, |
| 30 }; |
| 31 typedef base::Flags<Flag> Flags; |
| 32 |
| 33 JSCallReducer(JSGraph* jsgraph, Flags flags) |
| 34 : jsgraph_(jsgraph), flags_(flags) {} |
24 | 35 |
25 Reduction Reduce(Node* node) final; | 36 Reduction Reduce(Node* node) final; |
26 | 37 |
27 private: | 38 private: |
28 Reduction ReduceFunctionPrototypeApply(Node* node); | 39 Reduction ReduceFunctionPrototypeApply(Node* node); |
29 Reduction ReduceFunctionPrototypeCall(Node* node); | 40 Reduction ReduceFunctionPrototypeCall(Node* node); |
| 41 Reduction ReduceJSCallFunction(Node* node); |
30 | 42 |
31 Graph* graph() const; | 43 Graph* graph() const; |
| 44 Flags flags() const { return flags_; } |
32 JSGraph* jsgraph() const { return jsgraph_; } | 45 JSGraph* jsgraph() const { return jsgraph_; } |
33 Isolate* isolate() const; | 46 Isolate* isolate() const; |
| 47 CommonOperatorBuilder* common() const; |
34 JSOperatorBuilder* javascript() const; | 48 JSOperatorBuilder* javascript() const; |
| 49 SimplifiedOperatorBuilder* simplified() const; |
35 | 50 |
36 JSGraph* const jsgraph_; | 51 JSGraph* const jsgraph_; |
| 52 Flags const flags_; |
37 }; | 53 }; |
38 | 54 |
| 55 DEFINE_OPERATORS_FOR_FLAGS(JSCallReducer::Flags) |
| 56 |
39 } // namespace compiler | 57 } // namespace compiler |
40 } // namespace internal | 58 } // namespace internal |
41 } // namespace v8 | 59 } // namespace v8 |
42 | 60 |
43 #endif // V8_COMPILER_JS_CALL_REDUCER_H_ | 61 #endif // V8_COMPILER_JS_CALL_REDUCER_H_ |
OLD | NEW |