OLD | NEW |
| (Empty) |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_COMPILER_JS_GLOBAL_OBJECT_SPECIALIZATION_H_ | |
6 #define V8_COMPILER_JS_GLOBAL_OBJECT_SPECIALIZATION_H_ | |
7 | |
8 #include "src/compiler/graph-reducer.h" | |
9 | |
10 namespace v8 { | |
11 namespace internal { | |
12 | |
13 // Forward declarations. | |
14 class CompilationDependencies; | |
15 | |
16 namespace compiler { | |
17 | |
18 // Forward declarations. | |
19 class CommonOperatorBuilder; | |
20 class JSGraph; | |
21 class JSOperatorBuilder; | |
22 class SimplifiedOperatorBuilder; | |
23 class TypeCache; | |
24 | |
25 // Specializes a given JSGraph to a given global object, potentially constant | |
26 // folding some {JSLoadGlobal} nodes or strength reducing some {JSStoreGlobal} | |
27 // nodes. | |
28 class JSGlobalObjectSpecialization final : public AdvancedReducer { | |
29 public: | |
30 JSGlobalObjectSpecialization(Editor* editor, JSGraph* jsgraph, | |
31 Handle<JSGlobalObject> global_object, | |
32 CompilationDependencies* dependencies); | |
33 | |
34 Reduction Reduce(Node* node) final; | |
35 | |
36 private: | |
37 Reduction ReduceJSLoadGlobal(Node* node); | |
38 Reduction ReduceJSStoreGlobal(Node* node); | |
39 | |
40 struct ScriptContextTableLookupResult; | |
41 bool LookupInScriptContextTable(Handle<Name> name, | |
42 ScriptContextTableLookupResult* result); | |
43 | |
44 Graph* graph() const; | |
45 JSGraph* jsgraph() const { return jsgraph_; } | |
46 Isolate* isolate() const; | |
47 CommonOperatorBuilder* common() const; | |
48 JSOperatorBuilder* javascript() const; | |
49 SimplifiedOperatorBuilder* simplified() const; | |
50 Handle<JSGlobalObject> global_object() const { return global_object_; } | |
51 CompilationDependencies* dependencies() const { return dependencies_; } | |
52 | |
53 JSGraph* const jsgraph_; | |
54 Handle<JSGlobalObject> const global_object_; | |
55 CompilationDependencies* const dependencies_; | |
56 TypeCache const& type_cache_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(JSGlobalObjectSpecialization); | |
59 }; | |
60 | |
61 } // namespace compiler | |
62 } // namespace internal | |
63 } // namespace v8 | |
64 | |
65 #endif // V8_COMPILER_JS_GLOBAL_OBJECT_SPECIALIZATION_H_ | |
OLD | NEW |