[fullcodegen] Avoid arguments juggling when calling a JS runtime function.

Review URL: https://codereview.chromium.org/1811563002

Cr-Commit-Position: refs/heads/master@{#34825}
This commit is contained in:
ishell 2016-03-16 09:02:37 -07:00 committed by Commit bot
parent 80779dc739
commit 65dcd25585
9 changed files with 37 additions and 61 deletions

View File

@ -3355,11 +3355,13 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadNativeContextSlot(expr->context_index(), r0);
PushOperand(r0);
// Push undefined as the receiver.
__ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
PushOperand(r0);
__ LoadNativeContextSlot(expr->context_index(), r0);
}
@ -3384,11 +3386,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
__ ldr(ip, MemOperand(sp, 0));
PushOperand(ip);
__ str(r0, MemOperand(sp, kPointerSize));
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));

View File

@ -3174,11 +3174,13 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadNativeContextSlot(expr->context_index(), x0);
PushOperand(x0);
// Push undefined as the receiver.
__ LoadRoot(x0, Heap::kUndefinedValueRootIndex);
PushOperand(x0);
__ LoadNativeContextSlot(expr->context_index(), x0);
}
@ -3203,10 +3205,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRunTime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
PopOperand(x10);
PushOperands(x0, x10);
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));
}

View File

@ -3243,10 +3243,12 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadGlobalFunction(expr->context_index(), eax);
PushOperand(eax);
// Push undefined as receiver.
PushOperand(isolate()->factory()->undefined_value());
__ LoadGlobalFunction(expr->context_index(), eax);
}
@ -3271,10 +3273,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
PushOperand(Operand(esp, 0));
__ mov(Operand(esp, kPointerSize), eax);
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));

View File

@ -3365,11 +3365,13 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadNativeContextSlot(expr->context_index(), v0);
PushOperand(v0);
// Push undefined as the receiver.
__ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
PushOperand(v0);
__ LoadNativeContextSlot(expr->context_index(), v0);
}
@ -3394,11 +3396,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
__ lw(at, MemOperand(sp, 0));
PushOperand(at);
__ sw(v0, MemOperand(sp, kPointerSize));
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));

View File

@ -3368,11 +3368,13 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadNativeContextSlot(expr->context_index(), v0);
PushOperand(v0);
// Push undefined as the receiver.
__ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
PushOperand(v0);
__ LoadNativeContextSlot(expr->context_index(), v0);
}
@ -3397,11 +3399,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
__ ld(at, MemOperand(sp, 0));
PushOperand(at);
__ sd(v0, MemOperand(sp, kPointerSize));
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));

View File

@ -3350,11 +3350,13 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadNativeContextSlot(expr->context_index(), r3);
PushOperand(r3);
// Push undefined as the receiver.
__ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
PushOperand(r3);
__ LoadNativeContextSlot(expr->context_index(), r3);
}
@ -3379,11 +3381,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
__ LoadP(ip, MemOperand(sp, 0));
PushOperand(ip);
__ StoreP(r3, MemOperand(sp, kPointerSize));
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));

View File

@ -3257,11 +3257,13 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
}
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadNativeContextSlot(expr->context_index(), r2);
PushOperand(r2);
// Push undefined as the receiver.
__ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
PushOperand(r2);
__ LoadNativeContextSlot(expr->context_index(), r2);
}
void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
@ -3284,11 +3286,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
__ LoadP(ip, MemOperand(sp, 0));
PushOperand(ip);
__ StoreP(r2, MemOperand(sp, kPointerSize));
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));

View File

@ -3230,11 +3230,13 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push the builtins object as receiver.
// Push function.
__ LoadNativeContextSlot(expr->context_index(), rax);
PushOperand(rax);
// Push undefined as receiver.
OperandStackDepthIncrement(1);
__ PushRoot(Heap::kUndefinedValueRootIndex);
__ LoadNativeContextSlot(expr->context_index(), rax);
}
@ -3257,13 +3259,8 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
if (expr->is_jsruntime()) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
PushOperand(Operand(rsp, 0));
__ movp(Operand(rsp, kPointerSize), rax);
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));

View File

@ -3235,10 +3235,12 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
// Push function.
__ LoadGlobalFunction(expr->context_index(), eax);
PushOperand(eax);
// Push undefined as receiver.
PushOperand(isolate()->factory()->undefined_value());
__ LoadGlobalFunction(expr->context_index(), eax);
}
@ -3263,10 +3265,6 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
Comment cmnt(masm_, "[ CallRuntime");
EmitLoadJSRuntimeFunction(expr);
// Push the target function under the receiver.
PushOperand(Operand(esp, 0));
__ mov(Operand(esp, kPointerSize), eax);
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
VisitForStackValue(args->at(i));