diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-08-01 08:38:30 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-08-01 12:53:56 +0200 |
commit | 2dcc3665abf57c3607cebffdeeca062f5894885d (patch) | |
tree | 4f560748132edcfb4c22d6f967a7e80d23d7ea2c /deps/v8/src/compiler/backend/ia32 | |
parent | 1ee47d550c6de132f06110aa13eceb7551d643b3 (diff) | |
download | node-new-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.gz |
deps: update V8 to 7.6.303.28
PR-URL: https://github.com/nodejs/node/pull/28016
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/src/compiler/backend/ia32')
-rw-r--r-- | deps/v8/src/compiler/backend/ia32/code-generator-ia32.cc | 78 | ||||
-rw-r--r-- | deps/v8/src/compiler/backend/ia32/instruction-selector-ia32.cc | 2 |
2 files changed, 47 insertions, 33 deletions
diff --git a/deps/v8/src/compiler/backend/ia32/code-generator-ia32.cc b/deps/v8/src/compiler/backend/ia32/code-generator-ia32.cc index c4ca35472e..0e61c22cbb 100644 --- a/deps/v8/src/compiler/backend/ia32/code-generator-ia32.cc +++ b/deps/v8/src/compiler/backend/ia32/code-generator-ia32.cc @@ -4,20 +4,20 @@ #include "src/compiler/backend/code-generator.h" -#include "src/assembler-inl.h" #include "src/base/overflowing-math.h" -#include "src/callable.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/callable.h" +#include "src/codegen/ia32/assembler-ia32.h" +#include "src/codegen/macro-assembler.h" +#include "src/codegen/optimized-compilation-info.h" #include "src/compiler/backend/code-generator-impl.h" #include "src/compiler/backend/gap-resolver.h" #include "src/compiler/node-matchers.h" #include "src/compiler/osr.h" -#include "src/frame-constants.h" -#include "src/frames.h" +#include "src/execution/frame-constants.h" +#include "src/execution/frames.h" #include "src/heap/heap-inl.h" // crbug.com/v8/8499 -#include "src/ia32/assembler-ia32.h" -#include "src/macro-assembler.h" #include "src/objects/smi.h" -#include "src/optimized-compilation-info.h" #include "src/wasm/wasm-code-manager.h" #include "src/wasm/wasm-objects.h" @@ -247,7 +247,7 @@ class OutOfLineTruncateDoubleToI final : public OutOfLineCode { zone_(gen->zone()) {} void Generate() final { - __ sub(esp, Immediate(kDoubleSize)); + __ AllocateStackSpace(kDoubleSize); __ movsd(MemOperand(esp, 0), input_); if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { // A direct call to a wasm runtime stub defined in this module. @@ -360,7 +360,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { __ CallCFunction(ExternalReference::ieee754_##name##_function(), 4); \ /* Return value is in st(0) on ia32. */ \ /* Store it into the result register. */ \ - __ sub(esp, Immediate(kDoubleSize)); \ + __ AllocateStackSpace(kDoubleSize); \ __ fstp_d(Operand(esp, 0)); \ __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); \ __ add(esp, Immediate(kDoubleSize)); \ @@ -374,7 +374,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { __ CallCFunction(ExternalReference::ieee754_##name##_function(), 2); \ /* Return value is in st(0) on ia32. */ \ /* Store it into the result register. */ \ - __ sub(esp, Immediate(kDoubleSize)); \ + __ AllocateStackSpace(kDoubleSize); \ __ fstp_d(Operand(esp, 0)); \ __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); \ __ add(esp, Immediate(kDoubleSize)); \ @@ -522,7 +522,7 @@ void AdjustStackPointerForTailCall(TurboAssembler* tasm, StandardFrameConstants::kFixedSlotCountAboveFp; int stack_slot_delta = new_slot_above_sp - current_sp_offset; if (stack_slot_delta > 0) { - tasm->sub(esp, Immediate(stack_slot_delta * kSystemPointerSize)); + tasm->AllocateStackSpace(stack_slot_delta * kSystemPointerSize); state->IncreaseSPDelta(stack_slot_delta); } else if (allow_shrinkage && stack_slot_delta < 0) { tasm->add(esp, Immediate(-stack_slot_delta * kSystemPointerSize)); @@ -813,6 +813,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( break; case kArchCallCFunction: { int const num_parameters = MiscField::decode(instr->opcode()); + Label return_location; + if (linkage()->GetIncomingDescriptor()->IsWasmCapiFunction()) { + // Put the return address in a stack slot. + Register scratch = eax; + __ push(scratch); + __ PushPC(); + int pc = __ pc_offset(); + __ pop(scratch); + __ sub(scratch, Immediate(pc + Code::kHeaderSize - kHeapObjectTag)); + __ add(scratch, Immediate::CodeRelativeOffset(&return_location)); + __ mov(MemOperand(ebp, WasmExitFrameConstants::kCallingPCOffset), + scratch); + __ pop(scratch); + } if (HasImmediateInput(instr, 0)) { ExternalReference ref = i.InputExternalReference(0); __ CallCFunction(ref, num_parameters); @@ -820,6 +834,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( Register func = i.InputRegister(0); __ CallCFunction(func, num_parameters); } + __ bind(&return_location); + RecordSafepoint(instr->reference_map(), Safepoint::kNoLazyDeopt); frame_access_state()->SetFrameAccessToDefault(); // Ideally, we should decrement SP delta to match the change of stack // pointer in CallCFunction. However, for certain architectures (e.g. @@ -1188,7 +1204,6 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( case kArchWordPoisonOnSpeculation: // TODO(860429): Remove remaining poisoning infrastructure on ia32. UNREACHABLE(); - break; case kLFence: __ lfence(); break; @@ -1366,7 +1381,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( case kSSEFloat64Mod: { Register tmp = i.TempRegister(1); __ mov(tmp, esp); - __ sub(esp, Immediate(kDoubleSize)); + __ AllocateStackSpace(kDoubleSize); __ and_(esp, -8); // align to 8 byte boundary. // Move values to st(0) and st(1). __ movsd(Operand(esp, 0), i.InputDoubleRegister(1)); @@ -1687,45 +1702,45 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( } case kIA32PushFloat32: if (instr->InputAt(0)->IsFPRegister()) { - __ sub(esp, Immediate(kFloatSize)); + __ AllocateStackSpace(kFloatSize); __ movss(Operand(esp, 0), i.InputDoubleRegister(0)); frame_access_state()->IncreaseSPDelta(kFloatSize / kSystemPointerSize); } else if (HasImmediateInput(instr, 0)) { __ Move(kScratchDoubleReg, i.InputFloat32(0)); - __ sub(esp, Immediate(kFloatSize)); + __ AllocateStackSpace(kFloatSize); __ movss(Operand(esp, 0), kScratchDoubleReg); frame_access_state()->IncreaseSPDelta(kFloatSize / kSystemPointerSize); } else { __ movss(kScratchDoubleReg, i.InputOperand(0)); - __ sub(esp, Immediate(kFloatSize)); + __ AllocateStackSpace(kFloatSize); __ movss(Operand(esp, 0), kScratchDoubleReg); frame_access_state()->IncreaseSPDelta(kFloatSize / kSystemPointerSize); } break; case kIA32PushFloat64: if (instr->InputAt(0)->IsFPRegister()) { - __ sub(esp, Immediate(kDoubleSize)); + __ AllocateStackSpace(kDoubleSize); __ movsd(Operand(esp, 0), i.InputDoubleRegister(0)); frame_access_state()->IncreaseSPDelta(kDoubleSize / kSystemPointerSize); } else if (HasImmediateInput(instr, 0)) { __ Move(kScratchDoubleReg, i.InputDouble(0)); - __ sub(esp, Immediate(kDoubleSize)); + __ AllocateStackSpace(kDoubleSize); __ movsd(Operand(esp, 0), kScratchDoubleReg); frame_access_state()->IncreaseSPDelta(kDoubleSize / kSystemPointerSize); } else { __ movsd(kScratchDoubleReg, i.InputOperand(0)); - __ sub(esp, Immediate(kDoubleSize)); + __ AllocateStackSpace(kDoubleSize); __ movsd(Operand(esp, 0), kScratchDoubleReg); frame_access_state()->IncreaseSPDelta(kDoubleSize / kSystemPointerSize); } break; case kIA32PushSimd128: if (instr->InputAt(0)->IsFPRegister()) { - __ sub(esp, Immediate(kSimd128Size)); + __ AllocateStackSpace(kSimd128Size); __ movups(Operand(esp, 0), i.InputSimd128Register(0)); } else { __ movups(kScratchDoubleReg, i.InputOperand(0)); - __ sub(esp, Immediate(kSimd128Size)); + __ AllocateStackSpace(kSimd128Size); __ movups(Operand(esp, 0), kScratchDoubleReg); } frame_access_state()->IncreaseSPDelta(kSimd128Size / kSystemPointerSize); @@ -1737,7 +1752,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( __ push(operand); frame_access_state()->IncreaseSPDelta(kFloatSize / kSystemPointerSize); } else if (instr->InputAt(0)->IsFPRegister()) { - __ sub(esp, Immediate(kFloatSize)); + __ AllocateStackSpace(kFloatSize); __ movsd(Operand(esp, 0), i.InputDoubleRegister(0)); frame_access_state()->IncreaseSPDelta(kFloatSize / kSystemPointerSize); } else if (HasImmediateInput(instr, 0)) { @@ -3898,7 +3913,6 @@ static Condition FlagsConditionToCondition(FlagsCondition condition) { break; default: UNREACHABLE(); - break; } } @@ -3970,8 +3984,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr, __ wasm_call(static_cast<Address>(trap_id), RelocInfo::WASM_STUB_CALL); ReferenceMap* reference_map = new (gen_->zone()) ReferenceMap(gen_->zone()); - gen_->RecordSafepoint(reference_map, Safepoint::kSimple, - Safepoint::kNoLazyDeopt); + gen_->RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap); } } @@ -4220,7 +4233,8 @@ void CodeGenerator::AssembleConstructFrame() { __ StubPrologue(info()->GetOutputStackFrameType()); if (call_descriptor->IsWasmFunctionCall()) { __ push(kWasmInstanceRegister); - } else if (call_descriptor->IsWasmImportWrapper()) { + } else if (call_descriptor->IsWasmImportWrapper() || + call_descriptor->IsWasmCapiFunction()) { // WASM import wrappers are passed a tuple in the place of the instance. // Unpack the tuple into the instance and the target callable. // This must be done here in the codegen because it cannot be expressed @@ -4232,6 +4246,10 @@ void CodeGenerator::AssembleConstructFrame() { Operand(kWasmInstanceRegister, Tuple2::kValue1Offset - kHeapObjectTag)); __ push(kWasmInstanceRegister); + if (call_descriptor->IsWasmCapiFunction()) { + // Reserve space for saving the PC later. + __ AllocateStackSpace(kSystemPointerSize); + } } } } @@ -4281,8 +4299,7 @@ void CodeGenerator::AssembleConstructFrame() { __ wasm_call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); ReferenceMap* reference_map = new (zone()) ReferenceMap(zone()); - RecordSafepoint(reference_map, Safepoint::kSimple, - Safepoint::kNoLazyDeopt); + RecordSafepoint(reference_map, Safepoint::kNoLazyDeopt); __ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap); __ bind(&done); } @@ -4291,7 +4308,7 @@ void CodeGenerator::AssembleConstructFrame() { required_slots -= base::bits::CountPopulation(saves); required_slots -= frame()->GetReturnSlotCount(); if (required_slots > 0) { - __ sub(esp, Immediate(required_slots * kSystemPointerSize)); + __ AllocateStackSpace(required_slots * kSystemPointerSize); } } @@ -4304,7 +4321,7 @@ void CodeGenerator::AssembleConstructFrame() { // Allocate return slots (located after callee-saved). if (frame()->GetReturnSlotCount() > 0) { - __ sub(esp, Immediate(frame()->GetReturnSlotCount() * kSystemPointerSize)); + __ AllocateStackSpace(frame()->GetReturnSlotCount() * kSystemPointerSize); } } @@ -4592,7 +4609,6 @@ void CodeGenerator::AssembleSwap(InstructionOperand* source, } default: UNREACHABLE(); - break; } } diff --git a/deps/v8/src/compiler/backend/ia32/instruction-selector-ia32.cc b/deps/v8/src/compiler/backend/ia32/instruction-selector-ia32.cc index 44420b3352..f81b88823e 100644 --- a/deps/v8/src/compiler/backend/ia32/instruction-selector-ia32.cc +++ b/deps/v8/src/compiler/backend/ia32/instruction-selector-ia32.cc @@ -310,7 +310,6 @@ void InstructionSelector::VisitLoad(Node* node) { case MachineRepresentation::kWord64: // Fall through. case MachineRepresentation::kNone: UNREACHABLE(); - return; } IA32OperandGenerator g(this); @@ -1619,7 +1618,6 @@ void InstructionSelector::VisitWord32AtomicStore(Node* node) { break; default: UNREACHABLE(); - break; } VisitAtomicExchange(this, node, opcode, rep); } |