OLD | NEW |
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 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 Operator::kEliminatable); | 149 Operator::kEliminatable); |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 void JSGenericLowering::LowerJSLoadProperty(Node* node) { | 153 void JSGenericLowering::LowerJSLoadProperty(Node* node) { |
154 Node* closure = NodeProperties::GetValueInput(node, 2); | 154 Node* closure = NodeProperties::GetValueInput(node, 2); |
155 Node* effect = NodeProperties::GetEffectInput(node); | 155 Node* effect = NodeProperties::GetEffectInput(node); |
156 Node* control = NodeProperties::GetControlInput(node); | 156 Node* control = NodeProperties::GetControlInput(node); |
157 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 157 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
158 const PropertyAccess& p = PropertyAccessOf(node->op()); | 158 const PropertyAccess& p = PropertyAccessOf(node->op()); |
159 Callable callable = | 159 Callable callable = CodeFactory::KeyedLoadICInOptimizedCode(isolate()); |
160 CodeFactory::KeyedLoadICInOptimizedCode(isolate(), UNINITIALIZED); | |
161 // Load the type feedback vector from the closure. | 160 // Load the type feedback vector from the closure. |
162 Node* literals = effect = graph()->NewNode( | 161 Node* literals = effect = graph()->NewNode( |
163 machine()->Load(MachineType::AnyTagged()), closure, | 162 machine()->Load(MachineType::AnyTagged()), closure, |
164 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 163 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
165 effect, control); | 164 effect, control); |
166 Node* vector = effect = graph()->NewNode( | 165 Node* vector = effect = graph()->NewNode( |
167 machine()->Load(MachineType::AnyTagged()), literals, | 166 machine()->Load(MachineType::AnyTagged()), literals, |
168 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 167 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
169 kHeapObjectTag), | 168 kHeapObjectTag), |
170 effect, control); | 169 effect, control); |
171 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 170 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
172 node->ReplaceInput(3, vector); | 171 node->ReplaceInput(3, vector); |
173 node->ReplaceInput(6, effect); | 172 node->ReplaceInput(6, effect); |
174 ReplaceWithStubCall(node, callable, flags); | 173 ReplaceWithStubCall(node, callable, flags); |
175 } | 174 } |
176 | 175 |
177 | 176 |
178 void JSGenericLowering::LowerJSLoadNamed(Node* node) { | 177 void JSGenericLowering::LowerJSLoadNamed(Node* node) { |
179 Node* closure = NodeProperties::GetValueInput(node, 1); | 178 Node* closure = NodeProperties::GetValueInput(node, 1); |
180 Node* effect = NodeProperties::GetEffectInput(node); | 179 Node* effect = NodeProperties::GetEffectInput(node); |
181 Node* control = NodeProperties::GetControlInput(node); | 180 Node* control = NodeProperties::GetControlInput(node); |
182 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 181 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
183 NamedAccess const& p = NamedAccessOf(node->op()); | 182 NamedAccess const& p = NamedAccessOf(node->op()); |
184 Callable callable = CodeFactory::LoadICInOptimizedCode( | 183 Callable callable = |
185 isolate(), NOT_INSIDE_TYPEOF, UNINITIALIZED); | 184 CodeFactory::LoadICInOptimizedCode(isolate(), NOT_INSIDE_TYPEOF); |
186 // Load the type feedback vector from the closure. | 185 // Load the type feedback vector from the closure. |
187 Node* literals = effect = graph()->NewNode( | 186 Node* literals = effect = graph()->NewNode( |
188 machine()->Load(MachineType::AnyTagged()), closure, | 187 machine()->Load(MachineType::AnyTagged()), closure, |
189 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 188 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
190 effect, control); | 189 effect, control); |
191 Node* vector = effect = graph()->NewNode( | 190 Node* vector = effect = graph()->NewNode( |
192 machine()->Load(MachineType::AnyTagged()), literals, | 191 machine()->Load(MachineType::AnyTagged()), literals, |
193 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 192 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
194 kHeapObjectTag), | 193 kHeapObjectTag), |
195 effect, control); | 194 effect, control); |
196 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 195 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
197 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 196 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
198 node->ReplaceInput(3, vector); | 197 node->ReplaceInput(3, vector); |
199 node->ReplaceInput(6, effect); | 198 node->ReplaceInput(6, effect); |
200 ReplaceWithStubCall(node, callable, flags); | 199 ReplaceWithStubCall(node, callable, flags); |
201 } | 200 } |
202 | 201 |
203 | 202 |
204 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { | 203 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { |
205 Node* closure = NodeProperties::GetValueInput(node, 0); | 204 Node* closure = NodeProperties::GetValueInput(node, 0); |
206 Node* context = NodeProperties::GetContextInput(node); | 205 Node* context = NodeProperties::GetContextInput(node); |
207 Node* effect = NodeProperties::GetEffectInput(node); | 206 Node* effect = NodeProperties::GetEffectInput(node); |
208 Node* control = NodeProperties::GetControlInput(node); | 207 Node* control = NodeProperties::GetControlInput(node); |
209 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 208 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
210 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); | 209 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); |
211 Callable callable = CodeFactory::LoadICInOptimizedCode( | 210 Callable callable = |
212 isolate(), p.typeof_mode(), UNINITIALIZED); | 211 CodeFactory::LoadICInOptimizedCode(isolate(), p.typeof_mode()); |
213 // Load the type feedback vector from the closure. | 212 // Load the type feedback vector from the closure. |
214 Node* literals = effect = graph()->NewNode( | 213 Node* literals = effect = graph()->NewNode( |
215 machine()->Load(MachineType::AnyTagged()), closure, | 214 machine()->Load(MachineType::AnyTagged()), closure, |
216 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 215 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
217 effect, control); | 216 effect, control); |
218 Node* vector = effect = graph()->NewNode( | 217 Node* vector = effect = graph()->NewNode( |
219 machine()->Load(MachineType::AnyTagged()), literals, | 218 machine()->Load(MachineType::AnyTagged()), literals, |
220 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 219 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
221 kHeapObjectTag), | 220 kHeapObjectTag), |
222 effect, control); | 221 effect, control); |
(...skipping 16 matching lines...) Expand all Loading... |
239 } | 238 } |
240 | 239 |
241 | 240 |
242 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 241 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
243 Node* closure = NodeProperties::GetValueInput(node, 3); | 242 Node* closure = NodeProperties::GetValueInput(node, 3); |
244 Node* effect = NodeProperties::GetEffectInput(node); | 243 Node* effect = NodeProperties::GetEffectInput(node); |
245 Node* control = NodeProperties::GetControlInput(node); | 244 Node* control = NodeProperties::GetControlInput(node); |
246 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 245 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
247 PropertyAccess const& p = PropertyAccessOf(node->op()); | 246 PropertyAccess const& p = PropertyAccessOf(node->op()); |
248 LanguageMode language_mode = p.language_mode(); | 247 LanguageMode language_mode = p.language_mode(); |
249 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( | 248 Callable callable = |
250 isolate(), language_mode, UNINITIALIZED); | 249 CodeFactory::KeyedStoreICInOptimizedCode(isolate(), language_mode); |
251 // Load the type feedback vector from the closure. | 250 // Load the type feedback vector from the closure. |
252 Node* literals = effect = graph()->NewNode( | 251 Node* literals = effect = graph()->NewNode( |
253 machine()->Load(MachineType::AnyTagged()), closure, | 252 machine()->Load(MachineType::AnyTagged()), closure, |
254 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 253 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
255 effect, control); | 254 effect, control); |
256 Node* vector = effect = graph()->NewNode( | 255 Node* vector = effect = graph()->NewNode( |
257 machine()->Load(MachineType::AnyTagged()), literals, | 256 machine()->Load(MachineType::AnyTagged()), literals, |
258 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 257 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
259 kHeapObjectTag), | 258 kHeapObjectTag), |
260 effect, control); | 259 effect, control); |
261 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 260 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
262 node->ReplaceInput(4, vector); | 261 node->ReplaceInput(4, vector); |
263 node->ReplaceInput(7, effect); | 262 node->ReplaceInput(7, effect); |
264 ReplaceWithStubCall(node, callable, flags); | 263 ReplaceWithStubCall(node, callable, flags); |
265 } | 264 } |
266 | 265 |
267 | 266 |
268 void JSGenericLowering::LowerJSStoreNamed(Node* node) { | 267 void JSGenericLowering::LowerJSStoreNamed(Node* node) { |
269 Node* closure = NodeProperties::GetValueInput(node, 2); | 268 Node* closure = NodeProperties::GetValueInput(node, 2); |
270 Node* effect = NodeProperties::GetEffectInput(node); | 269 Node* effect = NodeProperties::GetEffectInput(node); |
271 Node* control = NodeProperties::GetControlInput(node); | 270 Node* control = NodeProperties::GetControlInput(node); |
272 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 271 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
273 NamedAccess const& p = NamedAccessOf(node->op()); | 272 NamedAccess const& p = NamedAccessOf(node->op()); |
274 Callable callable = CodeFactory::StoreICInOptimizedCode( | 273 Callable callable = |
275 isolate(), p.language_mode(), UNINITIALIZED); | 274 CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); |
276 // Load the type feedback vector from the closure. | 275 // Load the type feedback vector from the closure. |
277 Node* literals = effect = graph()->NewNode( | 276 Node* literals = effect = graph()->NewNode( |
278 machine()->Load(MachineType::AnyTagged()), closure, | 277 machine()->Load(MachineType::AnyTagged()), closure, |
279 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 278 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
280 effect, control); | 279 effect, control); |
281 Node* vector = effect = graph()->NewNode( | 280 Node* vector = effect = graph()->NewNode( |
282 machine()->Load(MachineType::AnyTagged()), literals, | 281 machine()->Load(MachineType::AnyTagged()), literals, |
283 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 282 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
284 kHeapObjectTag), | 283 kHeapObjectTag), |
285 effect, control); | 284 effect, control); |
286 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 285 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
287 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 286 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
288 node->ReplaceInput(4, vector); | 287 node->ReplaceInput(4, vector); |
289 node->ReplaceInput(7, effect); | 288 node->ReplaceInput(7, effect); |
290 ReplaceWithStubCall(node, callable, flags); | 289 ReplaceWithStubCall(node, callable, flags); |
291 } | 290 } |
292 | 291 |
293 | 292 |
294 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 293 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
295 Node* closure = NodeProperties::GetValueInput(node, 1); | 294 Node* closure = NodeProperties::GetValueInput(node, 1); |
296 Node* context = NodeProperties::GetContextInput(node); | 295 Node* context = NodeProperties::GetContextInput(node); |
297 Node* effect = NodeProperties::GetEffectInput(node); | 296 Node* effect = NodeProperties::GetEffectInput(node); |
298 Node* control = NodeProperties::GetControlInput(node); | 297 Node* control = NodeProperties::GetControlInput(node); |
299 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 298 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
300 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); | 299 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
301 Callable callable = CodeFactory::StoreICInOptimizedCode( | 300 Callable callable = |
302 isolate(), p.language_mode(), UNINITIALIZED); | 301 CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); |
303 // Load the type feedback vector from the closure. | 302 // Load the type feedback vector from the closure. |
304 Node* literals = effect = graph()->NewNode( | 303 Node* literals = effect = graph()->NewNode( |
305 machine()->Load(MachineType::AnyTagged()), closure, | 304 machine()->Load(MachineType::AnyTagged()), closure, |
306 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 305 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
307 effect, control); | 306 effect, control); |
308 Node* vector = effect = graph()->NewNode( | 307 Node* vector = effect = graph()->NewNode( |
309 machine()->Load(MachineType::AnyTagged()), literals, | 308 machine()->Load(MachineType::AnyTagged()), literals, |
310 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 309 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
311 kHeapObjectTag), | 310 kHeapObjectTag), |
312 effect, control); | 311 effect, control); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 741 } |
743 | 742 |
744 | 743 |
745 MachineOperatorBuilder* JSGenericLowering::machine() const { | 744 MachineOperatorBuilder* JSGenericLowering::machine() const { |
746 return jsgraph()->machine(); | 745 return jsgraph()->machine(); |
747 } | 746 } |
748 | 747 |
749 } // namespace compiler | 748 } // namespace compiler |
750 } // namespace internal | 749 } // namespace internal |
751 } // namespace v8 | 750 } // namespace v8 |
OLD | NEW |