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
This commit is contained in:
parent
161cc3cd2a
commit
166799c2c4
@ -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);
|
||||
|
@ -1673,7 +1673,7 @@ Handle<Code> CallStubCompiler::CompileArrayCodeCall(
|
||||
}
|
||||
|
||||
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);
|
||||
__ li(a0, Operand(argc));
|
||||
__ li(a2, Operand(site_feedback_cell));
|
||||
|
Loading…
Reference in New Issue
Block a user