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/deoptimize-reason.h" | 10 #include "src/deoptimize-reason.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 Node* index = nullptr); | 89 Node* index = nullptr); |
90 Reduction ReduceGlobalAccess(Node* node, Node* receiver, Node* value, | 90 Reduction ReduceGlobalAccess(Node* node, Node* receiver, Node* value, |
91 Handle<Name> name, AccessMode access_mode, | 91 Handle<Name> name, AccessMode access_mode, |
92 Node* index = nullptr); | 92 Node* index = nullptr); |
93 | 93 |
94 Reduction ReduceSoftDeoptimize(Node* node, DeoptimizeReason reason); | 94 Reduction ReduceSoftDeoptimize(Node* node, DeoptimizeReason reason); |
95 | 95 |
96 // A triple of nodes that represents a continuation. | 96 // A triple of nodes that represents a continuation. |
97 class ValueEffectControl final { | 97 class ValueEffectControl final { |
98 public: | 98 public: |
| 99 ValueEffectControl() |
| 100 : value_(nullptr), effect_(nullptr), control_(nullptr) {} |
99 ValueEffectControl(Node* value, Node* effect, Node* control) | 101 ValueEffectControl(Node* value, Node* effect, Node* control) |
100 : value_(value), effect_(effect), control_(control) {} | 102 : value_(value), effect_(effect), control_(control) {} |
101 | 103 |
102 Node* value() const { return value_; } | 104 Node* value() const { return value_; } |
103 Node* effect() const { return effect_; } | 105 Node* effect() const { return effect_; } |
104 Node* control() const { return control_; } | 106 Node* control() const { return control_; } |
105 | 107 |
106 private: | 108 private: |
107 Node* const value_; | 109 Node* value_; |
108 Node* const effect_; | 110 Node* effect_; |
109 Node* const control_; | 111 Node* control_; |
110 }; | 112 }; |
111 | 113 |
112 // Construct the appropriate subgraph for property access. | 114 // Construct the appropriate subgraph for property access. |
113 ValueEffectControl BuildPropertyAccess( | 115 ValueEffectControl BuildPropertyAccess( |
114 Node* receiver, Node* value, Node* context, Node* frame_state, | 116 Node* receiver, Node* value, Node* context, Node* frame_state, |
115 Node* effect, Node* control, Handle<Name> name, | 117 Node* effect, Node* control, Handle<Name> name, |
116 ZoneVector<Node*>* if_exceptions, PropertyAccessInfo const& access_info, | 118 ZoneVector<Node*>* if_exceptions, PropertyAccessInfo const& access_info, |
117 AccessMode access_mode, LanguageMode language_mode); | 119 AccessMode access_mode, LanguageMode language_mode); |
| 120 ValueEffectControl BuildPropertyLoad(Node* receiver, Node* context, |
| 121 Node* frame_state, Node* effect, |
| 122 Node* control, Handle<Name> name, |
| 123 ZoneVector<Node*>* if_exceptions, |
| 124 PropertyAccessInfo const& access_info, |
| 125 LanguageMode language_mode); |
| 126 |
| 127 ValueEffectControl BuildPropertyStore( |
| 128 Node* receiver, Node* value, Node* context, Node* frame_state, |
| 129 Node* effect, Node* control, Handle<Name> name, |
| 130 ZoneVector<Node*>* if_exceptions, PropertyAccessInfo const& access_info, |
| 131 AccessMode access_mode, LanguageMode language_mode); |
118 | 132 |
| 133 // Helpers for accessor inlining. |
| 134 Node* InlinePropertyGetterCall(Node* receiver, Node* context, |
| 135 Node* frame_state, Node** effect, |
| 136 Node** control, |
| 137 ZoneVector<Node*>* if_exceptions, |
| 138 PropertyAccessInfo const& access_info); |
| 139 Node* InlinePropertySetterCall(Node* receiver, Node* value, Node* context, |
| 140 Node* frame_state, Node** effect, |
| 141 Node** control, |
| 142 ZoneVector<Node*>* if_exceptions, |
| 143 PropertyAccessInfo const& access_info); |
| 144 Node* InlineApiCall(Node* receiver, Node* context, Node* target, |
| 145 Node* frame_state, Node* value, Node** effect, |
| 146 Node** control, Handle<SharedFunctionInfo> shared_info, |
| 147 Handle<FunctionTemplateInfo> function_template_info); |
| 148 |
119 // Construct the appropriate subgraph for element access. | 149 // Construct the appropriate subgraph for element access. |
120 ValueEffectControl BuildElementAccess(Node* receiver, Node* index, | 150 ValueEffectControl BuildElementAccess(Node* receiver, Node* index, |
121 Node* value, Node* effect, | 151 Node* value, Node* effect, |
122 Node* control, | 152 Node* control, |
123 ElementAccessInfo const& access_info, | 153 ElementAccessInfo const& access_info, |
124 AccessMode access_mode, | 154 AccessMode access_mode, |
125 KeyedAccessStoreMode store_mode); | 155 KeyedAccessStoreMode store_mode); |
126 | 156 |
127 // Construct an appropriate heap object check. | |
128 Node* BuildCheckHeapObject(Node* receiver, Node** effect, Node* control); | |
129 | |
130 // Construct an appropriate map check. | |
131 Node* BuildCheckMaps(Node* receiver, Node* effect, Node* control, | |
132 MapHandles const& maps); | |
133 | |
134 // Construct appropriate subgraph to extend properties backing store. | 157 // Construct appropriate subgraph to extend properties backing store. |
135 Node* BuildExtendPropertiesBackingStore(Handle<Map> map, Node* properties, | 158 Node* BuildExtendPropertiesBackingStore(Handle<Map> map, Node* properties, |
136 Node* effect, Node* control); | 159 Node* effect, Node* control); |
137 | 160 |
138 // Adds stability dependencies on all prototypes of every class in | |
139 // {receiver_type} up to (and including) the {holder}. | |
140 void AssumePrototypesStable(MapHandles const& receiver_maps, | |
141 Handle<JSObject> holder); | |
142 | |
143 // Checks if we can turn the hole into undefined when loading an element | 161 // Checks if we can turn the hole into undefined when loading an element |
144 // from an object with one of the {receiver_maps}; sets up appropriate | 162 // from an object with one of the {receiver_maps}; sets up appropriate |
145 // code dependencies and might use the array protector cell. | 163 // code dependencies and might use the array protector cell. |
146 bool CanTreatHoleAsUndefined(MapHandles const& receiver_maps); | 164 bool CanTreatHoleAsUndefined(MapHandles const& receiver_maps); |
147 | 165 |
148 // Extract receiver maps from {nexus} and filter based on {receiver} if | 166 // Extract receiver maps from {nexus} and filter based on {receiver} if |
149 // possible. | 167 // possible. |
150 bool ExtractReceiverMaps(Node* receiver, Node* effect, | 168 bool ExtractReceiverMaps(Node* receiver, Node* effect, |
151 FeedbackNexus const& nexus, | 169 FeedbackNexus const& nexus, |
152 MapHandles* receiver_maps); | 170 MapHandles* receiver_maps); |
153 | 171 |
154 // Try to infer maps for the given {receiver} at the current {effect}. | 172 // Try to infer maps for the given {receiver} at the current {effect}. |
155 // If maps are returned then you can be sure that the {receiver} definitely | 173 // If maps are returned then you can be sure that the {receiver} definitely |
156 // has one of the returned maps at this point in the program (identified | 174 // has one of the returned maps at this point in the program (identified |
157 // by {effect}). | 175 // by {effect}). |
158 bool InferReceiverMaps(Node* receiver, Node* effect, | 176 bool InferReceiverMaps(Node* receiver, Node* effect, |
159 MapHandles* receiver_maps); | 177 MapHandles* receiver_maps); |
160 // Try to infer a root map for the {receiver} independent of the current | 178 // Try to infer a root map for the {receiver} independent of the current |
161 // program location. | 179 // program location. |
162 MaybeHandle<Map> InferReceiverRootMap(Node* receiver); | 180 MaybeHandle<Map> InferReceiverRootMap(Node* receiver); |
163 | 181 |
164 ValueEffectControl InlineApiCall( | |
165 Node* receiver, Node* context, Node* target, Node* frame_state, | |
166 Node* parameter, Node* effect, Node* control, | |
167 Handle<SharedFunctionInfo> shared_info, | |
168 Handle<FunctionTemplateInfo> function_template_info); | |
169 | |
170 // Script context lookup logic. | 182 // Script context lookup logic. |
171 struct ScriptContextTableLookupResult; | 183 struct ScriptContextTableLookupResult; |
172 bool LookupInScriptContextTable(Handle<Name> name, | 184 bool LookupInScriptContextTable(Handle<Name> name, |
173 ScriptContextTableLookupResult* result); | 185 ScriptContextTableLookupResult* result); |
174 | 186 |
175 Graph* graph() const; | 187 Graph* graph() const; |
176 JSGraph* jsgraph() const { return jsgraph_; } | 188 JSGraph* jsgraph() const { return jsgraph_; } |
177 Isolate* isolate() const; | 189 Isolate* isolate() const; |
178 Factory* factory() const; | 190 Factory* factory() const; |
179 CommonOperatorBuilder* common() const; | 191 CommonOperatorBuilder* common() const; |
(...skipping 19 matching lines...) Expand all Loading... |
199 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); | 211 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); |
200 }; | 212 }; |
201 | 213 |
202 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) | 214 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) |
203 | 215 |
204 } // namespace compiler | 216 } // namespace compiler |
205 } // namespace internal | 217 } // namespace internal |
206 } // namespace v8 | 218 } // namespace v8 |
207 | 219 |
208 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 220 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
OLD | NEW |