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_NATIVE_CONTEXT_SPECIALIZATION_H_ | 5 #ifndef V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
6 #define V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 6 #define V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
| 10 #include "src/compiler/property-access-info.h" |
10 #include "src/compiler/simplified-operator.h" | 11 #include "src/compiler/simplified-operator.h" |
11 | 12 |
12 namespace v8 { | 13 namespace v8 { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 // Forward declarations. | 16 // Forward declarations. |
16 class CompilationDependencies; | 17 class CompilationDependencies; |
17 class Factory; | 18 class Factory; |
18 class TypeCache; | 19 class TypeCache; |
19 | 20 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 Reduction ReduceJSLoadNamed(Node* node); | 55 Reduction ReduceJSLoadNamed(Node* node); |
55 Reduction ReduceJSStoreNamed(Node* node); | 56 Reduction ReduceJSStoreNamed(Node* node); |
56 | 57 |
57 Reduction Replace(Node* node, Node* value, Node* effect = nullptr, | 58 Reduction Replace(Node* node, Node* value, Node* effect = nullptr, |
58 Node* control = nullptr) { | 59 Node* control = nullptr) { |
59 ReplaceWithValue(node, value, effect, control); | 60 ReplaceWithValue(node, value, effect, control); |
60 return Changed(value); | 61 return Changed(value); |
61 } | 62 } |
62 Reduction Replace(Node* node, Handle<Object> value); | 63 Reduction Replace(Node* node, Handle<Object> value); |
63 | 64 |
64 enum PropertyAccessMode { kLoad, kStore }; | |
65 class PropertyAccessInfo; | |
66 bool ComputePropertyAccessInfo(Handle<Map> map, Handle<Name> name, | |
67 PropertyAccessMode access_mode, | |
68 PropertyAccessInfo* access_info); | |
69 bool ComputePropertyAccessInfos(MapHandleList const& maps, Handle<Name> name, | |
70 PropertyAccessMode access_mode, | |
71 ZoneVector<PropertyAccessInfo>* access_infos); | |
72 | |
73 Reduction ReduceNamedAccess(Node* node, Node* value, | 65 Reduction ReduceNamedAccess(Node* node, Node* value, |
74 MapHandleList const& receiver_maps, | 66 MapHandleList const& receiver_maps, |
75 Handle<Name> name, | 67 Handle<Name> name, |
76 PropertyAccessMode access_mode); | 68 PropertyAccessMode access_mode); |
77 | 69 |
78 struct ScriptContextTableLookupResult; | 70 struct ScriptContextTableLookupResult; |
79 bool LookupInScriptContextTable(Handle<Name> name, | 71 bool LookupInScriptContextTable(Handle<Name> name, |
80 ScriptContextTableLookupResult* result); | 72 ScriptContextTableLookupResult* result); |
81 | 73 |
82 // Adds stability dependencies on all prototypes of every class in | 74 // Adds stability dependencies on all prototypes of every class in |
83 // {receiver_type} up to (and including) the {holder}. | 75 // {receiver_type} up to (and including) the {holder}. |
84 void AssumePrototypesStable(Type* receiver_type, Handle<JSObject> holder); | 76 void AssumePrototypesStable(Type* receiver_type, Handle<JSObject> holder); |
85 | 77 |
86 Graph* graph() const; | 78 Graph* graph() const; |
87 JSGraph* jsgraph() const { return jsgraph_; } | 79 JSGraph* jsgraph() const { return jsgraph_; } |
88 Isolate* isolate() const; | 80 Isolate* isolate() const; |
89 Factory* factory() const; | 81 Factory* factory() const; |
90 CommonOperatorBuilder* common() const; | 82 CommonOperatorBuilder* common() const; |
91 JSOperatorBuilder* javascript() const; | 83 JSOperatorBuilder* javascript() const; |
92 SimplifiedOperatorBuilder* simplified() const; | 84 SimplifiedOperatorBuilder* simplified() const; |
93 MachineOperatorBuilder* machine() const; | 85 MachineOperatorBuilder* machine() const; |
94 Flags flags() const { return flags_; } | 86 Flags flags() const { return flags_; } |
95 Handle<GlobalObject> global_object() const { return global_object_; } | 87 Handle<GlobalObject> global_object() const { return global_object_; } |
96 Handle<Context> native_context() const { return native_context_; } | 88 Handle<Context> native_context() const { return native_context_; } |
97 CompilationDependencies* dependencies() const { return dependencies_; } | 89 CompilationDependencies* dependencies() const { return dependencies_; } |
98 Zone* zone() const { return zone_; } | 90 Zone* zone() const { return zone_; } |
| 91 PropertyAccessInfoFactory& access_info_factory() { |
| 92 return access_info_factory_; |
| 93 } |
99 | 94 |
100 JSGraph* const jsgraph_; | 95 JSGraph* const jsgraph_; |
101 Flags const flags_; | 96 Flags const flags_; |
102 Handle<GlobalObject> global_object_; | 97 Handle<GlobalObject> global_object_; |
103 Handle<Context> native_context_; | 98 Handle<Context> native_context_; |
104 CompilationDependencies* const dependencies_; | 99 CompilationDependencies* const dependencies_; |
105 Zone* const zone_; | 100 Zone* const zone_; |
106 TypeCache const& type_cache_; | 101 TypeCache const& type_cache_; |
| 102 PropertyAccessInfoFactory access_info_factory_; |
107 | 103 |
108 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); | 104 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); |
109 }; | 105 }; |
110 | 106 |
111 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) | 107 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) |
112 | 108 |
113 } // namespace compiler | 109 } // namespace compiler |
114 } // namespace internal | 110 } // namespace internal |
115 } // namespace v8 | 111 } // namespace v8 |
116 | 112 |
117 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 113 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
OLD | NEW |