Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: src/code-stubs.cc

Issue 2172223002: [stubs] Call interface descriptors cleanup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@store-ic-tf
Patch Set: Addressing comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 CodeStubAssembler assembler(isolate(), &zone, descriptor, GetCodeFlags(), 414 CodeStubAssembler assembler(isolate(), &zone, descriptor, GetCodeFlags(),
415 name); 415 name);
416 GenerateAssembly(&assembler); 416 GenerateAssembly(&assembler);
417 return assembler.GenerateCode(); 417 return assembler.GenerateCode();
418 } 418 }
419 419
420 void LoadICTrampolineTFStub::GenerateAssembly( 420 void LoadICTrampolineTFStub::GenerateAssembly(
421 CodeStubAssembler* assembler) const { 421 CodeStubAssembler* assembler) const {
422 typedef compiler::Node Node; 422 typedef compiler::Node Node;
423 423
424 Node* receiver = assembler->Parameter(0); 424 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
425 Node* name = assembler->Parameter(1); 425 Node* name = assembler->Parameter(Descriptor::kName);
426 Node* slot = assembler->Parameter(2); 426 Node* slot = assembler->Parameter(Descriptor::kSlot);
427 Node* context = assembler->Parameter(3); 427 Node* context = assembler->Parameter(Descriptor::kContext);
428 Node* vector = assembler->LoadTypeFeedbackVectorForStub(); 428 Node* vector = assembler->LoadTypeFeedbackVectorForStub();
429 429
430 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); 430 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
431 assembler->LoadIC(&p); 431 assembler->LoadIC(&p);
432 } 432 }
433 433
434 void LoadICTFStub::GenerateAssembly(CodeStubAssembler* assembler) const { 434 void LoadICTFStub::GenerateAssembly(CodeStubAssembler* assembler) const {
435 typedef compiler::Node Node; 435 typedef compiler::Node Node;
436 436
437 Node* receiver = assembler->Parameter(0); 437 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
438 Node* name = assembler->Parameter(1); 438 Node* name = assembler->Parameter(Descriptor::kName);
439 Node* slot = assembler->Parameter(2); 439 Node* slot = assembler->Parameter(Descriptor::kSlot);
440 Node* vector = assembler->Parameter(3); 440 Node* vector = assembler->Parameter(Descriptor::kVector);
441 Node* context = assembler->Parameter(4); 441 Node* context = assembler->Parameter(Descriptor::kContext);
442 442
443 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); 443 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
444 assembler->LoadIC(&p); 444 assembler->LoadIC(&p);
445 } 445 }
446 446
447 void LoadGlobalICTrampolineStub::GenerateAssembly( 447 void LoadGlobalICTrampolineStub::GenerateAssembly(
448 CodeStubAssembler* assembler) const { 448 CodeStubAssembler* assembler) const {
449 typedef compiler::Node Node; 449 typedef compiler::Node Node;
450 450
451 Node* slot = assembler->Parameter(0); 451 Node* slot = assembler->Parameter(Descriptor::kSlot);
452 Node* context = assembler->Parameter(1); 452 Node* context = assembler->Parameter(Descriptor::kContext);
453 Node* vector = assembler->LoadTypeFeedbackVectorForStub(); 453 Node* vector = assembler->LoadTypeFeedbackVectorForStub();
454 454
455 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, 455 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot,
456 vector); 456 vector);
457 assembler->LoadGlobalIC(&p); 457 assembler->LoadGlobalIC(&p);
458 } 458 }
459 459
460 void LoadGlobalICStub::GenerateAssembly(CodeStubAssembler* assembler) const { 460 void LoadGlobalICStub::GenerateAssembly(CodeStubAssembler* assembler) const {
461 typedef compiler::Node Node; 461 typedef compiler::Node Node;
462 462
463 Node* slot = assembler->Parameter(0); 463 Node* slot = assembler->Parameter(Descriptor::kSlot);
464 Node* vector = assembler->Parameter(1); 464 Node* vector = assembler->Parameter(Descriptor::kVector);
465 Node* context = assembler->Parameter(2); 465 Node* context = assembler->Parameter(Descriptor::kContext);
466 466
467 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, 467 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot,
468 vector); 468 vector);
469 assembler->LoadGlobalIC(&p); 469 assembler->LoadGlobalIC(&p);
470 } 470 }
471 471
472 void AllocateHeapNumberStub::GenerateAssembly( 472 void AllocateHeapNumberStub::GenerateAssembly(
473 CodeStubAssembler* assembler) const { 473 CodeStubAssembler* assembler) const {
474 typedef compiler::Node Node; 474 typedef compiler::Node Node;
475 475
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult)); 3552 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult));
3553 3553
3554 assembler->Bind(&if_notequal); 3554 assembler->Bind(&if_notequal);
3555 assembler->Return(assembler->BooleanConstant(mode == kNegateResult)); 3555 assembler->Return(assembler->BooleanConstant(mode == kNegateResult));
3556 } 3556 }
3557 3557
3558 } // namespace 3558 } // namespace
3559 3559
3560 void LoadApiGetterStub::GenerateAssembly(CodeStubAssembler* assembler) const { 3560 void LoadApiGetterStub::GenerateAssembly(CodeStubAssembler* assembler) const {
3561 typedef compiler::Node Node; 3561 typedef compiler::Node Node;
3562 Node* context = assembler->Parameter(3); 3562 Node* context = assembler->Parameter(Descriptor::kContext);
3563 Node* receiver = assembler->Parameter(0); 3563 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
3564 // For now we only support receiver_is_holder. 3564 // For now we only support receiver_is_holder.
3565 DCHECK(receiver_is_holder()); 3565 DCHECK(receiver_is_holder());
3566 Node* holder = receiver; 3566 Node* holder = receiver;
3567 Node* map = assembler->LoadMap(receiver); 3567 Node* map = assembler->LoadMap(receiver);
3568 Node* descriptors = assembler->LoadMapDescriptors(map); 3568 Node* descriptors = assembler->LoadMapDescriptors(map);
3569 Node* offset = 3569 Node* offset =
3570 assembler->Int32Constant(DescriptorArray::ToValueIndex(index())); 3570 assembler->Int32Constant(DescriptorArray::ToValueIndex(index()));
3571 Node* callback = assembler->LoadFixedArrayElement(descriptors, offset); 3571 Node* callback = assembler->LoadFixedArrayElement(descriptors, offset);
3572 assembler->TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver, 3572 assembler->TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver,
3573 holder, callback); 3573 holder, callback);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3798 assembler->Return(var_arg.value()); 3798 assembler->Return(var_arg.value());
3799 3799
3800 assembler->Bind(&return_zero); 3800 assembler->Bind(&return_zero);
3801 assembler->Return(assembler->SmiConstant(Smi::FromInt(0))); 3801 assembler->Return(assembler->SmiConstant(Smi::FromInt(0)));
3802 } 3802 }
3803 } 3803 }
3804 3804
3805 void StoreInterceptorStub::GenerateAssembly( 3805 void StoreInterceptorStub::GenerateAssembly(
3806 CodeStubAssembler* assembler) const { 3806 CodeStubAssembler* assembler) const {
3807 typedef compiler::Node Node; 3807 typedef compiler::Node Node;
3808 Node* receiver = assembler->Parameter(0); 3808
3809 Node* name = assembler->Parameter(1); 3809 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
3810 Node* value = assembler->Parameter(2); 3810 Node* name = assembler->Parameter(Descriptor::kName);
3811 // Node* slot = assembler->Parameter(3); 3811 Node* value = assembler->Parameter(Descriptor::kValue);
3812 // Node* vector = assembler->Parameter(4); 3812 Node* context = assembler->Parameter(Descriptor::kContext);
3813 Node* context = assembler->Parameter(5);
3814 assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, 3813 assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context,
3815 receiver, name, value); 3814 receiver, name, value);
3816 } 3815 }
3817 3816
3818 void LoadIndexedInterceptorStub::GenerateAssembly( 3817 void LoadIndexedInterceptorStub::GenerateAssembly(
3819 CodeStubAssembler* assembler) const { 3818 CodeStubAssembler* assembler) const {
3820 typedef compiler::Node Node; 3819 typedef compiler::Node Node;
3821 typedef CodeStubAssembler::Label Label; 3820 typedef CodeStubAssembler::Label Label;
3822 Node* receiver = assembler->Parameter(0); 3821
3823 Node* key = assembler->Parameter(1); 3822 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
3824 Node* slot = assembler->Parameter(2); 3823 Node* key = assembler->Parameter(Descriptor::kName);
3825 Node* vector = assembler->Parameter(3); 3824 Node* slot = assembler->Parameter(Descriptor::kSlot);
3826 Node* context = assembler->Parameter(4); 3825 Node* vector = assembler->Parameter(Descriptor::kVector);
3826 Node* context = assembler->Parameter(Descriptor::kContext);
3827 3827
3828 Label if_keyispositivesmi(assembler), if_keyisinvalid(assembler); 3828 Label if_keyispositivesmi(assembler), if_keyisinvalid(assembler);
3829 assembler->Branch(assembler->WordIsPositiveSmi(key), &if_keyispositivesmi, 3829 assembler->Branch(assembler->WordIsPositiveSmi(key), &if_keyispositivesmi,
3830 &if_keyisinvalid); 3830 &if_keyisinvalid);
3831 assembler->Bind(&if_keyispositivesmi); 3831 assembler->Bind(&if_keyispositivesmi);
3832 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, 3832 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context,
3833 receiver, key); 3833 receiver, key);
3834 3834
3835 assembler->Bind(&if_keyisinvalid); 3835 assembler->Bind(&if_keyisinvalid);
3836 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, 3836 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
4058 CodeStubDescriptor* descriptor) { 4058 CodeStubDescriptor* descriptor) {
4059 descriptor->Initialize( 4059 descriptor->Initialize(
4060 FUNCTION_ADDR(Runtime_ElementsTransitionAndStoreIC_Miss)); 4060 FUNCTION_ADDR(Runtime_ElementsTransitionAndStoreIC_Miss));
4061 } 4061 }
4062 4062
4063 4063
4064 void ToObjectStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { 4064 void ToObjectStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
4065 descriptor->Initialize(Runtime::FunctionForId(Runtime::kToObject)->entry); 4065 descriptor->Initialize(Runtime::FunctionForId(Runtime::kToObject)->entry);
4066 } 4066 }
4067 4067
4068 4068 void StoreTransitionStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
4069 CallInterfaceDescriptor StoreTransitionStub::GetCallInterfaceDescriptor() 4069 descriptor->Initialize(
4070 const { 4070 FUNCTION_ADDR(Runtime_TransitionStoreIC_MissFromStubFailure));
4071 return VectorStoreTransitionDescriptor(isolate());
4072 }
4073
4074
4075 CallInterfaceDescriptor
4076 ElementsTransitionAndStoreStub::GetCallInterfaceDescriptor() const {
4077 return VectorStoreTransitionDescriptor(isolate());
4078 } 4071 }
4079 4072
4080 void TypeofStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {} 4073 void TypeofStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {}
4081 4074
4082 void NumberToStringStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { 4075 void NumberToStringStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
4083 descriptor->Initialize( 4076 descriptor->Initialize(
4084 Runtime::FunctionForId(Runtime::kNumberToString)->entry); 4077 Runtime::FunctionForId(Runtime::kNumberToString)->entry);
4085 } 4078 }
4086 4079
4087 4080
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
4492 } 4485 }
4493 4486
4494 void FastNewFunctionContextStub::GenerateAssembly( 4487 void FastNewFunctionContextStub::GenerateAssembly(
4495 CodeStubAssembler* assembler) const { 4488 CodeStubAssembler* assembler) const {
4496 typedef compiler::Node Node; 4489 typedef compiler::Node Node;
4497 4490
4498 int length = slots() + Context::MIN_CONTEXT_SLOTS; 4491 int length = slots() + Context::MIN_CONTEXT_SLOTS;
4499 int size = length * kPointerSize + FixedArray::kHeaderSize; 4492 int size = length * kPointerSize + FixedArray::kHeaderSize;
4500 4493
4501 // Get the function 4494 // Get the function
4502 Node* function = 4495 Node* function = assembler->Parameter(Descriptor::kFunction);
4503 assembler->Parameter(FastNewFunctionContextDescriptor::kFunctionIndex); 4496 Node* context = assembler->Parameter(Descriptor::kContext);
4504 Node* context =
4505 assembler->Parameter(FastNewFunctionContextDescriptor::kContextIndex);
4506 4497
4507 // Create a new closure from the given function info in new space 4498 // Create a new closure from the given function info in new space
4508 Node* function_context = assembler->Allocate(size); 4499 Node* function_context = assembler->Allocate(size);
4509 4500
4510 assembler->StoreMapNoWriteBarrier( 4501 assembler->StoreMapNoWriteBarrier(
4511 function_context, 4502 function_context,
4512 assembler->HeapConstant(isolate()->factory()->function_context_map())); 4503 assembler->HeapConstant(isolate()->factory()->function_context_map()));
4513 assembler->StoreObjectFieldNoWriteBarrier( 4504 assembler->StoreObjectFieldNoWriteBarrier(
4514 function_context, Context::kLengthOffset, 4505 function_context, Context::kLengthOffset,
4515 assembler->SmiConstant(Smi::FromInt(length))); 4506 assembler->SmiConstant(Smi::FromInt(length)));
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
4685 Isolate* isolate) { 4676 Isolate* isolate) {
4686 FunctionEntryHook entry_hook = isolate->function_entry_hook(); 4677 FunctionEntryHook entry_hook = isolate->function_entry_hook();
4687 DCHECK(entry_hook != NULL); 4678 DCHECK(entry_hook != NULL);
4688 entry_hook(function, stack_pointer); 4679 entry_hook(function, stack_pointer);
4689 } 4680 }
4690 4681
4691 void ArrayNoArgumentConstructorStub::GenerateAssembly( 4682 void ArrayNoArgumentConstructorStub::GenerateAssembly(
4692 CodeStubAssembler* assembler) const { 4683 CodeStubAssembler* assembler) const {
4693 typedef compiler::Node Node; 4684 typedef compiler::Node Node;
4694 Node* native_context = assembler->LoadObjectField( 4685 Node* native_context = assembler->LoadObjectField(
4695 assembler->Parameter( 4686 assembler->Parameter(Descriptor::kFunction), JSFunction::kContextOffset);
4696 ArrayNoArgumentConstructorDescriptor::kFunctionIndex),
4697 JSFunction::kContextOffset);
4698 bool track_allocation_site = 4687 bool track_allocation_site =
4699 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && 4688 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE &&
4700 override_mode() != DISABLE_ALLOCATION_SITES; 4689 override_mode() != DISABLE_ALLOCATION_SITES;
4701 Node* allocation_site = 4690 Node* allocation_site =
4702 track_allocation_site 4691 track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite)
4703 ? assembler->Parameter( 4692 : nullptr;
4704 ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex)
4705 : nullptr;
4706 Node* array_map = 4693 Node* array_map =
4707 assembler->LoadJSArrayElementsMap(elements_kind(), native_context); 4694 assembler->LoadJSArrayElementsMap(elements_kind(), native_context);
4708 Node* array = assembler->AllocateJSArray( 4695 Node* array = assembler->AllocateJSArray(
4709 elements_kind(), array_map, 4696 elements_kind(), array_map,
4710 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements), 4697 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements),
4711 assembler->IntPtrConstant(0), allocation_site); 4698 assembler->IntPtrConstant(0), allocation_site);
4712 assembler->Return(array); 4699 assembler->Return(array);
4713 } 4700 }
4714 4701
4715 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( 4702 void InternalArrayNoArgumentConstructorStub::GenerateAssembly(
4716 CodeStubAssembler* assembler) const { 4703 CodeStubAssembler* assembler) const {
4717 typedef compiler::Node Node; 4704 typedef compiler::Node Node;
4718 Node* array_map = assembler->LoadObjectField( 4705 Node* array_map =
4719 assembler->Parameter( 4706 assembler->LoadObjectField(assembler->Parameter(Descriptor::kFunction),
4720 ArrayNoArgumentConstructorDescriptor::kFunctionIndex), 4707 JSFunction::kPrototypeOrInitialMapOffset);
4721 JSFunction::kPrototypeOrInitialMapOffset);
4722 Node* array = assembler->AllocateJSArray( 4708 Node* array = assembler->AllocateJSArray(
4723 elements_kind(), array_map, 4709 elements_kind(), array_map,
4724 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements), 4710 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements),
4725 assembler->IntPtrConstant(0), nullptr); 4711 assembler->IntPtrConstant(0), nullptr);
4726 assembler->Return(array); 4712 assembler->Return(array);
4727 } 4713 }
4728 4714
4729 namespace { 4715 namespace {
4730 4716
4717 template <typename Descriptor>
4731 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, 4718 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
4732 ElementsKind elements_kind, 4719 ElementsKind elements_kind,
4733 compiler::Node* array_map, 4720 compiler::Node* array_map,
4734 compiler::Node* allocation_site, 4721 compiler::Node* allocation_site,
4735 AllocationSiteMode mode) { 4722 AllocationSiteMode mode) {
4736 typedef compiler::Node Node; 4723 typedef compiler::Node Node;
4737 typedef CodeStubAssembler::Label Label; 4724 typedef CodeStubAssembler::Label Label;
4738 4725
4739 Label ok(assembler); 4726 Label ok(assembler);
4740 Label smi_size(assembler); 4727 Label smi_size(assembler);
4741 Label small_smi_size(assembler); 4728 Label small_smi_size(assembler);
4742 Label call_runtime(assembler, Label::kDeferred); 4729 Label call_runtime(assembler, Label::kDeferred);
4743 4730
4744 Node* size = assembler->Parameter( 4731 Node* size = assembler->Parameter(Descriptor::kArraySizeSmiParameter);
4745 ArraySingleArgumentConstructorDescriptor::kArraySizeSmiParameterIndex);
4746 assembler->Branch(assembler->WordIsSmi(size), &smi_size, &call_runtime); 4732 assembler->Branch(assembler->WordIsSmi(size), &smi_size, &call_runtime);
4747 4733
4748 assembler->Bind(&smi_size); 4734 assembler->Bind(&smi_size);
4749 4735
4750 if (IsFastPackedElementsKind(elements_kind)) { 4736 if (IsFastPackedElementsKind(elements_kind)) {
4751 Label abort(assembler, Label::kDeferred); 4737 Label abort(assembler, Label::kDeferred);
4752 assembler->Branch( 4738 assembler->Branch(
4753 assembler->SmiEqual(size, assembler->SmiConstant(Smi::FromInt(0))), 4739 assembler->SmiEqual(size, assembler->SmiConstant(Smi::FromInt(0))),
4754 &small_smi_size, &abort); 4740 &small_smi_size, &abort);
4755 4741
4756 assembler->Bind(&abort); 4742 assembler->Bind(&abort);
4757 Node* reason = 4743 Node* reason =
4758 assembler->SmiConstant(Smi::FromInt(kAllocatingNonEmptyPackedArray)); 4744 assembler->SmiConstant(Smi::FromInt(kAllocatingNonEmptyPackedArray));
4759 Node* context = assembler->Parameter( 4745 Node* context = assembler->Parameter(Descriptor::kContext);
4760 ArraySingleArgumentConstructorDescriptor::kContextIndex);
4761 assembler->TailCallRuntime(Runtime::kAbort, context, reason); 4746 assembler->TailCallRuntime(Runtime::kAbort, context, reason);
4762 } else { 4747 } else {
4763 int element_size = 4748 int element_size =
4764 IsFastDoubleElementsKind(elements_kind) ? kDoubleSize : kPointerSize; 4749 IsFastDoubleElementsKind(elements_kind) ? kDoubleSize : kPointerSize;
4765 int max_fast_elements = 4750 int max_fast_elements =
4766 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize - 4751 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize -
4767 JSArray::kSize - AllocationMemento::kSize) / 4752 JSArray::kSize - AllocationMemento::kSize) /
4768 element_size; 4753 element_size;
4769 assembler->Branch( 4754 assembler->Branch(
4770 assembler->SmiAboveOrEqual( 4755 assembler->SmiAboveOrEqual(
4771 size, assembler->SmiConstant(Smi::FromInt(max_fast_elements))), 4756 size, assembler->SmiConstant(Smi::FromInt(max_fast_elements))),
4772 &call_runtime, &small_smi_size); 4757 &call_runtime, &small_smi_size);
4773 } 4758 }
4774 4759
4775 assembler->Bind(&small_smi_size); 4760 assembler->Bind(&small_smi_size);
4776 { 4761 {
4777 Node* array = assembler->AllocateJSArray( 4762 Node* array = assembler->AllocateJSArray(
4778 elements_kind, array_map, size, size, 4763 elements_kind, array_map, size, size,
4779 mode == DONT_TRACK_ALLOCATION_SITE ? nullptr : allocation_site, 4764 mode == DONT_TRACK_ALLOCATION_SITE ? nullptr : allocation_site,
4780 CodeStubAssembler::SMI_PARAMETERS); 4765 CodeStubAssembler::SMI_PARAMETERS);
4781 assembler->Return(array); 4766 assembler->Return(array);
4782 } 4767 }
4783 4768
4784 assembler->Bind(&call_runtime); 4769 assembler->Bind(&call_runtime);
4785 { 4770 {
4786 Node* context = assembler->Parameter( 4771 Node* context = assembler->Parameter(Descriptor::kContext);
4787 ArraySingleArgumentConstructorDescriptor::kContextIndex); 4772 Node* function = assembler->Parameter(Descriptor::kFunction);
4788 Node* function = assembler->Parameter( 4773 Node* array_size = assembler->Parameter(Descriptor::kArraySizeSmiParameter);
4789 ArraySingleArgumentConstructorDescriptor::kFunctionIndex); 4774 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite);
4790 Node* array_size = assembler->Parameter(
4791 ArraySingleArgumentConstructorDescriptor::kArraySizeSmiParameterIndex);
4792 Node* allocation_site = assembler->Parameter(
4793 ArraySingleArgumentConstructorDescriptor::kAllocationSiteIndex);
4794 assembler->TailCallRuntime(Runtime::kNewArray, context, function, 4775 assembler->TailCallRuntime(Runtime::kNewArray, context, function,
4795 array_size, function, allocation_site); 4776 array_size, function, allocation_site);
4796 } 4777 }
4797 } 4778 }
4798 } // namespace 4779 } // namespace
4799 4780
4800 void ArraySingleArgumentConstructorStub::GenerateAssembly( 4781 void ArraySingleArgumentConstructorStub::GenerateAssembly(
4801 CodeStubAssembler* assembler) const { 4782 CodeStubAssembler* assembler) const {
4802 typedef compiler::Node Node; 4783 typedef compiler::Node Node;
4803 Node* function = assembler->Parameter( 4784 Node* function = assembler->Parameter(Descriptor::kFunction);
4804 ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
4805 Node* native_context = 4785 Node* native_context =
4806 assembler->LoadObjectField(function, JSFunction::kContextOffset); 4786 assembler->LoadObjectField(function, JSFunction::kContextOffset);
4807 Node* array_map = 4787 Node* array_map =
4808 assembler->LoadJSArrayElementsMap(elements_kind(), native_context); 4788 assembler->LoadJSArrayElementsMap(elements_kind(), native_context);
4809 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES 4789 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES
4810 ? DONT_TRACK_ALLOCATION_SITE 4790 ? DONT_TRACK_ALLOCATION_SITE
4811 : AllocationSite::GetMode(elements_kind()); 4791 : AllocationSite::GetMode(elements_kind());
4812 Node* allocation_site = assembler->Parameter( 4792 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite);
4813 ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex); 4793 SingleArgumentConstructorCommon<Descriptor>(assembler, elements_kind(),
4814 SingleArgumentConstructorCommon(assembler, elements_kind(), array_map, 4794 array_map, allocation_site, mode);
4815 allocation_site, mode);
4816 } 4795 }
4817 4796
4818 void InternalArraySingleArgumentConstructorStub::GenerateAssembly( 4797 void InternalArraySingleArgumentConstructorStub::GenerateAssembly(
4819 CodeStubAssembler* assembler) const { 4798 CodeStubAssembler* assembler) const {
4820 typedef compiler::Node Node; 4799 typedef compiler::Node Node;
4821 Node* function = assembler->Parameter( 4800 Node* function = assembler->Parameter(Descriptor::kFunction);
4822 ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
4823 Node* array_map = assembler->LoadObjectField( 4801 Node* array_map = assembler->LoadObjectField(
4824 function, JSFunction::kPrototypeOrInitialMapOffset); 4802 function, JSFunction::kPrototypeOrInitialMapOffset);
4825 SingleArgumentConstructorCommon(assembler, elements_kind(), array_map, 4803 SingleArgumentConstructorCommon<Descriptor>(
4826 assembler->UndefinedConstant(), 4804 assembler, elements_kind(), array_map, assembler->UndefinedConstant(),
4827 DONT_TRACK_ALLOCATION_SITE); 4805 DONT_TRACK_ALLOCATION_SITE);
4828 } 4806 }
4829 4807
4830 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 4808 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
4831 : PlatformCodeStub(isolate) { 4809 : PlatformCodeStub(isolate) {
4832 minor_key_ = ArgumentCountBits::encode(ANY); 4810 minor_key_ = ArgumentCountBits::encode(ANY);
4833 } 4811 }
4834 4812
4835 4813
4836 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, 4814 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate,
4837 int argument_count) 4815 int argument_count)
(...skipping 24 matching lines...) Expand all
4862 if (type->Is(Type::UntaggedPointer())) { 4840 if (type->Is(Type::UntaggedPointer())) {
4863 return Representation::External(); 4841 return Representation::External();
4864 } 4842 }
4865 4843
4866 DCHECK(!type->Is(Type::Untagged())); 4844 DCHECK(!type->Is(Type::Untagged()));
4867 return Representation::Tagged(); 4845 return Representation::Tagged();
4868 } 4846 }
4869 4847
4870 } // namespace internal 4848 } // namespace internal
4871 } // namespace v8 4849 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698