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