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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 kHeapObjectTag), | 217 kHeapObjectTag), |
218 effect, control); | 218 effect, control); |
219 node->InsertInput(zone(), 0, jsgraph()->SmiConstant(p.feedback().index())); | 219 node->InsertInput(zone(), 0, jsgraph()->SmiConstant(p.feedback().index())); |
220 node->ReplaceInput(1, vector); | 220 node->ReplaceInput(1, vector); |
221 node->ReplaceInput(4, effect); | 221 node->ReplaceInput(4, effect); |
222 ReplaceWithStubCall(node, callable, flags); | 222 ReplaceWithStubCall(node, callable, flags); |
223 } | 223 } |
224 | 224 |
225 | 225 |
226 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 226 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
| 227 Node* receiver = NodeProperties::GetValueInput(node, 0); |
| 228 Node* key = NodeProperties::GetValueInput(node, 1); |
| 229 Node* value = NodeProperties::GetValueInput(node, 2); |
227 Node* closure = NodeProperties::GetValueInput(node, 3); | 230 Node* closure = NodeProperties::GetValueInput(node, 3); |
228 Node* effect = NodeProperties::GetEffectInput(node); | 231 Node* effect = NodeProperties::GetEffectInput(node); |
229 Node* control = NodeProperties::GetControlInput(node); | 232 Node* control = NodeProperties::GetControlInput(node); |
230 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 233 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
231 PropertyAccess const& p = PropertyAccessOf(node->op()); | 234 PropertyAccess const& p = PropertyAccessOf(node->op()); |
232 LanguageMode language_mode = p.language_mode(); | 235 LanguageMode language_mode = p.language_mode(); |
233 Callable callable = | 236 Callable callable = |
234 CodeFactory::KeyedStoreICInOptimizedCode(isolate(), language_mode); | 237 CodeFactory::KeyedStoreICInOptimizedCode(isolate(), language_mode); |
235 // Load the type feedback vector from the closure. | 238 // Load the type feedback vector from the closure. |
236 Node* literals = effect = graph()->NewNode( | 239 Node* literals = effect = graph()->NewNode( |
237 machine()->Load(MachineType::AnyTagged()), closure, | 240 machine()->Load(MachineType::AnyTagged()), closure, |
238 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 241 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
239 effect, control); | 242 effect, control); |
240 Node* vector = effect = graph()->NewNode( | 243 Node* vector = effect = graph()->NewNode( |
241 machine()->Load(MachineType::AnyTagged()), literals, | 244 machine()->Load(MachineType::AnyTagged()), literals, |
242 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 245 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
243 kHeapObjectTag), | 246 kHeapObjectTag), |
244 effect, control); | 247 effect, control); |
245 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 248 typedef StoreWithVectorDescriptor Descriptor; |
246 node->ReplaceInput(4, vector); | 249 node->InsertInputs(zone(), 0, 1); |
| 250 node->ReplaceInput(Descriptor::kReceiver, receiver); |
| 251 node->ReplaceInput(Descriptor::kName, key); |
| 252 node->ReplaceInput(Descriptor::kValue, value); |
| 253 node->ReplaceInput(Descriptor::kSlot, |
| 254 jsgraph()->SmiConstant(p.feedback().index())); |
| 255 node->ReplaceInput(Descriptor::kVector, vector); |
247 node->ReplaceInput(7, effect); | 256 node->ReplaceInput(7, effect); |
248 ReplaceWithStubCall(node, callable, flags); | 257 ReplaceWithStubCall(node, callable, flags); |
249 } | 258 } |
250 | 259 |
251 | 260 |
252 void JSGenericLowering::LowerJSStoreNamed(Node* node) { | 261 void JSGenericLowering::LowerJSStoreNamed(Node* node) { |
| 262 Node* receiver = NodeProperties::GetValueInput(node, 0); |
| 263 Node* value = NodeProperties::GetValueInput(node, 1); |
253 Node* closure = NodeProperties::GetValueInput(node, 2); | 264 Node* closure = NodeProperties::GetValueInput(node, 2); |
254 Node* effect = NodeProperties::GetEffectInput(node); | 265 Node* effect = NodeProperties::GetEffectInput(node); |
255 Node* control = NodeProperties::GetControlInput(node); | 266 Node* control = NodeProperties::GetControlInput(node); |
256 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 267 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
257 NamedAccess const& p = NamedAccessOf(node->op()); | 268 NamedAccess const& p = NamedAccessOf(node->op()); |
258 Callable callable = | 269 Callable callable = |
259 CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); | 270 CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); |
260 // Load the type feedback vector from the closure. | 271 // Load the type feedback vector from the closure. |
261 Node* literals = effect = graph()->NewNode( | 272 Node* literals = effect = graph()->NewNode( |
262 machine()->Load(MachineType::AnyTagged()), closure, | 273 machine()->Load(MachineType::AnyTagged()), closure, |
263 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 274 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
264 effect, control); | 275 effect, control); |
265 Node* vector = effect = graph()->NewNode( | 276 Node* vector = effect = graph()->NewNode( |
266 machine()->Load(MachineType::AnyTagged()), literals, | 277 machine()->Load(MachineType::AnyTagged()), literals, |
267 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 278 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
268 kHeapObjectTag), | 279 kHeapObjectTag), |
269 effect, control); | 280 effect, control); |
270 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 281 typedef StoreWithVectorDescriptor Descriptor; |
271 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 282 node->InsertInputs(zone(), 0, 2); |
272 node->ReplaceInput(4, vector); | 283 node->ReplaceInput(Descriptor::kReceiver, receiver); |
| 284 node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name())); |
| 285 node->ReplaceInput(Descriptor::kValue, value); |
| 286 node->ReplaceInput(Descriptor::kSlot, |
| 287 jsgraph()->SmiConstant(p.feedback().index())); |
| 288 node->ReplaceInput(Descriptor::kVector, vector); |
273 node->ReplaceInput(7, effect); | 289 node->ReplaceInput(7, effect); |
274 ReplaceWithStubCall(node, callable, flags); | 290 ReplaceWithStubCall(node, callable, flags); |
275 } | 291 } |
276 | 292 |
277 | 293 |
278 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 294 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
| 295 Node* value = NodeProperties::GetValueInput(node, 0); |
279 Node* closure = NodeProperties::GetValueInput(node, 1); | 296 Node* closure = NodeProperties::GetValueInput(node, 1); |
280 Node* context = NodeProperties::GetContextInput(node); | 297 Node* context = NodeProperties::GetContextInput(node); |
281 Node* effect = NodeProperties::GetEffectInput(node); | 298 Node* effect = NodeProperties::GetEffectInput(node); |
282 Node* control = NodeProperties::GetControlInput(node); | 299 Node* control = NodeProperties::GetControlInput(node); |
283 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 300 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
284 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); | 301 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
285 Callable callable = | 302 Callable callable = |
286 CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); | 303 CodeFactory::StoreICInOptimizedCode(isolate(), p.language_mode()); |
287 // Load the type feedback vector from the closure. | 304 // Load the type feedback vector from the closure. |
288 Node* literals = effect = graph()->NewNode( | 305 Node* literals = effect = graph()->NewNode( |
289 machine()->Load(MachineType::AnyTagged()), closure, | 306 machine()->Load(MachineType::AnyTagged()), closure, |
290 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 307 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
291 effect, control); | 308 effect, control); |
292 Node* vector = effect = graph()->NewNode( | 309 Node* vector = effect = graph()->NewNode( |
293 machine()->Load(MachineType::AnyTagged()), literals, | 310 machine()->Load(MachineType::AnyTagged()), literals, |
294 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 311 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
295 kHeapObjectTag), | 312 kHeapObjectTag), |
296 effect, control); | 313 effect, control); |
297 // Load global object from the context. | 314 // Load global object from the context. |
298 Node* native_context = effect = | 315 Node* native_context = effect = |
299 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, | 316 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, |
300 jsgraph()->IntPtrConstant( | 317 jsgraph()->IntPtrConstant( |
301 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), | 318 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), |
302 effect, control); | 319 effect, control); |
303 Node* global = effect = graph()->NewNode( | 320 Node* global = effect = graph()->NewNode( |
304 machine()->Load(MachineType::AnyTagged()), native_context, | 321 machine()->Load(MachineType::AnyTagged()), native_context, |
305 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), | 322 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), |
306 effect, control); | 323 effect, control); |
307 node->InsertInput(zone(), 0, global); | 324 typedef StoreWithVectorDescriptor Descriptor; |
308 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 325 node->InsertInputs(zone(), 0, 3); |
309 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 326 node->ReplaceInput(Descriptor::kReceiver, global); |
310 node->ReplaceInput(4, vector); | 327 node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name())); |
| 328 node->ReplaceInput(Descriptor::kValue, value); |
| 329 node->ReplaceInput(Descriptor::kSlot, |
| 330 jsgraph()->SmiConstant(p.feedback().index())); |
| 331 node->ReplaceInput(Descriptor::kVector, vector); |
311 node->ReplaceInput(7, effect); | 332 node->ReplaceInput(7, effect); |
312 ReplaceWithStubCall(node, callable, flags); | 333 ReplaceWithStubCall(node, callable, flags); |
313 } | 334 } |
314 | 335 |
315 | 336 |
316 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { | 337 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { |
317 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 338 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
318 ReplaceWithRuntimeCall(node, is_strict(language_mode) | 339 ReplaceWithRuntimeCall(node, is_strict(language_mode) |
319 ? Runtime::kDeleteProperty_Strict | 340 ? Runtime::kDeleteProperty_Strict |
320 : Runtime::kDeleteProperty_Sloppy); | 341 : Runtime::kDeleteProperty_Sloppy); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 692 } |
672 | 693 |
673 | 694 |
674 MachineOperatorBuilder* JSGenericLowering::machine() const { | 695 MachineOperatorBuilder* JSGenericLowering::machine() const { |
675 return jsgraph()->machine(); | 696 return jsgraph()->machine(); |
676 } | 697 } |
677 | 698 |
678 } // namespace compiler | 699 } // namespace compiler |
679 } // namespace internal | 700 } // namespace internal |
680 } // namespace v8 | 701 } // namespace v8 |
OLD | NEW |