MIPS port for implement spread calls
R=svenpanne@chromium.org NOTRY=true BUG= Review URL: https://codereview.chromium.org/1073983004 Cr-Commit-Position: refs/heads/master@{#27732}
This commit is contained in:
parent
4eff883bce
commit
69c434e3dd
@ -3089,6 +3089,22 @@ void FullCodeGenerator::EmitLoadSuperConstructor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FullCodeGenerator::EmitInitializeThisAfterSuper(
|
||||||
|
SuperReference* super_ref) {
|
||||||
|
Variable* this_var = super_ref->this_var()->var();
|
||||||
|
GetVar(a1, this_var);
|
||||||
|
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
|
||||||
|
Label uninitialized_this;
|
||||||
|
__ Branch(&uninitialized_this, eq, a1, Operand(at));
|
||||||
|
__ li(a0, Operand(this_var->name()));
|
||||||
|
__ Push(a0);
|
||||||
|
__ CallRuntime(Runtime::kThrowReferenceError, 1);
|
||||||
|
__ bind(&uninitialized_this);
|
||||||
|
|
||||||
|
EmitVariableAssignment(this_var, Token::INIT_CONST);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::VisitCall(Call* expr) {
|
void FullCodeGenerator::VisitCall(Call* expr) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// We want to verify that RecordJSReturnSite gets called on all paths
|
// We want to verify that RecordJSReturnSite gets called on all paths
|
||||||
@ -3310,18 +3326,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
|
|||||||
|
|
||||||
RecordJSReturnSite(expr);
|
RecordJSReturnSite(expr);
|
||||||
|
|
||||||
SuperReference* super_ref = expr->expression()->AsSuperReference();
|
EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference());
|
||||||
Variable* this_var = super_ref->this_var()->var();
|
|
||||||
GetVar(a1, this_var);
|
|
||||||
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
|
|
||||||
Label uninitialized_this;
|
|
||||||
__ Branch(&uninitialized_this, eq, a1, Operand(at));
|
|
||||||
__ li(a0, Operand(this_var->name()));
|
|
||||||
__ Push(a0);
|
|
||||||
__ CallRuntime(Runtime::kThrowReferenceError, 1);
|
|
||||||
__ bind(&uninitialized_this);
|
|
||||||
|
|
||||||
EmitVariableAssignment(this_var, Token::INIT_CONST);
|
|
||||||
context()->Plug(v0);
|
context()->Plug(v0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4611,12 +4616,44 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
// Assert: expr == CallRuntime("ReflectConstruct")
|
||||||
int arg_count = args->length();
|
CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime();
|
||||||
|
ZoneList<Expression*>* args = call->arguments();
|
||||||
|
DCHECK_EQ(3, args->length());
|
||||||
|
|
||||||
if (expr->is_jsruntime()) {
|
SuperReference* super_reference = args->at(0)->AsSuperReference();
|
||||||
Comment cmnt(masm_, "[ CallRuntime");
|
|
||||||
|
// Load ReflectConstruct function
|
||||||
|
EmitLoadJSRuntimeFunction(call);
|
||||||
|
|
||||||
|
// Push the target function under the receiver
|
||||||
|
__ lw(at, MemOperand(sp, 0));
|
||||||
|
__ push(at);
|
||||||
|
__ sw(v0, MemOperand(sp, kPointerSize));
|
||||||
|
|
||||||
|
// Push super
|
||||||
|
EmitLoadSuperConstructor();
|
||||||
|
__ Push(result_register());
|
||||||
|
|
||||||
|
// Push arguments array
|
||||||
|
VisitForStackValue(args->at(1));
|
||||||
|
|
||||||
|
// Push NewTarget
|
||||||
|
DCHECK(args->at(2)->IsVariableProxy());
|
||||||
|
VisitForStackValue(args->at(2));
|
||||||
|
|
||||||
|
EmitCallJSRuntimeFunction(call);
|
||||||
|
|
||||||
|
// Restore context register.
|
||||||
|
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||||
|
context()->DropAndPlug(1, v0);
|
||||||
|
|
||||||
|
EmitInitializeThisAfterSuper(super_reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
|
||||||
// Push the builtins object as the receiver.
|
// Push the builtins object as the receiver.
|
||||||
Register receiver = LoadDescriptor::ReceiverRegister();
|
Register receiver = LoadDescriptor::ReceiverRegister();
|
||||||
__ lw(receiver, GlobalObjectOperand());
|
__ lw(receiver, GlobalObjectOperand());
|
||||||
@ -4632,6 +4669,28 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
|||||||
} else {
|
} else {
|
||||||
CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
|
CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
|
||||||
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
|
int arg_count = args->length();
|
||||||
|
|
||||||
|
// Record source position of the IC call.
|
||||||
|
SetSourcePosition(expr->position());
|
||||||
|
CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
|
||||||
|
__ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
||||||
|
__ CallStub(&stub);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
||||||
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
|
int arg_count = args->length();
|
||||||
|
|
||||||
|
if (expr->is_jsruntime()) {
|
||||||
|
Comment cmnt(masm_, "[ CallRuntime");
|
||||||
|
EmitLoadJSRuntimeFunction(expr);
|
||||||
|
|
||||||
// Push the target function under the receiver.
|
// Push the target function under the receiver.
|
||||||
__ lw(at, MemOperand(sp, 0));
|
__ lw(at, MemOperand(sp, 0));
|
||||||
@ -4643,11 +4702,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
|||||||
VisitForStackValue(args->at(i));
|
VisitForStackValue(args->at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record source position of the IC call.
|
EmitCallJSRuntimeFunction(expr);
|
||||||
SetSourcePosition(expr->position());
|
|
||||||
CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
|
|
||||||
__ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
|
||||||
__ CallStub(&stub);
|
|
||||||
|
|
||||||
// Restore context register.
|
// Restore context register.
|
||||||
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
||||||
|
Loading…
Reference in New Issue
Block a user