diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc index a588eb298d..3643ae33ae 100644 --- a/src/ppc/builtins-ppc.cc +++ b/src/ppc/builtins-ppc.cc @@ -319,7 +319,7 @@ static void Generate_Runtime_NewObject(MacroAssembler* masm, if (create_memento) { // Get the cell or allocation site. - __ LoadP(r5, MemOperand(sp, 2 * kPointerSize)); + __ LoadP(r5, MemOperand(sp, 3 * kPointerSize)); __ Push(r5, r4, original_constructor); __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 3); __ mr(result, r3); @@ -337,7 +337,6 @@ static void Generate_Runtime_NewObject(MacroAssembler* masm, static void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, - bool use_new_target, bool create_memento) { // ----------- S t a t e ------------- // -- r3 : number of arguments @@ -364,11 +363,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, // Preserve the incoming parameters on the stack. __ SmiTag(r3); - if (use_new_target) { - __ Push(r3, r4, r6); - } else { - __ Push(r3, r4); - } + __ Push(r3, r4, r6); Label rt_call, allocated, normal_new, count_incremented; __ cmp(r4, r6); @@ -616,8 +611,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, __ bind(&allocated); if (create_memento) { - int offset = (use_new_target ? 3 : 2) * kPointerSize; - __ LoadP(r5, MemOperand(sp, offset)); + __ LoadP(r5, MemOperand(sp, 3 * kPointerSize)); __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); __ cmp(r5, r8); __ beq(&count_incremented); @@ -633,22 +627,14 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, } // Restore the parameters. - if (use_new_target) { - __ Pop(r4, ip); - } else { - __ pop(r4); - } + __ Pop(r4, ip); // Retrieve smi-tagged arguments count from the stack. __ LoadP(r6, MemOperand(sp)); // Push new.target onto the construct frame. This is stored just below the // receiver on the stack. - if (use_new_target) { - __ Push(ip, r7, r7); - } else { - __ Push(r7, r7); - } + __ Push(ip, r7, r7); // Set up pointer to last argument. __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); @@ -659,8 +645,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, // r6: number of arguments (smi-tagged) // sp[0]: receiver // sp[1]: receiver - // sp[2]: new.target (if used) - // sp[2/3]: number of arguments (smi-tagged) + // sp[2]: new.target + // sp[3]: number of arguments (smi-tagged) Label loop, no_args; __ SmiUntag(r3, r6, SetRC); __ beq(&no_args, cr0); @@ -687,17 +673,15 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, } // Store offset of return address for deoptimizer. - // TODO(arv): Remove the "!use_new_target" before supporting optimization - // of functions that reference new.target - if (!is_api_function && !use_new_target) { + if (!is_api_function) { masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); } // Restore context from the frame. // r3: result // sp[0]: receiver - // sp[1]: new.target (if used) - // sp[1/2]: number of arguments (smi-tagged) + // sp[1]: new.target + // sp[2]: number of arguments (smi-tagged) __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); // If the result is an object (in the ECMA sense), we should get rid @@ -708,8 +692,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, // If the result is a smi, it is *not* an object in the ECMA sense. // r3: result // sp[0]: receiver (newly allocated object) - // sp[1]: new.target (if used) - // sp[1/2]: number of arguments (smi-tagged) + // sp[1]: new.target + // sp[2]: number of arguments (smi-tagged) __ JumpIfSmi(r3, &use_receiver); // If the type of the result (stored in its map) is less than @@ -727,10 +711,9 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, __ bind(&exit); // r3: result // sp[0]: receiver (newly allocated object) - // sp[1]: new.target (if used) - // sp[1/2]: number of arguments (smi-tagged) - int offset = (use_new_target ? 2 : 1) * kPointerSize; - __ LoadP(r4, MemOperand(sp, offset)); + // sp[1]: new.target (original constructor) + // sp[2]: number of arguments (smi-tagged) + __ LoadP(r4, MemOperand(sp, 2 * kPointerSize)); // Leave construct frame. } @@ -744,17 +727,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { - Generate_JSConstructStubHelper(masm, false, false, FLAG_pretenuring_call_new); + Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); } void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { - Generate_JSConstructStubHelper(masm, true, false, false); -} - - -void Builtins::Generate_JSConstructStubNewTarget(MacroAssembler* masm) { - Generate_JSConstructStubHelper(masm, false, true, FLAG_pretenuring_call_new); + Generate_JSConstructStubHelper(masm, true, false); }