Index: src/mips64/full-codegen-mips64.cc |
diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc |
index 5ffc81863644d0ce972f9ee6fc2a3f8764c6fe4a..f4afb4ae60b13b65d547c507e02e15df1ab4c2b2 100644 |
--- a/src/mips64/full-codegen-mips64.cc |
+++ b/src/mips64/full-codegen-mips64.cc |
@@ -255,18 +255,35 @@ void FullCodeGenerator::Generate() { |
Variable* new_target_var = scope()->new_target_var(); |
if (new_target_var != nullptr) { |
Comment cmnt(masm_, "[ new.target"); |
- // new.target is parameter -2. |
- int offset = 2 * kPointerSize + |
- (info_->scope()->num_parameters() + 1) * kPointerSize; |
- __ ld(v0, MemOperand(fp, offset)); |
+ // Get the frame pointer for the calling frame. |
+ __ ld(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
+ |
+ // Skip the arguments adaptor frame if it exists. |
+ Label check_frame_marker; |
+ __ ld(a1, MemOperand(a2, StandardFrameConstants::kContextOffset)); |
+ __ Branch(&check_frame_marker, ne, a1, |
+ Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
+ __ ld(a2, MemOperand(a2, StandardFrameConstants::kCallerFPOffset)); |
+ |
+ // Check the marker in the calling frame. |
+ __ bind(&check_frame_marker); |
+ __ ld(a1, MemOperand(a2, StandardFrameConstants::kMarkerOffset)); |
+ |
+ Label non_construct_frame, done; |
+ __ Branch(&non_construct_frame, ne, a1, |
+ Operand(Smi::FromInt(StackFrame::CONSTRUCT))); |
+ |
+ __ ld(v0, MemOperand(a2, StandardFrameConstants::kExpressionsOffset - |
+ 2 * kPointerSize)); |
+ __ Branch(&done); |
+ |
+ __ bind(&non_construct_frame); |
+ __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
+ __ bind(&done); |
+ |
SetVar(new_target_var, v0, a2, a3); |
} |
- ArgumentsAccessStub::HasNewTarget has_new_target = |
- IsSubclassConstructor(info->function()->kind()) |
- ? ArgumentsAccessStub::HAS_NEW_TARGET |
- : ArgumentsAccessStub::NO_NEW_TARGET; |
- |
// Possibly allocate RestParameters |
int rest_index; |
Variable* rest_param = scope()->rest_parameter(&rest_index); |
@@ -275,10 +292,6 @@ void FullCodeGenerator::Generate() { |
int num_parameters = info->scope()->num_parameters(); |
int offset = num_parameters * kPointerSize; |
- if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) { |
- --num_parameters; |
- ++rest_index; |
- } |
__ Daddu(a3, fp, |
Operand(StandardFrameConstants::kCallerSPOffset + offset)); |
@@ -323,7 +336,7 @@ void FullCodeGenerator::Generate() { |
} else { |
type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
} |
- ArgumentsAccessStub stub(isolate(), type, has_new_target); |
+ ArgumentsAccessStub stub(isolate(), type); |
__ CallStub(&stub); |
SetVar(arguments, v0, a1, a2); |
@@ -484,9 +497,6 @@ void FullCodeGenerator::EmitReturnSequence() { |
// Here we use masm_-> instead of the __ macro to avoid the code coverage |
// tool from instrumenting as we rely on the code size here. |
int32_t arg_count = info_->scope()->num_parameters() + 1; |
- if (IsSubclassConstructor(info_->function()->kind())) { |
- arg_count++; |
- } |
int32_t sp_delta = arg_count * kPointerSize; |
CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
__ RecordJSReturn(); |
@@ -4284,8 +4294,6 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
__ ld(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
__ SmiUntag(a1, a1); |
- // Subtract 1 from arguments count, for new.target. |
- __ Daddu(a1, a1, Operand(-1)); |
__ mov(a0, a1); |
// Get arguments pointer in a2. |