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_CONTEXT_SPECIALIZATION_H_ | 5 #ifndef V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ |
6 #define V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ | 6 #define V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ |
7 | 7 |
8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
9 #include "src/compiler/js-graph.h" | |
10 #include "src/contexts.h" | |
11 | 9 |
12 namespace v8 { | 10 namespace v8 { |
13 namespace internal { | 11 namespace internal { |
14 namespace compiler { | 12 namespace compiler { |
15 | 13 |
| 14 // Forward declarations. |
| 15 class JSGraph; |
| 16 class JSOperatorBuilder; |
| 17 |
| 18 |
16 // Specializes a given JSGraph to a given context, potentially constant folding | 19 // Specializes a given JSGraph to a given context, potentially constant folding |
17 // some {LoadContext} nodes or strength reducing some {StoreContext} nodes. | 20 // some {LoadContext} nodes or strength reducing some {StoreContext} nodes. |
18 class JSContextSpecializer : public AdvancedReducer { | 21 class JSContextSpecializer : public AdvancedReducer { |
19 public: | 22 public: |
20 JSContextSpecializer(Editor* editor, JSGraph* jsgraph) | 23 JSContextSpecializer(Editor* editor, JSGraph* jsgraph) |
21 : AdvancedReducer(editor), jsgraph_(jsgraph) {} | 24 : AdvancedReducer(editor), jsgraph_(jsgraph) {} |
22 | 25 |
23 Reduction Reduce(Node* node) override; | 26 Reduction Reduce(Node* node) override; |
24 | 27 |
25 // Visible for unit testing. | 28 // Visible for unit testing. |
26 Reduction ReduceJSLoadContext(Node* node); | 29 Reduction ReduceJSLoadContext(Node* node); |
27 Reduction ReduceJSStoreContext(Node* node); | 30 Reduction ReduceJSStoreContext(Node* node); |
28 | 31 |
29 private: | 32 private: |
30 JSGraph* jsgraph_; | 33 Isolate* isolate() const; |
| 34 JSOperatorBuilder* javascript() const; |
| 35 JSGraph* jsgraph() const { return jsgraph_; } |
| 36 |
| 37 JSGraph* const jsgraph_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(JSContextSpecializer); |
31 }; | 40 }; |
32 } | 41 |
33 } | 42 } // namespace compiler |
34 } // namespace v8::internal::compiler | 43 } // namespace internal |
| 44 } // namespace v8 |
35 | 45 |
36 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ | 46 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ |
OLD | NEW |