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

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

Issue 2024253002: [stubs] Remove N-argument Hydrogen-based Array constructor stub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 Created 4 years, 6 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
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 4483 matching lines...) Expand 10 before | Expand all | Expand 10 after
4494 os << "_One"; 4494 os << "_One";
4495 break; 4495 break;
4496 case MORE_THAN_ONE: 4496 case MORE_THAN_ONE:
4497 os << "_More_Than_One"; 4497 os << "_More_Than_One";
4498 break; 4498 break;
4499 } 4499 }
4500 return; 4500 return;
4501 } 4501 }
4502 4502
4503 4503
4504 std::ostream& ArrayConstructorStubBase::BasePrintName(
4505 std::ostream& os, // NOLINT
4506 const char* name) const {
4507 os << name << "_" << ElementsKindToString(elements_kind());
4508 if (override_mode() == DISABLE_ALLOCATION_SITES) {
4509 os << "_DISABLE_ALLOCATION_SITES";
4510 }
4511 return os;
4512 }
4513
4514 bool ToBooleanICStub::UpdateStatus(Handle<Object> object) { 4504 bool ToBooleanICStub::UpdateStatus(Handle<Object> object) {
4515 Types new_types = types(); 4505 Types new_types = types();
4516 Types old_types = new_types; 4506 Types old_types = new_types;
4517 bool to_boolean_value = new_types.UpdateStatus(isolate(), object); 4507 bool to_boolean_value = new_types.UpdateStatus(isolate(), object);
4518 TraceTransition(old_types, new_types); 4508 TraceTransition(old_types, new_types);
4519 set_sub_minor_key(TypesBits::update(sub_minor_key(), new_types.ToIntegral())); 4509 set_sub_minor_key(TypesBits::update(sub_minor_key(), new_types.ToIntegral()));
4520 return to_boolean_value; 4510 return to_boolean_value;
4521 } 4511 }
4522 4512
4523 void ToBooleanICStub::PrintState(std::ostream& os) const { // NOLINT 4513 void ToBooleanICStub::PrintState(std::ostream& os) const { // NOLINT
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
4641 assembler->IntPtrConstant(0), nullptr); 4631 assembler->IntPtrConstant(0), nullptr);
4642 assembler->Return(array); 4632 assembler->Return(array);
4643 } 4633 }
4644 4634
4645 namespace { 4635 namespace {
4646 4636
4647 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, 4637 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
4648 ElementsKind elements_kind, 4638 ElementsKind elements_kind,
4649 compiler::Node* array_map, 4639 compiler::Node* array_map,
4650 compiler::Node* allocation_site, 4640 compiler::Node* allocation_site,
4651 Runtime::FunctionId runtime_fallback,
4652 AllocationSiteMode mode) { 4641 AllocationSiteMode mode) {
4653 typedef compiler::Node Node; 4642 typedef compiler::Node Node;
4654 typedef CodeStubAssembler::Label Label; 4643 typedef CodeStubAssembler::Label Label;
4655 4644
4656 Label ok(assembler); 4645 Label ok(assembler);
4657 Label smi_size(assembler); 4646 Label smi_size(assembler);
4658 Label small_smi_size(assembler); 4647 Label small_smi_size(assembler);
4659 Label call_runtime(assembler, Label::kDeferred); 4648 Label call_runtime(assembler, Label::kDeferred);
4660 4649
4661 Node* size = assembler->Parameter( 4650 Node* size = assembler->Parameter(
(...skipping 18 matching lines...) Expand all
4680 elements_kind, array_map, size, size, 4669 elements_kind, array_map, size, size,
4681 mode == DONT_TRACK_ALLOCATION_SITE ? nullptr : allocation_site, 4670 mode == DONT_TRACK_ALLOCATION_SITE ? nullptr : allocation_site,
4682 CodeStubAssembler::SMI_PARAMETERS); 4671 CodeStubAssembler::SMI_PARAMETERS);
4683 assembler->Return(array); 4672 assembler->Return(array);
4684 } 4673 }
4685 4674
4686 assembler->Bind(&call_runtime); 4675 assembler->Bind(&call_runtime);
4687 { 4676 {
4688 Node* context = assembler->Parameter( 4677 Node* context = assembler->Parameter(
4689 ArraySingleArgumentConstructorDescriptor::kContextIndex); 4678 ArraySingleArgumentConstructorDescriptor::kContextIndex);
4690 Node* constructor = assembler->Parameter( 4679 Node* function = assembler->Parameter(
4691 ArraySingleArgumentConstructorDescriptor::kFunctionIndex); 4680 ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
4692 Node* argument_count = assembler->Parameter( 4681 Node* array_size = assembler->Parameter(
4693 ArraySingleArgumentConstructorDescriptor::kArgumentsCountIndex); 4682 ArraySingleArgumentConstructorDescriptor::kArraySizeSmiParameterIndex);
4694 Node* argument_base_offset = assembler->IntPtrAdd( 4683 Node* allocation_site = assembler->Parameter(
4695 assembler->IntPtrConstant(CommonFrameConstants::kFixedFrameSizeAboveFp - 4684 ArraySingleArgumentConstructorDescriptor::kAllocationSiteIndex);
4696 kPointerSize), 4685 assembler->TailCallRuntime(Runtime::kNewArray, context, function,
4697 assembler->Word32Shl(argument_count, 4686 array_size, function, allocation_site);
4698 assembler->IntPtrConstant(kPointerSizeLog2)));
4699 Node* argument_base = assembler->IntPtrAdd(assembler->LoadFramePointer(),
4700 argument_base_offset);
4701 Node* array = assembler->CallRuntime(
4702 runtime_fallback, context, constructor, argument_base,
4703 assembler->SmiTag(argument_count), allocation_site);
4704 assembler->Return(array);
4705 } 4687 }
4706 } 4688 }
4707 } // namespace 4689 } // namespace
4708 4690
4709 void ArraySingleArgumentConstructorStub::GenerateAssembly( 4691 void ArraySingleArgumentConstructorStub::GenerateAssembly(
4710 CodeStubAssembler* assembler) const { 4692 CodeStubAssembler* assembler) const {
4711 typedef compiler::Node Node; 4693 typedef compiler::Node Node;
4712 Node* function = assembler->Parameter( 4694 Node* function = assembler->Parameter(
4713 ArraySingleArgumentConstructorDescriptor::kFunctionIndex); 4695 ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
4714 Node* native_context = 4696 Node* native_context =
4715 assembler->LoadObjectField(function, JSFunction::kContextOffset); 4697 assembler->LoadObjectField(function, JSFunction::kContextOffset);
4716 Node* array_map = 4698 Node* array_map =
4717 assembler->LoadJSArrayElementsMap(elements_kind(), native_context); 4699 assembler->LoadJSArrayElementsMap(elements_kind(), native_context);
4718 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES 4700 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES
4719 ? DONT_TRACK_ALLOCATION_SITE 4701 ? DONT_TRACK_ALLOCATION_SITE
4720 : AllocationSite::GetMode(elements_kind()); 4702 : AllocationSite::GetMode(elements_kind());
4721 Node* allocation_site = assembler->Parameter( 4703 Node* allocation_site = assembler->Parameter(
4722 ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex); 4704 ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex);
4723 SingleArgumentConstructorCommon( 4705 SingleArgumentConstructorCommon(assembler, elements_kind(), array_map,
4724 assembler, elements_kind(), array_map, allocation_site, 4706 allocation_site, mode);
4725 Runtime::kArraySingleArgumentConstructor, mode);
4726 } 4707 }
4727 4708
4728 void InternalArraySingleArgumentConstructorStub::GenerateAssembly( 4709 void InternalArraySingleArgumentConstructorStub::GenerateAssembly(
4729 CodeStubAssembler* assembler) const { 4710 CodeStubAssembler* assembler) const {
4730 typedef compiler::Node Node; 4711 typedef compiler::Node Node;
4731 Node* function = assembler->Parameter( 4712 Node* function = assembler->Parameter(
4732 ArraySingleArgumentConstructorDescriptor::kFunctionIndex); 4713 ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
4733 Node* array_map = assembler->LoadObjectField( 4714 Node* array_map = assembler->LoadObjectField(
4734 function, JSFunction::kPrototypeOrInitialMapOffset); 4715 function, JSFunction::kPrototypeOrInitialMapOffset);
4735 SingleArgumentConstructorCommon( 4716 SingleArgumentConstructorCommon(assembler, elements_kind(), array_map,
4736 assembler, elements_kind(), array_map, assembler->UndefinedConstant(), 4717 assembler->UndefinedConstant(),
4737 Runtime::kArraySingleArgumentConstructor, DONT_TRACK_ALLOCATION_SITE); 4718 DONT_TRACK_ALLOCATION_SITE);
4738 } 4719 }
4739 4720
4740 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 4721 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
4741 : PlatformCodeStub(isolate) { 4722 : PlatformCodeStub(isolate) {
4742 minor_key_ = ArgumentCountBits::encode(ANY); 4723 minor_key_ = ArgumentCountBits::encode(ANY);
4743 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
4744 } 4724 }
4745 4725
4746 4726
4747 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, 4727 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate,
4748 int argument_count) 4728 int argument_count)
4749 : PlatformCodeStub(isolate) { 4729 : PlatformCodeStub(isolate) {
4750 if (argument_count == 0) { 4730 if (argument_count == 0) {
4751 minor_key_ = ArgumentCountBits::encode(NONE); 4731 minor_key_ = ArgumentCountBits::encode(NONE);
4752 } else if (argument_count == 1) { 4732 } else if (argument_count == 1) {
4753 minor_key_ = ArgumentCountBits::encode(ONE); 4733 minor_key_ = ArgumentCountBits::encode(ONE);
4754 } else if (argument_count >= 2) { 4734 } else if (argument_count >= 2) {
4755 minor_key_ = ArgumentCountBits::encode(MORE_THAN_ONE); 4735 minor_key_ = ArgumentCountBits::encode(MORE_THAN_ONE);
4756 } else { 4736 } else {
4757 UNREACHABLE(); 4737 UNREACHABLE();
4758 } 4738 }
4759 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
4760 } 4739 }
4761 4740
4762 4741 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
4763 InternalArrayConstructorStub::InternalArrayConstructorStub( 4742 : PlatformCodeStub(isolate) {}
4764 Isolate* isolate) : PlatformCodeStub(isolate) {
4765 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
4766 }
4767
4768 4743
4769 Representation RepresentationFromType(Type* type) { 4744 Representation RepresentationFromType(Type* type) {
4770 if (type->Is(Type::UntaggedIntegral())) { 4745 if (type->Is(Type::UntaggedIntegral())) {
4771 return Representation::Integer32(); 4746 return Representation::Integer32();
4772 } 4747 }
4773 4748
4774 if (type->Is(Type::TaggedSigned())) { 4749 if (type->Is(Type::TaggedSigned())) {
4775 return Representation::Smi(); 4750 return Representation::Smi();
4776 } 4751 }
4777 4752
4778 if (type->Is(Type::UntaggedPointer())) { 4753 if (type->Is(Type::UntaggedPointer())) {
4779 return Representation::External(); 4754 return Representation::External();
4780 } 4755 }
4781 4756
4782 DCHECK(!type->Is(Type::Untagged())); 4757 DCHECK(!type->Is(Type::Untagged()));
4783 return Representation::Tagged(); 4758 return Representation::Tagged();
4784 } 4759 }
4785 4760
4786 } // namespace internal 4761 } // namespace internal
4787 } // namespace v8 4762 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | src/mips/code-stubs-mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698