MIPSR6: Fix [MIPS] [TurboFan] Ensure instruction start is in fixed register

Fix 8238562b60

Requirement that the address is stored kJavaScriptCallCodeStartRegister
caused failures on MIPSR6, because of R6 optimization which doesn't load
the address in kJavaScriptCallCodeStartRegister.

Change-Id: If05d8bfe8601288b10fc65cca77664fe9638bbe9
Reviewed-on: https://chromium-review.googlesource.com/910851
Reviewed-by: Miran Karić <miran.karic@mips.com>
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@mips.com>
Cr-Commit-Position: refs/heads/master@{#51212}
This commit is contained in:
Ivica Bogosavljevic 2018-02-09 10:53:11 +01:00 committed by Commit Bot
parent 6004c53da3
commit 76a1003f2f
3 changed files with 20 additions and 10 deletions

View File

@ -176,7 +176,8 @@ static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
}
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ Jump(a2, v0, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, v0, Code::kHeaderSize - kHeapObjectTag);
__ Jump(a2);
}
namespace {
@ -653,7 +654,8 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
__ Move(a1, t0);
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ lw(a2, FieldMemOperand(a1, JSFunction::kCodeOffset));
__ Jump(a2, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, a2, Code::kHeaderSize - kHeapObjectTag);
__ Jump(a2);
}
__ bind(&prepare_step_in_if_stepping);
@ -804,7 +806,8 @@ static void MaybeTailCallOptimizedCodeSlot(MacroAssembler* masm,
ReplaceClosureCodeWithOptimizedCode(masm, optimized_code_entry, closure,
scratch2, scratch3, feedback_vector);
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ Jump(a2, optimized_code_entry, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, optimized_code_entry, Code::kHeaderSize - kHeapObjectTag);
__ Jump(a2);
// Optimized code slot contains deoptimized code, evict it and re-enter the
// losure's code.
@ -1295,7 +1298,8 @@ void Builtins::Generate_CheckOptimizationMarker(MacroAssembler* masm) {
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
__ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset));
__ Jump(a2, a2, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, a2, Code::kHeaderSize - kHeapObjectTag);
__ Jump(a2);
}
void Builtins::Generate_CompileLazyDeoptimizedCode(MacroAssembler* masm) {
@ -1501,7 +1505,8 @@ void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
// which has be reset to the compile lazy builtin.
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ lw(a2, FieldMemOperand(a1, JSFunction::kCodeOffset));
__ Jump(a2, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, a2, Code::kHeaderSize - kHeapObjectTag);
__ Jump(a2);
}
namespace {
@ -2528,7 +2533,8 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// a3 : new target (passed through to callee)
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ lw(a2, FieldMemOperand(a1, JSFunction::kCodeOffset));
__ Call(a2, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, a2, Code::kHeaderSize - kHeapObjectTag);
__ Call(a2);
// Store offset of return address for deoptimizer.
masm->isolate()->heap()->SetArgumentsAdaptorDeoptPCOffset(masm->pc_offset());
@ -2543,7 +2549,8 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
__ bind(&dont_adapt_arguments);
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ lw(a2, FieldMemOperand(a1, JSFunction::kCodeOffset));
__ Jump(a2, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, a2, Code::kHeaderSize - kHeapObjectTag);
__ Jump(a2);
__ bind(&stack_overflow);
{

View File

@ -729,7 +729,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
static_assert(kJavaScriptCallCodeStartRegister == a2, "ABI mismatch");
__ lw(a2, FieldMemOperand(func, JSFunction::kCodeOffset));
__ Call(a2, Code::kHeaderSize - kHeapObjectTag);
__ Addu(a2, a2, Code::kHeaderSize - kHeapObjectTag);
__ Call(a2);
RecordCallPosition(instr);
frame_access_state()->ClearSPDelta();
frame_access_state()->SetFrameAccessToDefault();

View File

@ -4075,10 +4075,12 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
Register code = kJavaScriptCallCodeStartRegister;
lw(code, FieldMemOperand(function, JSFunction::kCodeOffset));
if (flag == CALL_FUNCTION) {
Call(code, Code::kHeaderSize - kHeapObjectTag);
Addu(code, code, Code::kHeaderSize - kHeapObjectTag);
Call(code);
} else {
DCHECK(flag == JUMP_FUNCTION);
Jump(code, Code::kHeaderSize - kHeapObjectTag);
Addu(code, code, Code::kHeaderSize - kHeapObjectTag);
Jump(code);
}
// Continue here if InvokePrologue does handle the invocation due to
// mismatched parameter counts.