diff --git a/src/compiler/backend/mips/code-generator-mips.cc b/src/compiler/backend/mips/code-generator-mips.cc index 7d90873b41..7b922e7bc6 100644 --- a/src/compiler/backend/mips/code-generator-mips.cc +++ b/src/compiler/backend/mips/code-generator-mips.cc @@ -782,7 +782,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( Label start_call; bool isWasmCapiFunction = linkage()->GetIncomingDescriptor()->IsWasmCapiFunction(); - int offset = 48; + // from start_call to return address. + int offset = 40; #if V8_HOST_ARCH_MIPS if (__ emit_debug_code()) { offset += 16; @@ -794,7 +795,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( __ bind(&start_call); __ nal(); __ nop(); - __ Addu(ra, ra, offset); + __ Addu(ra, ra, offset - 8); // 8 = nop + nal __ sw(ra, MemOperand(fp, WasmExitFrameConstants::kCallingPCOffset)); __ mov(ra, kScratchReg); } diff --git a/src/compiler/backend/mips64/code-generator-mips64.cc b/src/compiler/backend/mips64/code-generator-mips64.cc index 7ff7053360..170b79390f 100644 --- a/src/compiler/backend/mips64/code-generator-mips64.cc +++ b/src/compiler/backend/mips64/code-generator-mips64.cc @@ -760,6 +760,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( Label start_call; bool isWasmCapiFunction = linkage()->GetIncomingDescriptor()->IsWasmCapiFunction(); + // from start_call to return address. int offset = 48; #if V8_HOST_ARCH_MIPS64 if (__ emit_debug_code()) { @@ -772,7 +773,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( __ bind(&start_call); __ nal(); __ nop(); - __ Daddu(ra, ra, offset); + __ Daddu(ra, ra, offset - 8); // 8 = nop + nal __ sd(ra, MemOperand(fp, WasmExitFrameConstants::kCallingPCOffset)); __ mov(ra, kScratchReg); } diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc index 59da26b0f8..1568ba639c 100644 --- a/src/compiler/wasm-compiler.cc +++ b/src/compiler/wasm-compiler.cc @@ -6206,14 +6206,12 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { pos = 0; offset = 0; for (wasm::ValueType type : sig_->returns()) { - StoreRepresentation store_rep( - wasm::ValueTypes::MachineRepresentationFor(type), kNoWriteBarrier); Node* value = sig_->return_count() == 1 ? call : graph()->NewNode(mcgraph()->common()->Projection(pos), call, Control()); - SetEffect(graph()->NewNode(mcgraph()->machine()->Store(store_rep), - arg_buffer, Int32Constant(offset), value, + SetEffect(graph()->NewNode(GetSafeStoreOperator(offset, type), arg_buffer, + Int32Constant(offset), value, Effect(), Control())); offset += wasm::ValueTypes::ElementSizeInBytes(type); pos++;