| Index: src/ppc/full-codegen-ppc.cc
|
| diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc
|
| index a12f17eba397401495bfe3e2b3106250c96dd51c..47ec127a939f04cf3fb5e64159d6fe6fada863ae 100644
|
| --- a/src/ppc/full-codegen-ppc.cc
|
| +++ b/src/ppc/full-codegen-ppc.cc
|
| @@ -3095,6 +3095,22 @@ void FullCodeGenerator::EmitLoadSuperConstructor() {
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitInitializeThisAfterSuper(
|
| + SuperReference* super_ref) {
|
| + Variable* this_var = super_ref->this_var()->var();
|
| + GetVar(r4, this_var);
|
| + __ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
|
| + Label uninitialized_this;
|
| + __ beq(&uninitialized_this);
|
| + __ mov(r4, Operand(this_var->name()));
|
| + __ push(r4);
|
| + __ CallRuntime(Runtime::kThrowReferenceError, 1);
|
| + __ bind(&uninitialized_this);
|
| +
|
| + EmitVariableAssignment(this_var, Token::INIT_CONST);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::VisitCall(Call* expr) {
|
| #ifdef DEBUG
|
| // We want to verify that RecordJSReturnSite gets called on all paths
|
| @@ -3321,18 +3337,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
|
|
|
| RecordJSReturnSite(expr);
|
|
|
| - SuperReference* super_ref = expr->expression()->AsSuperReference();
|
| - Variable* this_var = super_ref->this_var()->var();
|
| - GetVar(r4, this_var);
|
| - __ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
|
| - Label uninitialized_this;
|
| - __ beq(&uninitialized_this);
|
| - __ mov(r4, Operand(this_var->name()));
|
| - __ push(r4);
|
| - __ CallRuntime(Runtime::kThrowReferenceError, 1);
|
| - __ bind(&uninitialized_this);
|
| -
|
| - EmitVariableAssignment(this_var, Token::INIT_CONST);
|
| + EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference());
|
| context()->Plug(r3);
|
| }
|
|
|
| @@ -4618,28 +4623,81 @@ void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) {
|
| + // Assert: expr === CallRuntime("ReflectConstruct")
|
| + CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime();
|
| + ZoneList<Expression*>* args = call->arguments();
|
| + DCHECK_EQ(3, args->length());
|
| +
|
| + SuperReference* super_reference = args->at(0)->AsSuperReference();
|
| +
|
| + // Load ReflectConstruct function
|
| + EmitLoadJSRuntimeFunction(call);
|
| +
|
| + // Push the target function under the receiver.
|
| + __ LoadP(r0, MemOperand(sp, 0));
|
| + __ push(r0);
|
| + __ StoreP(r3, 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.
|
| + __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| + context()->DropAndPlug(1, r3);
|
| +
|
| + EmitInitializeThisAfterSuper(super_reference);
|
| +}
|
| +
|
| +
|
| +void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
|
| + // Push the builtins object as the receiver.
|
| + Register receiver = LoadDescriptor::ReceiverRegister();
|
| + __ LoadP(receiver, GlobalObjectOperand());
|
| + __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
|
| + __ push(receiver);
|
| +
|
| + // Load the function from the receiver.
|
| + __ mov(LoadDescriptor::NameRegister(), Operand(expr->name()));
|
| + if (FLAG_vector_ics) {
|
| + __ mov(VectorLoadICDescriptor::SlotRegister(),
|
| + Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
|
| + CallLoadIC(NOT_CONTEXTUAL);
|
| + } else {
|
| + 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);
|
| + __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
|
| + __ 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");
|
| - // Push the builtins object as the receiver.
|
| - Register receiver = LoadDescriptor::ReceiverRegister();
|
| - __ LoadP(receiver, GlobalObjectOperand());
|
| - __ LoadP(receiver,
|
| - FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
|
| - __ push(receiver);
|
| -
|
| - // Load the function from the receiver.
|
| - __ mov(LoadDescriptor::NameRegister(), Operand(expr->name()));
|
| - if (FLAG_vector_ics) {
|
| - __ mov(VectorLoadICDescriptor::SlotRegister(),
|
| - Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
|
| - CallLoadIC(NOT_CONTEXTUAL);
|
| - } else {
|
| - CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
|
| - }
|
| + EmitLoadJSRuntimeFunction(expr);
|
|
|
| // Push the target function under the receiver.
|
| __ LoadP(ip, MemOperand(sp, 0));
|
| @@ -4651,11 +4709,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
| VisitForStackValue(args->at(i));
|
| }
|
|
|
| - // Record source position of the IC call.
|
| - SetSourcePosition(expr->position());
|
| - CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
|
| - __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
|
| - __ CallStub(&stub);
|
| + EmitCallJSRuntimeFunction(expr);
|
|
|
| // Restore context register.
|
| __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
|
|