Commit 166799c2 authored by plind44@gmail.com's avatar plind44@gmail.com

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 <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17759 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 161cc3cd
...@@ -6005,11 +6005,14 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm, ...@@ -6005,11 +6005,14 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
__ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset));
} }
// Save the resulting elements kind in type info // Save the resulting elements kind in type info. We can't just store a3
__ SmiTag(a3); // in the AllocationSite::transition_info field because elements kind is
__ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); // restricted to a portion of the field...upper bits need to be left alone.
__ sw(a3, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
__ SmiUntag(a3); __ lw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset));
__ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley)));
__ sw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset));
__ bind(&normal_sequence); __ bind(&normal_sequence);
int last_index = GetSequenceIndexFromFastElementsKind( int last_index = GetSequenceIndexFromFastElementsKind(
...@@ -6151,6 +6154,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) { ...@@ -6151,6 +6154,8 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
__ lw(a3, FieldMemOperand(a3, AllocationSite::kTransitionInfoOffset)); __ lw(a3, FieldMemOperand(a3, AllocationSite::kTransitionInfoOffset));
__ SmiUntag(a3); __ SmiUntag(a3);
STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
__ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask));
GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
__ bind(&no_info); __ bind(&no_info);
......
...@@ -1673,7 +1673,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall( ...@@ -1673,7 +1673,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
} }
Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite(); Handle<AllocationSite> site = isolate()->factory()->NewAllocationSite();
site->set_transition_info(Smi::FromInt(GetInitialFastElementsKind())); site->SetElementsKind(GetInitialFastElementsKind());
Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site); Handle<Cell> site_feedback_cell = isolate()->factory()->NewCell(site);
__ li(a0, Operand(argc)); __ li(a0, Operand(argc));
__ li(a2, Operand(site_feedback_cell)); __ li(a2, Operand(site_feedback_cell));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment