OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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_GLOBAL_OBJECT_SPECIALIZATION_H_ | 5 #ifndef V8_COMPILER_JS_GLOBAL_OBJECT_SPECIALIZATION_H_ |
6 #define V8_COMPILER_JS_GLOBAL_OBJECT_SPECIALIZATION_H_ | 6 #define V8_COMPILER_JS_GLOBAL_OBJECT_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 { |
(...skipping 10 matching lines...) Expand all Loading... |
21 class JSOperatorBuilder; | 21 class JSOperatorBuilder; |
22 class SimplifiedOperatorBuilder; | 22 class SimplifiedOperatorBuilder; |
23 class TypeCache; | 23 class TypeCache; |
24 | 24 |
25 // Specializes a given JSGraph to a given global object, potentially constant | 25 // Specializes a given JSGraph to a given global object, potentially constant |
26 // folding some {JSLoadGlobal} nodes or strength reducing some {JSStoreGlobal} | 26 // folding some {JSLoadGlobal} nodes or strength reducing some {JSStoreGlobal} |
27 // nodes. | 27 // nodes. |
28 class JSGlobalObjectSpecialization final : public AdvancedReducer { | 28 class JSGlobalObjectSpecialization final : public AdvancedReducer { |
29 public: | 29 public: |
30 JSGlobalObjectSpecialization(Editor* editor, JSGraph* jsgraph, | 30 JSGlobalObjectSpecialization(Editor* editor, JSGraph* jsgraph, |
31 MaybeHandle<Context> native_context, | 31 Handle<JSGlobalObject> global_object, |
32 CompilationDependencies* dependencies); | 32 CompilationDependencies* dependencies); |
33 | 33 |
34 Reduction Reduce(Node* node) final; | 34 Reduction Reduce(Node* node) final; |
35 | 35 |
36 private: | 36 private: |
37 Reduction ReduceJSLoadGlobal(Node* node); | 37 Reduction ReduceJSLoadGlobal(Node* node); |
38 Reduction ReduceJSStoreGlobal(Node* node); | 38 Reduction ReduceJSStoreGlobal(Node* node); |
39 | 39 |
40 // Retrieve the global object from the given {node} if known. | |
41 MaybeHandle<JSGlobalObject> GetGlobalObject(Node* node); | |
42 | |
43 struct ScriptContextTableLookupResult; | 40 struct ScriptContextTableLookupResult; |
44 bool LookupInScriptContextTable(Handle<JSGlobalObject> global_object, | 41 bool LookupInScriptContextTable(Handle<Name> name, |
45 Handle<Name> name, | |
46 ScriptContextTableLookupResult* result); | 42 ScriptContextTableLookupResult* result); |
47 | 43 |
48 Graph* graph() const; | 44 Graph* graph() const; |
49 JSGraph* jsgraph() const { return jsgraph_; } | 45 JSGraph* jsgraph() const { return jsgraph_; } |
50 Isolate* isolate() const; | 46 Isolate* isolate() const; |
51 CommonOperatorBuilder* common() const; | 47 CommonOperatorBuilder* common() const; |
52 JSOperatorBuilder* javascript() const; | 48 JSOperatorBuilder* javascript() const; |
53 SimplifiedOperatorBuilder* simplified() const; | 49 SimplifiedOperatorBuilder* simplified() const; |
54 MaybeHandle<Context> native_context() const { return native_context_; } | 50 Handle<JSGlobalObject> global_object() const { return global_object_; } |
55 CompilationDependencies* dependencies() const { return dependencies_; } | 51 CompilationDependencies* dependencies() const { return dependencies_; } |
56 | 52 |
57 JSGraph* const jsgraph_; | 53 JSGraph* const jsgraph_; |
58 MaybeHandle<Context> native_context_; | 54 Handle<JSGlobalObject> const global_object_; |
59 CompilationDependencies* const dependencies_; | 55 CompilationDependencies* const dependencies_; |
60 TypeCache const& type_cache_; | 56 TypeCache const& type_cache_; |
61 | 57 |
62 DISALLOW_COPY_AND_ASSIGN(JSGlobalObjectSpecialization); | 58 DISALLOW_COPY_AND_ASSIGN(JSGlobalObjectSpecialization); |
63 }; | 59 }; |
64 | 60 |
65 } // namespace compiler | 61 } // namespace compiler |
66 } // namespace internal | 62 } // namespace internal |
67 } // namespace v8 | 63 } // namespace v8 |
68 | 64 |
69 #endif // V8_COMPILER_JS_GLOBAL_OBJECT_SPECIALIZATION_H_ | 65 #endif // V8_COMPILER_JS_GLOBAL_OBJECT_SPECIALIZATION_H_ |
OLD | NEW |