From 166799c2c4f92882f570fad4ee4bf6a042383f39 Mon Sep 17 00:00:00 2001 From: "plind44@gmail.com" Date: Thu, 14 Nov 2013 18:44:05 +0000 Subject: [PATCH] MIPS: Inline zero argument array constructor. Port r17741 (fe14ef8) Original commit message: patch from issue 54583003 (dependent code). Zero arguments - very easy 1 argument - three special cases: a) If length is a constant in valid array length range, no need to check it at runtime. b) respect DoNotInline feedback on the AllocationSite for cases that the argument is not a smi or is an integer with a length that should create a dictionary. c) if kind feedback is non-holey, and length is non-constant, we'd have to generate a lot of code to be correct. Don't inline this case. N arguments - one special case: a) If a deopt ever occurs because an input argument isn't compatible with the elements kind, then set the DoNotInline flag. BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/72893003 Patch from Balazs Kilvady . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17759 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/code-stubs-mips.cc | 15 ++++++++++----- src/mips/stub-cache-mips.cc | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 1982c64..77b5dee 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -6005,11 +6005,14 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm, __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); } - // Save the resulting elements kind in type info - __ SmiTag(a3); - __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); - __ sw(a3, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); - __ SmiUntag(a3); + // Save the resulting elements kind in type info. We can't just store a3 + // in the AllocationSite::transition_info field because elements kind is + // restricted to a portion of the field...upper bits need to be left alone. + STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); + __ lw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); + __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); + __ sw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); + __ bind(&normal_sequence); int last_index = GetSequenceIndexFromFastElementsKind( @@ -6151,6 +6154,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { __ lw(a3, FieldMemOperand(a3, AllocationSite::kTransitionInfoOffset)); __ SmiUntag(a3); + STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); + __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); __ bind(&no_info); diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc index 27be2d4..5236d87 100644 --- a/src/mips/stub-cache-mips.cc +++ b/src/mips/stub-cache-mips.cc @@ -1673,7 +1673,7 @@ Handle CallStubCompiler::CompileArrayCodeCall( } Handle site = isolate()->factory()->NewAllocationSite(); - site->set_transition_info(Smi::FromInt(GetInitialFastElementsKind())); + site->SetElementsKind(GetInitialFastElementsKind()); Handle site_feedback_cell = isolate()->factory()->NewCell(site); __ li(a0, Operand(argc)); __ li(a2, Operand(site_feedback_cell)); -- 2.7.4