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_INLINING_H_ | 5 #ifndef V8_COMPILER_JS_INLINING_H_ |
6 #define V8_COMPILER_JS_INLINING_H_ | 6 #define V8_COMPILER_JS_INLINING_H_ |
7 | 7 |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.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 | 13 |
14 // Forward declarations. | 14 // Forward declarations. |
15 class CompilationInfo; | 15 class CompilationInfo; |
16 | 16 |
17 namespace compiler { | 17 namespace compiler { |
18 | 18 |
19 // Forward declarations. | 19 // Forward declarations. |
20 class JSCallFunctionAccessor; | 20 class JSCallFunctionAccessor; |
21 | 21 |
| 22 // The JSInliner provides the core graph inlining machinery. Note that this |
| 23 // class only deals with the mechanics of how to inline one graph into another, |
| 24 // heuristics that decide what and how much to inline are beyond its scope. |
22 class JSInliner final : public AdvancedReducer { | 25 class JSInliner final : public AdvancedReducer { |
23 public: | 26 public: |
24 enum Mode { kRestrictedInlining, kGeneralInlining }; | 27 JSInliner(Editor* editor, Zone* local_zone, CompilationInfo* info, |
25 | |
26 JSInliner(Editor* editor, Mode mode, Zone* local_zone, CompilationInfo* info, | |
27 JSGraph* jsgraph) | 28 JSGraph* jsgraph) |
28 : AdvancedReducer(editor), | 29 : AdvancedReducer(editor), |
29 mode_(mode), | |
30 local_zone_(local_zone), | 30 local_zone_(local_zone), |
31 info_(info), | 31 info_(info), |
32 jsgraph_(jsgraph) {} | 32 jsgraph_(jsgraph) {} |
33 | 33 |
| 34 // Reducer interface, eagerly inlines everything. |
34 Reduction Reduce(Node* node) final; | 35 Reduction Reduce(Node* node) final; |
35 | 36 |
| 37 // Can be used by inlining heuristics or by testing code directly, without |
| 38 // using the above generic reducer interface of the inlining machinery. |
| 39 Reduction ReduceJSCallFunction(Node* node, Handle<JSFunction> function); |
| 40 |
36 private: | 41 private: |
37 Mode const mode_; | |
38 Zone* local_zone_; | 42 Zone* local_zone_; |
39 CompilationInfo* info_; | 43 CompilationInfo* info_; |
40 JSGraph* jsgraph_; | 44 JSGraph* jsgraph_; |
41 | 45 |
42 Node* CreateArgumentsAdaptorFrameState(JSCallFunctionAccessor* call, | 46 Node* CreateArgumentsAdaptorFrameState(JSCallFunctionAccessor* call, |
43 Handle<SharedFunctionInfo> shared_info, | 47 Handle<SharedFunctionInfo> shared_info, |
44 Zone* temp_zone); | 48 Zone* temp_zone); |
45 | 49 |
46 Reduction InlineCall(Node* call, Node* context, Node* frame_state, | 50 Reduction InlineCall(Node* call, Node* context, Node* frame_state, |
47 Node* start, Node* end); | 51 Node* start, Node* end); |
48 }; | 52 }; |
49 | 53 |
50 } // namespace compiler | 54 } // namespace compiler |
51 } // namespace internal | 55 } // namespace internal |
52 } // namespace v8 | 56 } // namespace v8 |
53 | 57 |
54 #endif // V8_COMPILER_JS_INLINING_H_ | 58 #endif // V8_COMPILER_JS_INLINING_H_ |
OLD | NEW |