diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2018-01-24 20:16:06 +0100 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-01-24 15:02:20 -0800 |
commit | 4c4af643e5042d615a60c6bbc05aee9d81b903e5 (patch) | |
tree | 3fb0a97988fe4439ae3ae06f26915d1dcf8cab92 /deps/v8/src/compiler/x64/code-generator-x64.cc | |
parent | fa9f31a4fda5a3782c652e56e394465805ebb50f (diff) | |
download | node-new-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.gz |
deps: update V8 to 6.4.388.40
PR-URL: https://github.com/nodejs/node/pull/17489
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/src/compiler/x64/code-generator-x64.cc')
-rw-r--r-- | deps/v8/src/compiler/x64/code-generator-x64.cc | 77 |
1 files changed, 56 insertions, 21 deletions
diff --git a/deps/v8/src/compiler/x64/code-generator-x64.cc b/deps/v8/src/compiler/x64/code-generator-x64.cc index f6cf21fa1c..ea417533f2 100644 --- a/deps/v8/src/compiler/x64/code-generator-x64.cc +++ b/deps/v8/src/compiler/x64/code-generator-x64.cc @@ -212,7 +212,7 @@ class OutOfLineTruncateDoubleToI final : public OutOfLineCode { unwinding_info_writer_->MaybeIncreaseBaseOffsetAt(__ pc_offset(), kDoubleSize); __ Movsd(MemOperand(rsp, 0), input_); - __ SlowTruncateToIDelayed(zone_, result_, rsp, 0); + __ SlowTruncateToIDelayed(zone_, result_); __ addp(rsp, Immediate(kDoubleSize)); unwinding_info_writer_->MaybeIncreaseBaseOffsetAt(__ pc_offset(), -kDoubleSize); @@ -255,14 +255,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode { SaveFPRegsMode const save_fp_mode = frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; -#ifdef V8_CSA_WRITE_BARRIER __ CallRecordWriteStub(object_, scratch1_, remembered_set_action, save_fp_mode); -#else - __ CallStubDelayed( - new (zone_) RecordWriteStub(nullptr, object_, scratch0_, scratch1_, - remembered_set_action, save_fp_mode)); -#endif } private: @@ -288,7 +282,7 @@ class WasmOutOfLineTrap final : public OutOfLineCode { // TODO(eholk): Refactor this method to take the code generator as a // parameter. void Generate() final { - __ RecordProtectedInstructionLanding(pc_); + gen_->AddProtectedInstructionLanding(pc_, __ pc_offset()); if (frame_elided_) { __ EnterFrame(StackFrame::WASM_COMPILED); @@ -757,7 +751,7 @@ void CodeGenerator::AssemblePopArgumentsAdaptorFrame(Register args_reg, ParameterCount callee_args_count(args_reg); __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, - scratch3, ReturnAddressState::kOnStack); + scratch3); __ bind(&done); } @@ -827,7 +821,7 @@ void CodeGenerator::AssembleTailCallAfterGap(Instruction* instr, // jumps to CompileLazyDeoptimizedCode builtin. In order to do this we need to: // 1. load the address of the current instruction; // 2. read from memory the word that contains that bit, which can be found in -// the first set of flags ({kKindSpecificFlags1Offset}); +// the flags in the referenced {CodeDataContainer} object; // 3. test kMarkedForDeoptimizationBit in those flags; and // 4. if it is not zero then it jumps to the builtin. void CodeGenerator::BailoutIfDeoptimized() { @@ -837,8 +831,9 @@ void CodeGenerator::BailoutIfDeoptimized() { __ leaq(rcx, Operand(¤t)); __ bind(¤t); int pc = __ pc_offset(); - int offset = Code::kKindSpecificFlags1Offset - (Code::kHeaderSize + pc); - __ testl(Operand(rcx, offset), + int offset = Code::kCodeDataContainerOffset - (Code::kHeaderSize + pc); + __ movp(rcx, Operand(rcx, offset)); + __ testl(FieldOperand(rcx, CodeDataContainer::kKindSpecificFlagsOffset), Immediate(1 << Code::kMarkedForDeoptimizationBit)); Handle<Code> code = isolate()->builtins()->builtin_handle( Builtins::kCompileLazyDeoptimizedCode); @@ -865,6 +860,23 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( frame_access_state()->ClearSPDelta(); break; } + case kArchCallWasmFunction: { + if (HasImmediateInput(instr, 0)) { + Address wasm_code = reinterpret_cast<Address>( + i.ToConstant(instr->InputAt(0)).ToInt64()); + if (info()->IsWasm()) { + __ near_call(wasm_code, RelocInfo::WASM_CALL); + } else { + __ Call(wasm_code, RelocInfo::JS_TO_WASM_CALL); + } + } else { + Register reg = i.InputRegister(0); + __ call(reg); + } + RecordCallPosition(instr); + frame_access_state()->ClearSPDelta(); + break; + } case kArchTailCallCodeObjectFromJSFunction: case kArchTailCallCodeObject: { if (arch_opcode == kArchTailCallCodeObjectFromJSFunction) { @@ -885,6 +897,25 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( frame_access_state()->SetFrameAccessToDefault(); break; } + case kArchTailCallWasm: { + if (HasImmediateInput(instr, 0)) { + Address wasm_code = reinterpret_cast<Address>( + i.ToConstant(instr->InputAt(0)).ToInt64()); + if (info()->IsWasm()) { + __ near_jmp(wasm_code, RelocInfo::WASM_CALL); + } else { + __ Move(kScratchRegister, wasm_code, RelocInfo::JS_TO_WASM_CALL); + __ jmp(kScratchRegister); + } + } else { + Register reg = i.InputRegister(0); + __ jmp(reg); + } + unwinding_info_writer_.MarkBlockWillExit(); + frame_access_state()->ClearSPDelta(); + frame_access_state()->SetFrameAccessToDefault(); + break; + } case kArchTailCallAddress: { CHECK(!HasImmediateInput(instr, 0)); Register reg = i.InputRegister(0); @@ -3010,7 +3041,7 @@ void CodeGenerator::FinishFrame(Frame* frame) { if (saves_fp != 0) { frame->AlignSavedCalleeRegisterSlots(); if (saves_fp != 0) { // Save callee-saved XMM registers. - const uint32_t saves_fp_count = base::bits::CountPopulation32(saves_fp); + const uint32_t saves_fp_count = base::bits::CountPopulation(saves_fp); frame->AllocateSavedCalleeRegisterSlots(saves_fp_count * (kQuadWordSize / kPointerSize)); } @@ -3044,9 +3075,7 @@ void CodeGenerator::AssembleConstructFrame() { __ StubPrologue(info()->GetOutputStackFrameType()); } - if (!descriptor->IsJSFunctionCall()) { - unwinding_info_writer_.MarkFrameConstructed(pc_base); - } + unwinding_info_writer_.MarkFrameConstructed(pc_base); } int shrink_slots = frame()->GetTotalFrameSlotCount() - descriptor->CalculateFixedFrameSize(); @@ -3064,7 +3093,9 @@ void CodeGenerator::AssembleConstructFrame() { shrink_slots -= static_cast<int>(osr_helper()->UnoptimizedFrameSlots()); } + const RegList saves = descriptor->CalleeSavedRegisters(); const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); + if (shrink_slots > 0) { if (info()->IsWasm() && shrink_slots > 128) { // For WebAssembly functions with big frames we have to do the stack @@ -3096,11 +3127,17 @@ void CodeGenerator::AssembleConstructFrame() { __ AssertUnreachable(kUnexpectedReturnFromWasmTrap); __ bind(&done); } - __ subq(rsp, Immediate(shrink_slots * kPointerSize)); + + // Skip callee-saved slots, which are pushed below. + shrink_slots -= base::bits::CountPopulation(saves); + shrink_slots -= base::bits::CountPopulation(saves_fp); + if (shrink_slots > 0) { + __ subq(rsp, Immediate(shrink_slots * kPointerSize)); + } } if (saves_fp != 0) { // Save callee-saved XMM registers. - const uint32_t saves_fp_count = base::bits::CountPopulation32(saves_fp); + const uint32_t saves_fp_count = base::bits::CountPopulation(saves_fp); const int stack_size = saves_fp_count * kQuadWordSize; // Adjust the stack pointer. __ subp(rsp, Immediate(stack_size)); @@ -3114,7 +3151,6 @@ void CodeGenerator::AssembleConstructFrame() { } } - const RegList saves = descriptor->CalleeSavedRegisters(); if (saves != 0) { // Save callee-saved registers. for (int i = Register::kNumRegisters - 1; i >= 0; i--) { if (!((1 << i) & saves)) continue; @@ -3136,7 +3172,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* pop) { } const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); if (saves_fp != 0) { - const uint32_t saves_fp_count = base::bits::CountPopulation32(saves_fp); + const uint32_t saves_fp_count = base::bits::CountPopulation(saves_fp); const int stack_size = saves_fp_count * kQuadWordSize; // Load the registers from the stack. int slot_idx = 0; @@ -3229,7 +3265,6 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, if (RelocInfo::IsWasmPtrReference(src.rmode())) { __ movq(dst, src.ToInt64(), src.rmode()); } else { - // TODO(dcarney): don't need scratch in this case. int32_t value = src.ToInt32(); if (RelocInfo::IsWasmSizeReference(src.rmode())) { __ movl(dst, Immediate(value, src.rmode())); |