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/base/flags.h" |
9 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class CommonOperatorBuilder; | 16 class CommonOperatorBuilder; |
17 class JSGraph; | 17 class JSGraph; |
18 class JSOperatorBuilder; | 18 class JSOperatorBuilder; |
19 | 19 |
20 | 20 |
21 // Performs strength reduction on {JSCallConstruct} and {JSCallFunction} nodes, | 21 // Performs strength reduction on {JSCallConstruct} and {JSCallFunction} nodes, |
22 // which might allow inlining or other optimizations to be performed afterwards. | 22 // which might allow inlining or other optimizations to be performed afterwards. |
23 class JSCallReducer final : public AdvancedReducer { | 23 class JSCallReducer final : public Reducer { |
24 public: | 24 public: |
25 // Flags that control the mode of operation. | 25 // Flags that control the mode of operation. |
26 enum Flag { | 26 enum Flag { |
27 kNoFlags = 0u, | 27 kNoFlags = 0u, |
28 kDeoptimizationEnabled = 1u << 0, | 28 kDeoptimizationEnabled = 1u << 0, |
29 }; | 29 }; |
30 typedef base::Flags<Flag> Flags; | 30 typedef base::Flags<Flag> Flags; |
31 | 31 |
32 JSCallReducer(Editor* editor, JSGraph* jsgraph, Flags flags, | 32 JSCallReducer(JSGraph* jsgraph, Flags flags, |
33 MaybeHandle<Context> native_context) | 33 MaybeHandle<Context> native_context) |
34 : AdvancedReducer(editor), | 34 : jsgraph_(jsgraph), flags_(flags), native_context_(native_context) {} |
35 jsgraph_(jsgraph), | |
36 flags_(flags), | |
37 native_context_(native_context) {} | |
38 | 35 |
39 Reduction Reduce(Node* node) final; | 36 Reduction Reduce(Node* node) final; |
40 | 37 |
41 private: | 38 private: |
42 Reduction ReduceArrayConstructor(Node* node); | 39 Reduction ReduceArrayConstructor(Node* node); |
43 Reduction ReduceNumberConstructor(Node* node); | 40 Reduction ReduceNumberConstructor(Node* node); |
44 Reduction ReduceFunctionPrototypeApply(Node* node); | 41 Reduction ReduceFunctionPrototypeApply(Node* node); |
45 Reduction ReduceFunctionPrototypeCall(Node* node); | 42 Reduction ReduceFunctionPrototypeCall(Node* node); |
46 Reduction ReduceJSCallConstruct(Node* node); | 43 Reduction ReduceJSCallConstruct(Node* node); |
47 Reduction ReduceJSCallFunction(Node* node); | 44 Reduction ReduceJSCallFunction(Node* node); |
(...skipping 13 matching lines...) Expand all Loading... |
61 MaybeHandle<Context> const native_context_; | 58 MaybeHandle<Context> const native_context_; |
62 }; | 59 }; |
63 | 60 |
64 DEFINE_OPERATORS_FOR_FLAGS(JSCallReducer::Flags) | 61 DEFINE_OPERATORS_FOR_FLAGS(JSCallReducer::Flags) |
65 | 62 |
66 } // namespace compiler | 63 } // namespace compiler |
67 } // namespace internal | 64 } // namespace internal |
68 } // namespace v8 | 65 } // namespace v8 |
69 | 66 |
70 #endif // V8_COMPILER_JS_CALL_REDUCER_H_ | 67 #endif // V8_COMPILER_JS_CALL_REDUCER_H_ |
OLD | NEW |