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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 ReplaceWithStubCall(node, callable, flags); | 324 ReplaceWithStubCall(node, callable, flags); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 328 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
329 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 329 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
330 PropertyAccess const& p = PropertyAccessOf(node->op()); | 330 PropertyAccess const& p = PropertyAccessOf(node->op()); |
331 LanguageMode language_mode = p.language_mode(); | 331 LanguageMode language_mode = p.language_mode(); |
332 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( | 332 Callable callable = CodeFactory::KeyedStoreICInOptimizedCode( |
333 isolate(), language_mode, UNINITIALIZED); | 333 isolate(), language_mode, UNINITIALIZED); |
334 if (FLAG_vector_stores) { | 334 DCHECK(p.feedback().index() != -1); |
335 DCHECK(p.feedback().index() != -1); | 335 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
336 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | |
337 } else { | |
338 node->RemoveInput(3); | |
339 } | |
340 ReplaceWithStubCall(node, callable, | 336 ReplaceWithStubCall(node, callable, |
341 CallDescriptor::kPatchableCallSite | flags); | 337 CallDescriptor::kPatchableCallSite | flags); |
342 } | 338 } |
343 | 339 |
344 | 340 |
345 void JSGenericLowering::LowerJSStoreNamed(Node* node) { | 341 void JSGenericLowering::LowerJSStoreNamed(Node* node) { |
346 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 342 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
347 NamedAccess const& p = NamedAccessOf(node->op()); | 343 NamedAccess const& p = NamedAccessOf(node->op()); |
348 Callable callable = CodeFactory::StoreICInOptimizedCode( | 344 Callable callable = CodeFactory::StoreICInOptimizedCode( |
349 isolate(), p.language_mode(), UNINITIALIZED); | 345 isolate(), p.language_mode(), UNINITIALIZED); |
350 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 346 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
351 if (FLAG_vector_stores) { | 347 DCHECK(p.feedback().index() != -1); |
352 DCHECK(p.feedback().index() != -1); | 348 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
353 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | |
354 } else { | |
355 node->RemoveInput(3); | |
356 } | |
357 ReplaceWithStubCall(node, callable, | 349 ReplaceWithStubCall(node, callable, |
358 CallDescriptor::kPatchableCallSite | flags); | 350 CallDescriptor::kPatchableCallSite | flags); |
359 } | 351 } |
360 | 352 |
361 | 353 |
362 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 354 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
363 Node* context = NodeProperties::GetContextInput(node); | 355 Node* context = NodeProperties::GetContextInput(node); |
364 Node* effect = NodeProperties::GetEffectInput(node); | 356 Node* effect = NodeProperties::GetEffectInput(node); |
365 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 357 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
366 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); | 358 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
367 Callable callable = CodeFactory::StoreICInOptimizedCode( | 359 Callable callable = CodeFactory::StoreICInOptimizedCode( |
368 isolate(), p.language_mode(), UNINITIALIZED); | 360 isolate(), p.language_mode(), UNINITIALIZED); |
369 // Load global object from the context. | 361 // Load global object from the context. |
370 Node* global = graph()->NewNode(machine()->Load(kMachAnyTagged), context, | 362 Node* global = graph()->NewNode(machine()->Load(kMachAnyTagged), context, |
371 jsgraph()->IntPtrConstant(Context::SlotOffset( | 363 jsgraph()->IntPtrConstant(Context::SlotOffset( |
372 Context::GLOBAL_OBJECT_INDEX)), | 364 Context::GLOBAL_OBJECT_INDEX)), |
373 effect, graph()->start()); | 365 effect, graph()->start()); |
374 node->InsertInput(zone(), 0, global); | 366 node->InsertInput(zone(), 0, global); |
375 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 367 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
376 if (FLAG_vector_stores) { | 368 DCHECK(p.feedback().index() != -1); |
377 DCHECK(p.feedback().index() != -1); | 369 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
378 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | |
379 } else { | |
380 node->RemoveInput(3); | |
381 } | |
382 ReplaceWithStubCall(node, callable, | 370 ReplaceWithStubCall(node, callable, |
383 CallDescriptor::kPatchableCallSite | flags); | 371 CallDescriptor::kPatchableCallSite | flags); |
384 } | 372 } |
385 | 373 |
386 | 374 |
387 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { | 375 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { |
388 LanguageMode language_mode = OpParameter<LanguageMode>(node); | 376 LanguageMode language_mode = OpParameter<LanguageMode>(node); |
389 ReplaceWithRuntimeCall(node, is_strict(language_mode) | 377 ReplaceWithRuntimeCall(node, is_strict(language_mode) |
390 ? Runtime::kDeleteProperty_Strict | 378 ? Runtime::kDeleteProperty_Strict |
391 : Runtime::kDeleteProperty_Sloppy); | 379 : Runtime::kDeleteProperty_Sloppy); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 843 } |
856 | 844 |
857 | 845 |
858 MachineOperatorBuilder* JSGenericLowering::machine() const { | 846 MachineOperatorBuilder* JSGenericLowering::machine() const { |
859 return jsgraph()->machine(); | 847 return jsgraph()->machine(); |
860 } | 848 } |
861 | 849 |
862 } // namespace compiler | 850 } // namespace compiler |
863 } // namespace internal | 851 } // namespace internal |
864 } // namespace v8 | 852 } // namespace v8 |
OLD | NEW |