| 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 MaybeHandle<JSFunction> closure) |
| 26 : AdvancedReducer(editor), |
| 27 jsgraph_(jsgraph), |
| 28 context_(context), |
| 29 closure_(closure) {} |
| 26 | 30 |
| 27 Reduction Reduce(Node* node) final; | 31 Reduction Reduce(Node* node) final; |
| 28 | 32 |
| 29 private: | 33 private: |
| 34 Reduction ReduceParameter(Node* node); |
| 30 Reduction ReduceJSLoadContext(Node* node); | 35 Reduction ReduceJSLoadContext(Node* node); |
| 31 Reduction ReduceJSStoreContext(Node* node); | 36 Reduction ReduceJSStoreContext(Node* node); |
| 32 | 37 |
| 33 Reduction SimplifyJSStoreContext(Node* node, Node* new_context, | 38 Reduction SimplifyJSStoreContext(Node* node, Node* new_context, |
| 34 size_t new_depth); | 39 size_t new_depth); |
| 35 Reduction SimplifyJSLoadContext(Node* node, Node* new_context, | 40 Reduction SimplifyJSLoadContext(Node* node, Node* new_context, |
| 36 size_t new_depth); | 41 size_t new_depth); |
| 37 | 42 |
| 38 Isolate* isolate() const; | 43 Isolate* isolate() const; |
| 39 JSOperatorBuilder* javascript() const; | 44 JSOperatorBuilder* javascript() const; |
| 40 JSGraph* jsgraph() const { return jsgraph_; } | 45 JSGraph* jsgraph() const { return jsgraph_; } |
| 41 MaybeHandle<Context> context() const { return context_; } | 46 MaybeHandle<Context> context() const { return context_; } |
| 47 MaybeHandle<JSFunction> closure() const { return closure_; } |
| 42 | 48 |
| 43 JSGraph* const jsgraph_; | 49 JSGraph* const jsgraph_; |
| 44 MaybeHandle<Context> context_; | 50 MaybeHandle<Context> context_; |
| 51 MaybeHandle<JSFunction> closure_; |
| 45 | 52 |
| 46 DISALLOW_COPY_AND_ASSIGN(JSContextSpecialization); | 53 DISALLOW_COPY_AND_ASSIGN(JSContextSpecialization); |
| 47 }; | 54 }; |
| 48 | 55 |
| 49 } // namespace compiler | 56 } // namespace compiler |
| 50 } // namespace internal | 57 } // namespace internal |
| 51 } // namespace v8 | 58 } // namespace v8 |
| 52 | 59 |
| 53 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ | 60 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ |
| OLD | NEW |