Index: src/mips/builtins-mips.cc |
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
index b5a67b47dc59892991d1f785619f6191d77b8631..8763ad21b3370121f29be360497d1130489f4b86 100644 |
--- a/src/mips/builtins-mips.cc |
+++ b/src/mips/builtins-mips.cc |
@@ -323,7 +323,7 @@ static void Generate_Runtime_NewObject(MacroAssembler* masm, |
Label* allocated) { |
if (create_memento) { |
// Get the cell or allocation site. |
- __ lw(a2, MemOperand(sp, 2 * kPointerSize)); |
+ __ lw(a2, MemOperand(sp, 3 * kPointerSize)); |
__ push(a2); |
} |
@@ -348,7 +348,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 ------------- |
// -- a0 : number of arguments |
@@ -382,11 +381,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// Preserve the incoming parameters on the stack. |
__ SmiTag(a0); |
- if (use_new_target) { |
- __ Push(a0, a1, a3); |
- } else { |
- __ Push(a0, a1); |
- } |
+ __ Push(a0, a1, a3); |
Label rt_call, allocated, normal_new, count_incremented; |
__ Branch(&normal_new, eq, a1, Operand(a3)); |
@@ -633,8 +628,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ bind(&allocated); |
if (create_memento) { |
- int offset = (use_new_target ? 3 : 2) * kPointerSize; |
- __ lw(a2, MemOperand(sp, offset)); |
+ __ lw(a2, MemOperand(sp, 3 * kPointerSize)); |
__ LoadRoot(t5, Heap::kUndefinedValueRootIndex); |
__ Branch(&count_incremented, eq, a2, Operand(t5)); |
// a2 is an AllocationSite. We are creating a memento from it, so we |
@@ -648,20 +642,14 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
} |
// Restore the parameters. |
- if (use_new_target) { |
- __ Pop(a3); // new.target |
- } |
+ __ Pop(a3); // new.target |
__ Pop(a1); |
// Retrieve smi-tagged arguments count from the stack. |
__ lw(a0, MemOperand(sp)); |
__ SmiUntag(a0); |
- if (use_new_target) { |
- __ Push(a3, t4, t4); |
- } else { |
- __ Push(t4, t4); |
- } |
+ __ Push(a3, t4, t4); |
// Set up pointer to last argument. |
__ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
@@ -673,8 +661,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// a3: 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, entry; |
__ SmiTag(a3, a0); |
__ jmp(&entry); |
@@ -701,9 +689,7 @@ 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()); |
} |
@@ -718,8 +704,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// If the result is a smi, it is *not* an object in the ECMA sense. |
// v0: 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(v0, &use_receiver); |
// If the type of the result (stored in its map) is less than |
@@ -737,10 +723,9 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
__ bind(&exit); |
// v0: 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; |
- __ lw(a1, MemOperand(sp, offset)); |
+ // sp[1]: new.target (original constructor) |
+ // sp[2]: number of arguments (smi-tagged) |
+ __ lw(a1, MemOperand(sp, 2 * kPointerSize)); |
// Leave construct frame. |
} |
@@ -754,17 +739,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); |
} |