Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 0226ffbf572e3710ee07e65fd40c86de0c540bc8..4042cc83e07d1d1e9412ea3fd6807f13457f8242 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -1070,22 +1070,11 @@ void CEntryStub::Generate(MacroAssembler* masm) { |
// know where the return address is. The CEntryStub is unmovable, so |
// we can store the address on the stack to be able to find it again and |
// we never have to restore it, because it will not change. |
- // Compute the return address in lr to return to after the jump below. Pc is |
- // already at '+ 8' from the current instruction but return is after three |
- // instructions so add another 4 to pc to get the return address. |
- { |
- Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); |
- Label here; |
- __ b(&here, SetLK); |
- __ bind(&here); |
- __ mflr(r8); |
- |
- // Constant used below is dependent on size of Call() macro instructions |
- __ addi(r0, r8, Operand(20)); |
- |
- __ StoreP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize)); |
- __ Call(target); |
- } |
+ Label after_call; |
+ __ mov_label_addr(r0, &after_call); |
+ __ StoreP(r0, MemOperand(sp, kStackFrameExtraParamSlot * kPointerSize)); |
+ __ Call(target); |
+ __ bind(&after_call); |
#if !ABI_RETURNS_OBJECT_PAIRS_IN_REGS |
// If return value is on the stack, pop it to registers. |
@@ -1593,6 +1582,7 @@ void LoadIndexedStringStub::Generate(MacroAssembler* masm) { |
void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
+ CHECK(!has_new_target()); |
// The displacement is the offset of the last parameter (if any) |
// relative to the frame pointer. |
const int kDisplacement = |
@@ -1653,6 +1643,8 @@ void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
// sp[1] : receiver displacement |
// sp[2] : function |
+ CHECK(!has_new_target()); |
+ |
// Check if the calling frame is an arguments adaptor frame. |
Label runtime; |
__ LoadP(r6, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
@@ -1683,6 +1675,8 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
// r9 : allocated object (tagged) |
// r11 : mapped parameter count (tagged) |
+ CHECK(!has_new_target()); |
+ |
__ LoadP(r4, MemOperand(sp, 0 * kPointerSize)); |
// r4 = parameter count (tagged) |
@@ -1965,6 +1959,10 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
// Patch the arguments.length and the parameters pointer. |
__ bind(&adaptor_frame); |
__ LoadP(r4, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ if (has_new_target()) { |
+ // Subtract 1 from smi-tagged arguments count. |
+ __ SubSmiLiteral(r4, r4, Smi::FromInt(1), r0); |
+ } |
__ StoreP(r4, MemOperand(sp, 0)); |
__ SmiToPtrArrayOffset(r6, r4); |
__ add(r6, r5, r6); |
@@ -2051,6 +2049,31 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
} |
+void RestParamAccessStub::GenerateNew(MacroAssembler* masm) { |
+ // Stack layout on entry. |
+ // sp[0] : index of rest parameter |
+ // sp[4] : number of parameters |
+ // sp[8] : receiver displacement |
+ |
+ Label runtime; |
+ __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
+ __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset)); |
+ __ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
+ __ bne(&runtime); |
+ |
+ // Patch the arguments.length and the parameters pointer. |
+ __ LoadP(r4, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ __ StoreP(r4, MemOperand(sp, 1 * kPointerSize)); |
+ __ SmiToPtrArrayOffset(r6, r4); |
+ __ add(r6, r5, r6); |
+ __ addi(r6, r6, Operand(StandardFrameConstants::kCallerSPOffset)); |
+ __ StoreP(r6, MemOperand(sp, 2 * kPointerSize)); |
+ |
+ __ bind(&runtime); |
+ __ TailCallRuntime(Runtime::kNewRestParam, 3, 1); |
+} |
+ |
+ |
void RegExpExecStub::Generate(MacroAssembler* masm) { |
// Just jump directly to runtime if native RegExp is not selected at compile |
// time or if regexp entry in generated code is turned off runtime switch or |
@@ -2760,7 +2783,13 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
} |
// Pass function as original constructor. |
- __ mr(r6, r4); |
+ if (IsSuperConstructorCall()) { |
+ __ ShiftLeftImm(r7, r3, Operand(kPointerSizeLog2)); |
+ __ addi(r7, r7, Operand(kPointerSize)); |
+ __ LoadPX(r6, MemOperand(sp, r7)); |
+ } else { |
+ __ mr(r6, r4); |
+ } |
// Jump to the function-specific construct stub. |
Register jmp_reg = r7; |