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

Unified Diff: src/mips/code-stubs-mips.cc

Issue 2405203002: [stubs] Simplify the ArrayConstructorStub. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index c42728a1dd86ab31228866dd7957aadcdadf15c9..52734fc76c174c851874d7835b3b7538926bca7e 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -1924,14 +1924,13 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at);
__ Branch(miss, ne, a1, Operand(at));
- __ li(a0, Operand(arg_count()));
-
// Increment the call count for monomorphic function calls.
IncrementCallCount(masm, a2, a3);
__ mov(a2, t0);
__ mov(a3, a1);
- ArrayConstructorStub stub(masm->isolate(), arg_count());
+ __ li(a0, Operand(arg_count()));
+ ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
@@ -3898,29 +3897,18 @@ void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
void ArrayConstructorStub::GenerateDispatchToArrayStub(
MacroAssembler* masm,
AllocationSiteOverrideMode mode) {
- if (argument_count() == ANY) {
- Label not_zero_case, not_one_case;
- __ And(at, a0, a0);
- __ Branch(&not_zero_case, ne, at, Operand(zero_reg));
- CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
-
- __ bind(&not_zero_case);
- __ Branch(&not_one_case, gt, a0, Operand(1));
- CreateArrayDispatchOneArgument(masm, mode);
-
- __ bind(&not_one_case);
- ArrayNArgumentsConstructorStub stub(masm->isolate());
- __ TailCallStub(&stub);
- } else if (argument_count() == NONE) {
- CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
- } else if (argument_count() == ONE) {
- CreateArrayDispatchOneArgument(masm, mode);
- } else if (argument_count() == MORE_THAN_ONE) {
- ArrayNArgumentsConstructorStub stub(masm->isolate());
- __ TailCallStub(&stub);
- } else {
- UNREACHABLE();
- }
+ Label not_zero_case, not_one_case;
+ __ And(at, a0, a0);
+ __ Branch(&not_zero_case, ne, at, Operand(zero_reg));
+ CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
+
+ __ bind(&not_zero_case);
+ __ Branch(&not_one_case, gt, a0, Operand(1));
+ CreateArrayDispatchOneArgument(masm, mode);
+
+ __ bind(&not_one_case);
+ ArrayNArgumentsConstructorStub stub(masm->isolate());
+ __ TailCallStub(&stub);
}
@@ -3973,23 +3961,10 @@ void ArrayConstructorStub::Generate(MacroAssembler* masm) {
// Subclassing.
__ bind(&subclassing);
- switch (argument_count()) {
- case ANY:
- case MORE_THAN_ONE:
- __ Lsa(at, sp, a0, kPointerSizeLog2);
- __ sw(a1, MemOperand(at));
- __ li(at, Operand(3));
- __ addu(a0, a0, at);
- break;
- case NONE:
- __ sw(a1, MemOperand(sp, 0 * kPointerSize));
- __ li(a0, Operand(3));
- break;
- case ONE:
- __ sw(a1, MemOperand(sp, 1 * kPointerSize));
- __ li(a0, Operand(4));
- break;
- }
+ __ Lsa(at, sp, a0, kPointerSizeLog2);
+ __ sw(a1, MemOperand(at));
+ __ li(at, Operand(3));
+ __ addu(a0, a0, at);
__ Push(a3, a2);
__ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate()));
}
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698