Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: src/compiler/js-context-specialization.h

Issue 1221103003: [turbofan] Move context specialization into JSContextSpecializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix predicate. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 JSContextSpecializer : public AdvancedReducer { 21 class JSContextSpecializer final : public AdvancedReducer {
22 public: 22 public:
23 JSContextSpecializer(Editor* editor, JSGraph* jsgraph) 23 JSContextSpecializer(Editor* editor, JSGraph* jsgraph, int context_index,
24 : AdvancedReducer(editor), jsgraph_(jsgraph) {} 24 MaybeHandle<Context> context)
25 : AdvancedReducer(editor),
26 jsgraph_(jsgraph),
27 context_index_(context_index),
28 context_(context) {}
25 29
26 Reduction Reduce(Node* node) override; 30 Reduction Reduce(Node* node) final;
27 31
28 // Visible for unit testing. 32 private:
33 Reduction ReduceParameter(Node* node);
29 Reduction ReduceJSLoadContext(Node* node); 34 Reduction ReduceJSLoadContext(Node* node);
30 Reduction ReduceJSStoreContext(Node* node); 35 Reduction ReduceJSStoreContext(Node* node);
31 36
32 private:
33 Isolate* isolate() const; 37 Isolate* isolate() const;
34 JSOperatorBuilder* javascript() const; 38 JSOperatorBuilder* javascript() const;
35 JSGraph* jsgraph() const { return jsgraph_; } 39 JSGraph* jsgraph() const { return jsgraph_; }
40 int context_index() const { return context_index_; }
41 MaybeHandle<Context> context() const { return context_; }
36 42
37 JSGraph* const jsgraph_; 43 JSGraph* const jsgraph_;
44 int const context_index_;
45 MaybeHandle<Context> context_;
38 46
39 DISALLOW_COPY_AND_ASSIGN(JSContextSpecializer); 47 DISALLOW_COPY_AND_ASSIGN(JSContextSpecializer);
40 }; 48 };
41 49
42 } // namespace compiler 50 } // namespace compiler
43 } // namespace internal 51 } // namespace internal
44 } // namespace v8 52 } // namespace v8
45 53
46 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ 54 #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698