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/compiler-source-position-table.h" |
| 9 #include "src/compiler/graph-reducer.h" |
8 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/graph-reducer.h" | |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 // Forward declarations. | 15 // Forward declarations. |
15 class CompilationInfo; | 16 class CompilationInfo; |
16 | 17 |
17 namespace compiler { | 18 namespace compiler { |
18 | 19 |
19 // The JSInliner provides the core graph inlining machinery. Note that this | 20 // The JSInliner provides the core graph inlining machinery. Note that this |
20 // class only deals with the mechanics of how to inline one graph into another, | 21 // class only deals with the mechanics of how to inline one graph into another, |
21 // heuristics that decide what and how much to inline are beyond its scope. | 22 // heuristics that decide what and how much to inline are beyond its scope. |
22 class JSInliner final : public AdvancedReducer { | 23 class JSInliner final : public AdvancedReducer { |
23 public: | 24 public: |
24 JSInliner(Editor* editor, Zone* local_zone, CompilationInfo* info, | 25 JSInliner(Editor* editor, Zone* local_zone, CompilationInfo* info, |
25 JSGraph* jsgraph) | 26 JSGraph* jsgraph, SourcePositionTable* source_positions) |
26 : AdvancedReducer(editor), | 27 : AdvancedReducer(editor), |
27 local_zone_(local_zone), | 28 local_zone_(local_zone), |
28 info_(info), | 29 info_(info), |
29 jsgraph_(jsgraph) {} | 30 jsgraph_(jsgraph), |
| 31 source_positions_(source_positions) {} |
30 | 32 |
31 // Reducer interface, eagerly inlines everything. | 33 // Reducer interface, eagerly inlines everything. |
32 Reduction Reduce(Node* node) final; | 34 Reduction Reduce(Node* node) final; |
33 | 35 |
34 // Can be used by inlining heuristics or by testing code directly, without | 36 // Can be used by inlining heuristics or by testing code directly, without |
35 // using the above generic reducer interface of the inlining machinery. | 37 // using the above generic reducer interface of the inlining machinery. |
36 Reduction ReduceJSCall(Node* node, Handle<JSFunction> function); | 38 Reduction ReduceJSCall(Node* node, Handle<JSFunction> function); |
37 | 39 |
38 private: | 40 private: |
39 CommonOperatorBuilder* common() const; | 41 CommonOperatorBuilder* common() const; |
40 JSOperatorBuilder* javascript() const; | 42 JSOperatorBuilder* javascript() const; |
41 SimplifiedOperatorBuilder* simplified() const; | 43 SimplifiedOperatorBuilder* simplified() const; |
42 Graph* graph() const; | 44 Graph* graph() const; |
43 JSGraph* jsgraph() const { return jsgraph_; } | 45 JSGraph* jsgraph() const { return jsgraph_; } |
44 | 46 |
45 Zone* const local_zone_; | 47 Zone* const local_zone_; |
46 CompilationInfo* info_; | 48 CompilationInfo* info_; |
47 JSGraph* const jsgraph_; | 49 JSGraph* const jsgraph_; |
| 50 SourcePositionTable* const source_positions_; |
48 | 51 |
49 Node* CreateArtificialFrameState(Node* node, Node* outer_frame_state, | 52 Node* CreateArtificialFrameState(Node* node, Node* outer_frame_state, |
50 int parameter_count, | 53 int parameter_count, |
51 FrameStateType frame_state_type, | 54 FrameStateType frame_state_type, |
52 Handle<SharedFunctionInfo> shared); | 55 Handle<SharedFunctionInfo> shared); |
53 | 56 |
54 Node* CreateTailCallerFrameState(Node* node, Node* outer_frame_state); | 57 Node* CreateTailCallerFrameState(Node* node, Node* outer_frame_state); |
55 | 58 |
56 Reduction InlineCall(Node* call, Node* new_target, Node* context, | 59 Reduction InlineCall(Node* call, Node* new_target, Node* context, |
57 Node* frame_state, Node* start, Node* end, | 60 Node* frame_state, Node* start, Node* end, |
58 Node* exception_target, | 61 Node* exception_target, |
59 const NodeVector& uncaught_subcalls); | 62 const NodeVector& uncaught_subcalls); |
60 }; | 63 }; |
61 | 64 |
62 } // namespace compiler | 65 } // namespace compiler |
63 } // namespace internal | 66 } // namespace internal |
64 } // namespace v8 | 67 } // namespace v8 |
65 | 68 |
66 #endif // V8_COMPILER_JS_INLINING_H_ | 69 #endif // V8_COMPILER_JS_INLINING_H_ |
OLD | NEW |