| 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 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace compiler { | 12 namespace compiler { |
| 13 | 13 |
| 14 // Forward declarations. | 14 // Forward declarations. |
| 15 class JSGraph; | 15 class JSGraph; |
| 16 class JSOperatorBuilder; | 16 class JSOperatorBuilder; |
| 17 | 17 |
| 18 | 18 |
| 19 // Specializes a given JSGraph to a given context, potentially constant folding | 19 // Specializes a given JSGraph to a given context, potentially constant folding |
| 20 // some {LoadContext} nodes or strength reducing some {StoreContext} nodes. | 20 // some {LoadContext} nodes or strength reducing some {StoreContext} nodes. |
| 21 class JSContextSpecialization final : public AdvancedReducer { | 21 class JSContextSpecialization final : public AdvancedReducer { |
| 22 public: | 22 public: |
| 23 JSContextSpecialization(Editor* editor, JSGraph* jsgraph, | 23 JSContextSpecialization(Editor* editor, JSGraph* jsgraph, |
| 24 MaybeHandle<Context> context) | 24 MaybeHandle<Context> context) |
| 25 : AdvancedReducer(editor), jsgraph_(jsgraph), context_(context) {} | 25 : AdvancedReducer(editor), jsgraph_(jsgraph), context_(context) {} |
| 26 | 26 |
| 27 Reduction Reduce(Node* node) final; | 27 Reduction Reduce(Node* node) final; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 Reduction ReduceParameter(Node* node); | |
| 31 Reduction ReduceJSLoadContext(Node* node); | 30 Reduction ReduceJSLoadContext(Node* node); |
| 32 Reduction ReduceJSStoreContext(Node* node); | 31 Reduction ReduceJSStoreContext(Node* node); |
| 33 | 32 |
| 33 // Returns the {Context} to specialize {node} to (if any). |
| 34 MaybeHandle<Context> GetSpecializationContext(Node* node); |
| 35 |
| 34 Isolate* isolate() const; | 36 Isolate* isolate() const; |
| 35 JSOperatorBuilder* javascript() const; | 37 JSOperatorBuilder* javascript() const; |
| 36 JSGraph* jsgraph() const { return jsgraph_; } | 38 JSGraph* jsgraph() const { return jsgraph_; } |
| 37 MaybeHandle<Context> context() const { return context_; } | 39 MaybeHandle<Context> context() const { return context_; } |
| 38 | 40 |
| 39 JSGraph* const jsgraph_; | 41 JSGraph* const jsgraph_; |
| 40 MaybeHandle<Context> context_; | 42 MaybeHandle<Context> context_; |
| 41 | 43 |
| 42 DISALLOW_COPY_AND_ASSIGN(JSContextSpecialization); | 44 DISALLOW_COPY_AND_ASSIGN(JSContextSpecialization); |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 } // namespace compiler | 47 } // namespace compiler |
| 46 } // namespace internal | 48 } // namespace internal |
| 47 } // namespace v8 | 49 } // namespace v8 |
| 48 | 50 |
| 49 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ | 51 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ |
| OLD | NEW |