Function apply(): make all architectures use an IC for performance.
BUG= R=yangguo@chromium.org Review URL: https://codereview.chromium.org/1116943002 Cr-Commit-Position: refs/heads/master@{#28264}
This commit is contained in:
parent
06a792b7cc
commit
9f55ccb828
@ -1390,33 +1390,36 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
|
||||
const int indexOffset,
|
||||
const int limitOffset) {
|
||||
Label entry, loop;
|
||||
__ ldr(r0, MemOperand(fp, indexOffset));
|
||||
Register receiver = LoadDescriptor::ReceiverRegister();
|
||||
Register key = LoadDescriptor::NameRegister();
|
||||
|
||||
__ ldr(key, MemOperand(fp, indexOffset));
|
||||
__ b(&entry);
|
||||
|
||||
// Load the current argument from the arguments array and push it to the
|
||||
// stack.
|
||||
// r0: current argument index
|
||||
// Load the current argument from the arguments array.
|
||||
__ bind(&loop);
|
||||
__ ldr(r1, MemOperand(fp, argumentsOffset));
|
||||
__ Push(r1, r0);
|
||||
__ ldr(receiver, MemOperand(fp, argumentsOffset));
|
||||
|
||||
// Call the runtime to access the property in the arguments array.
|
||||
__ CallRuntime(Runtime::kGetProperty, 2);
|
||||
// Use inline caching to speed up access to arguments.
|
||||
Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic();
|
||||
__ Call(ic, RelocInfo::CODE_TARGET);
|
||||
|
||||
// Push the nth argument.
|
||||
__ push(r0);
|
||||
|
||||
// Use inline caching to access the arguments.
|
||||
__ ldr(r0, MemOperand(fp, indexOffset));
|
||||
__ add(r0, r0, Operand(1 << kSmiTagSize));
|
||||
__ str(r0, MemOperand(fp, indexOffset));
|
||||
__ ldr(key, MemOperand(fp, indexOffset));
|
||||
__ add(key, key, Operand(1 << kSmiTagSize));
|
||||
__ str(key, MemOperand(fp, indexOffset));
|
||||
|
||||
// Test if the copy loop has finished copying all the elements from the
|
||||
// arguments object.
|
||||
__ bind(&entry);
|
||||
__ ldr(r1, MemOperand(fp, limitOffset));
|
||||
__ cmp(r0, r1);
|
||||
__ cmp(key, r1);
|
||||
__ b(ne, &loop);
|
||||
|
||||
// On exit, the pushed arguments count is in r0, untagged
|
||||
__ mov(r0, key);
|
||||
__ SmiUntag(r0);
|
||||
}
|
||||
|
||||
|
@ -1386,35 +1386,37 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
|
||||
const int indexOffset,
|
||||
const int limitOffset) {
|
||||
Label entry, loop;
|
||||
Register current = x0;
|
||||
__ Ldr(current, MemOperand(fp, indexOffset));
|
||||
Register receiver = LoadDescriptor::ReceiverRegister();
|
||||
Register key = LoadDescriptor::NameRegister();
|
||||
|
||||
__ Ldr(key, MemOperand(fp, indexOffset));
|
||||
__ B(&entry);
|
||||
|
||||
// Load the current argument from the arguments array.
|
||||
__ Bind(&loop);
|
||||
// Load the current argument from the arguments array and push it.
|
||||
// TODO(all): Couldn't we optimize this for JS arrays?
|
||||
__ Ldr(receiver, MemOperand(fp, argumentsOffset));
|
||||
|
||||
__ Ldr(x1, MemOperand(fp, argumentsOffset));
|
||||
__ Push(x1, current);
|
||||
// Use inline caching to speed up access to arguments.
|
||||
Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic();
|
||||
__ Call(ic, RelocInfo::CODE_TARGET);
|
||||
|
||||
// Call the runtime to access the property in the arguments array.
|
||||
__ CallRuntime(Runtime::kGetProperty, 2);
|
||||
// Push the nth argument.
|
||||
__ Push(x0);
|
||||
|
||||
// Use inline caching to access the arguments.
|
||||
__ Ldr(current, MemOperand(fp, indexOffset));
|
||||
__ Add(current, current, Smi::FromInt(1));
|
||||
__ Str(current, MemOperand(fp, indexOffset));
|
||||
__ Ldr(key, MemOperand(fp, indexOffset));
|
||||
__ Add(key, key, Smi::FromInt(1));
|
||||
__ Str(key, MemOperand(fp, indexOffset));
|
||||
|
||||
// Test if the copy loop has finished copying all the elements from the
|
||||
// arguments object.
|
||||
__ Bind(&entry);
|
||||
__ Ldr(x1, MemOperand(fp, limitOffset));
|
||||
__ Cmp(current, x1);
|
||||
__ Cmp(key, x1);
|
||||
__ B(ne, &loop);
|
||||
|
||||
// On exit, the pushed arguments count is in x0, untagged
|
||||
__ SmiUntag(current);
|
||||
__ Mov(x0, key);
|
||||
__ SmiUntag(x0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1404,32 +1404,35 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
|
||||
const int indexOffset,
|
||||
const int limitOffset) {
|
||||
Label entry, loop;
|
||||
__ lw(a0, MemOperand(fp, indexOffset));
|
||||
Register receiver = LoadDescriptor::ReceiverRegister();
|
||||
Register key = LoadDescriptor::NameRegister();
|
||||
|
||||
__ lw(key, MemOperand(fp, indexOffset));
|
||||
__ Branch(&entry);
|
||||
|
||||
// Load the current argument from the arguments array and push it to the
|
||||
// stack.
|
||||
// a0: current argument index
|
||||
// Load the current argument from the arguments array.
|
||||
__ bind(&loop);
|
||||
__ lw(a1, MemOperand(fp, argumentsOffset));
|
||||
__ Push(a1, a0);
|
||||
__ lw(receiver, MemOperand(fp, argumentsOffset));
|
||||
|
||||
// Use inline caching to speed up access to arguments.
|
||||
Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic();
|
||||
__ Call(ic, RelocInfo::CODE_TARGET);
|
||||
|
||||
// Call the runtime to access the property in the arguments array.
|
||||
__ CallRuntime(Runtime::kGetProperty, 2);
|
||||
__ push(v0);
|
||||
|
||||
// Use inline caching to access the arguments.
|
||||
__ lw(a0, MemOperand(fp, indexOffset));
|
||||
__ Addu(a0, a0, Operand(1 << kSmiTagSize));
|
||||
__ sw(a0, MemOperand(fp, indexOffset));
|
||||
__ lw(key, MemOperand(fp, indexOffset));
|
||||
__ Addu(key, key, Operand(1 << kSmiTagSize));
|
||||
__ sw(key, MemOperand(fp, indexOffset));
|
||||
|
||||
// Test if the copy loop has finished copying all the elements from the
|
||||
// arguments object.
|
||||
__ bind(&entry);
|
||||
__ lw(a1, MemOperand(fp, limitOffset));
|
||||
__ Branch(&loop, ne, a0, Operand(a1));
|
||||
__ Branch(&loop, ne, key, Operand(a1));
|
||||
|
||||
// On exit, the pushed arguments count is in a0, untagged
|
||||
__ mov(a0, key);
|
||||
__ SmiUntag(a0);
|
||||
}
|
||||
|
||||
|
@ -1411,32 +1411,35 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
|
||||
const int indexOffset,
|
||||
const int limitOffset) {
|
||||
Label entry, loop;
|
||||
__ ld(a0, MemOperand(fp, indexOffset));
|
||||
Register receiver = LoadDescriptor::ReceiverRegister();
|
||||
Register key = LoadDescriptor::NameRegister();
|
||||
|
||||
__ ld(key, MemOperand(fp, indexOffset));
|
||||
__ Branch(&entry);
|
||||
|
||||
// Load the current argument from the arguments array and push it to the
|
||||
// stack.
|
||||
// a0: current argument index
|
||||
// Load the current argument from the arguments array.
|
||||
__ bind(&loop);
|
||||
__ ld(a1, MemOperand(fp, argumentsOffset));
|
||||
__ Push(a1, a0);
|
||||
__ ld(receiver, MemOperand(fp, argumentsOffset));
|
||||
|
||||
// Use inline caching to speed up access to arguments.
|
||||
Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic();
|
||||
__ Call(ic, RelocInfo::CODE_TARGET);
|
||||
|
||||
// Call the runtime to access the property in the arguments array.
|
||||
__ CallRuntime(Runtime::kGetProperty, 2);
|
||||
__ push(v0);
|
||||
|
||||
// Use inline caching to access the arguments.
|
||||
__ ld(a0, MemOperand(fp, indexOffset));
|
||||
__ Daddu(a0, a0, Operand(Smi::FromInt(1)));
|
||||
__ sd(a0, MemOperand(fp, indexOffset));
|
||||
__ ld(key, MemOperand(fp, indexOffset));
|
||||
__ Daddu(key, key, Operand(Smi::FromInt(1)));
|
||||
__ sd(key, MemOperand(fp, indexOffset));
|
||||
|
||||
// Test if the copy loop has finished copying all the elements from the
|
||||
// arguments object.
|
||||
__ bind(&entry);
|
||||
__ ld(a1, MemOperand(fp, limitOffset));
|
||||
__ Branch(&loop, ne, a0, Operand(a1));
|
||||
__ Branch(&loop, ne, key, Operand(a1));
|
||||
|
||||
// On exit, the pushed arguments count is in a0, untagged
|
||||
__ mov(a0, key);
|
||||
__ SmiUntag(a0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user