diff options
Diffstat (limited to 'deps/v8/src/arm64')
-rw-r--r-- | deps/v8/src/arm64/assembler-arm64-inl.h | 4 | ||||
-rw-r--r-- | deps/v8/src/arm64/assembler-arm64.cc | 43 | ||||
-rw-r--r-- | deps/v8/src/arm64/assembler-arm64.h | 4 | ||||
-rw-r--r-- | deps/v8/src/arm64/code-stubs-arm64.cc | 9 | ||||
-rw-r--r-- | deps/v8/src/arm64/codegen-arm64.cc | 5 | ||||
-rw-r--r-- | deps/v8/src/arm64/constants-arm64.h | 2 | ||||
-rw-r--r-- | deps/v8/src/arm64/interface-descriptors-arm64.cc | 14 | ||||
-rw-r--r-- | deps/v8/src/arm64/macro-assembler-arm64.cc | 33 | ||||
-rw-r--r-- | deps/v8/src/arm64/macro-assembler-arm64.h | 23 |
9 files changed, 67 insertions, 70 deletions
diff --git a/deps/v8/src/arm64/assembler-arm64-inl.h b/deps/v8/src/arm64/assembler-arm64-inl.h index 52df8143ef..5a163b06fd 100644 --- a/deps/v8/src/arm64/assembler-arm64-inl.h +++ b/deps/v8/src/arm64/assembler-arm64-inl.h @@ -341,7 +341,9 @@ Immediate Operand::immediate_for_heap_object_request() const { DCHECK((heap_object_request().kind() == HeapObjectRequest::kHeapNumber && immediate_.rmode() == RelocInfo::EMBEDDED_OBJECT) || (heap_object_request().kind() == HeapObjectRequest::kCodeStub && - immediate_.rmode() == RelocInfo::CODE_TARGET)); + immediate_.rmode() == RelocInfo::CODE_TARGET) || + (heap_object_request().kind() == HeapObjectRequest::kStringConstant && + immediate_.rmode() == RelocInfo::EMBEDDED_OBJECT)); return immediate_; } diff --git a/deps/v8/src/arm64/assembler-arm64.cc b/deps/v8/src/arm64/assembler-arm64.cc index d41b1a7d7f..eb581b472b 100644 --- a/deps/v8/src/arm64/assembler-arm64.cc +++ b/deps/v8/src/arm64/assembler-arm64.cc @@ -36,6 +36,7 @@ #include "src/code-stubs.h" #include "src/frame-constants.h" #include "src/register-configuration.h" +#include "src/string-constants.h" namespace v8 { namespace internal { @@ -583,6 +584,7 @@ void Assembler::Reset() { } void Assembler::AllocateAndInstallRequestedHeapObjects(Isolate* isolate) { + DCHECK_IMPLIES(isolate == nullptr, heap_object_requests_.empty()); for (auto& request : heap_object_requests_) { Address pc = reinterpret_cast<Address>(buffer_) + request.offset(); switch (request.kind()) { @@ -601,6 +603,13 @@ void Assembler::AllocateAndInstallRequestedHeapObjects(Isolate* isolate) { request.code_stub()->GetCode()); break; } + case HeapObjectRequest::kStringConstant: { + const StringConstantBase* str = request.string(); + CHECK_NOT_NULL(str); + set_target_address_at(pc, 0 /* unused */, + str->AllocateStringConstant(isolate).address()); + break; + } } } } @@ -1717,6 +1726,13 @@ Operand Operand::EmbeddedCode(CodeStub* stub) { return result; } +Operand Operand::EmbeddedStringConstant(const StringConstantBase* str) { + Operand result(0, RelocInfo::EMBEDDED_OBJECT); + result.heap_object_request_.emplace(str); + DCHECK(result.IsHeapObjectRequest()); + return result; +} + void Assembler::ldr(const CPURegister& rt, const Operand& operand) { if (operand.IsHeapObjectRequest()) { RequestHeapObject(operand.heap_object_request()); @@ -4751,14 +4767,6 @@ void Assembler::GrowBuffer() { void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data, ConstantPoolMode constant_pool_mode) { - // Non-relocatable constants should not end up in the literal pool. - DCHECK(!RelocInfo::IsNone(rmode)); - if (options().disable_reloc_info_for_patching) return; - - // We do not try to reuse pool constants. - RelocInfo rinfo(reinterpret_cast<Address>(pc_), rmode, data, nullptr); - bool write_reloc_info = true; - if ((rmode == RelocInfo::COMMENT) || (rmode == RelocInfo::INTERNAL_REFERENCE) || (rmode == RelocInfo::CONST_POOL) || (rmode == RelocInfo::VENEER_POOL) || @@ -4772,23 +4780,22 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data, RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)); // These modes do not need an entry in the constant pool. } else if (constant_pool_mode == NEEDS_POOL_ENTRY) { - write_reloc_info = constpool_.RecordEntry(data, rmode); + bool new_constpool_entry = constpool_.RecordEntry(data, rmode); // Make sure the constant pool is not emitted in place of the next // instruction for which we just recorded relocation info. BlockConstPoolFor(1); + if (!new_constpool_entry) return; } // For modes that cannot use the constant pool, a different sequence of // instructions will be emitted by this function's caller. - if (write_reloc_info) { - // Don't record external references unless the heap will be serialized. - if (RelocInfo::IsOnlyForSerializer(rmode) && - !options().record_reloc_info_for_serialization && !emit_debug_code()) { - return; - } - DCHECK_GE(buffer_space(), kMaxRelocSize); // too late to grow buffer here - reloc_info_writer.Write(&rinfo); - } + if (!ShouldRecordRelocInfo(rmode)) return; + + // We do not try to reuse pool constants. + RelocInfo rinfo(reinterpret_cast<Address>(pc_), rmode, data, nullptr); + + DCHECK_GE(buffer_space(), kMaxRelocSize); // too late to grow buffer here + reloc_info_writer.Write(&rinfo); } void Assembler::near_jump(int offset, RelocInfo::Mode rmode) { diff --git a/deps/v8/src/arm64/assembler-arm64.h b/deps/v8/src/arm64/assembler-arm64.h index b42b80f9ca..0432708fd1 100644 --- a/deps/v8/src/arm64/assembler-arm64.h +++ b/deps/v8/src/arm64/assembler-arm64.h @@ -718,6 +718,7 @@ class Operand { static Operand EmbeddedNumber(double number); // Smi or HeapNumber. static Operand EmbeddedCode(CodeStub* stub); + static Operand EmbeddedStringConstant(const StringConstantBase* str); inline bool IsHeapObjectRequest() const; inline HeapObjectRequest heap_object_request() const; @@ -3624,8 +3625,7 @@ class PatchingAssembler : public Assembler { void PatchSubSp(uint32_t immediate); }; - -class EnsureSpace BASE_EMBEDDED { +class EnsureSpace { public: explicit EnsureSpace(Assembler* assembler) { assembler->CheckBufferSpace(); diff --git a/deps/v8/src/arm64/code-stubs-arm64.cc b/deps/v8/src/arm64/code-stubs-arm64.cc index 328983f42c..9b8114c9bf 100644 --- a/deps/v8/src/arm64/code-stubs-arm64.cc +++ b/deps/v8/src/arm64/code-stubs-arm64.cc @@ -124,7 +124,7 @@ void JSEntryStub::Generate(MacroAssembler* masm) { IsolateAddressId::kPendingExceptionAddress, isolate()))); } __ Str(code_entry, MemOperand(x10)); - __ LoadRoot(x0, Heap::kExceptionRootIndex); + __ LoadRoot(x0, RootIndex::kException); __ B(&exit); // Invoke: Link this frame into the handler chain. @@ -434,8 +434,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm, // Check if the function scheduled an exception. __ Mov(x5, ExternalReference::scheduled_exception_address(isolate)); __ Ldr(x5, MemOperand(x5)); - __ JumpIfNotRoot(x5, Heap::kTheHoleValueRootIndex, - &promote_scheduled_exception); + __ JumpIfNotRoot(x5, RootIndex::kTheHoleValue, &promote_scheduled_exception); __ DropSlots(stack_space); __ Ret(); @@ -484,7 +483,7 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) { STATIC_ASSERT(FCA::kHolderIndex == 0); Register undef = x7; - __ LoadRoot(undef, Heap::kUndefinedValueRootIndex); + __ LoadRoot(undef, RootIndex::kUndefinedValue); // Push new target, call data. __ Push(undef, call_data); @@ -562,7 +561,7 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { name)); __ Ldr(data, FieldMemOperand(callback, AccessorInfo::kDataOffset)); - __ LoadRoot(undef, Heap::kUndefinedValueRootIndex); + __ LoadRoot(undef, RootIndex::kUndefinedValue); __ Mov(isolate_address, ExternalReference::isolate_address(isolate())); __ Ldr(name, FieldMemOperand(callback, AccessorInfo::kNameOffset)); diff --git a/deps/v8/src/arm64/codegen-arm64.cc b/deps/v8/src/arm64/codegen-arm64.cc index ad77033280..180e3f54b7 100644 --- a/deps/v8/src/arm64/codegen-arm64.cc +++ b/deps/v8/src/arm64/codegen-arm64.cc @@ -8,7 +8,6 @@ #include "src/arm64/macro-assembler-arm64-inl.h" #include "src/arm64/simulator-arm64.h" #include "src/codegen.h" -#include "src/isolate.h" #include "src/macro-assembler.h" namespace v8 { @@ -16,9 +15,7 @@ namespace internal { #define __ ACCESS_MASM(masm) -UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) { - return nullptr; -} +UnaryMathFunction CreateSqrtFunction() { return nullptr; } #undef __ diff --git a/deps/v8/src/arm64/constants-arm64.h b/deps/v8/src/arm64/constants-arm64.h index 389f4818d5..1d238e2d32 100644 --- a/deps/v8/src/arm64/constants-arm64.h +++ b/deps/v8/src/arm64/constants-arm64.h @@ -291,10 +291,8 @@ M_(FPCR, AHP_mask | DN_mask | FZ_mask | RMode_mask) const uint32_t Name##_mask = ((1 << Name##_width) - 1) << LowBit; #define DECLARE_INSTRUCTION_FIELDS_OFFSETS(Name, HighBit, LowBit, unused_1) \ DECLARE_FIELDS_OFFSETS(Name, HighBit, LowBit, unused_1, unused_2) -#define NOTHING(A, B) INSTRUCTION_FIELDS_LIST(DECLARE_INSTRUCTION_FIELDS_OFFSETS) SYSTEM_REGISTER_FIELDS_LIST(DECLARE_FIELDS_OFFSETS, NOTHING) -#undef NOTHING #undef DECLARE_FIELDS_OFFSETS #undef DECLARE_INSTRUCTION_FIELDS_OFFSETS diff --git a/deps/v8/src/arm64/interface-descriptors-arm64.cc b/deps/v8/src/arm64/interface-descriptors-arm64.cc index bb1c22aff5..905cc51a57 100644 --- a/deps/v8/src/arm64/interface-descriptors-arm64.cc +++ b/deps/v8/src/arm64/interface-descriptors-arm64.cc @@ -89,9 +89,9 @@ void CallVarargsDescriptor::InitializePlatformSpecific( CallInterfaceDescriptorData* data) { // x0 : number of arguments (on the stack, not including receiver) // x1 : the target to call - // x2 : arguments list (FixedArray) // x4 : arguments list length (untagged) - Register registers[] = {x1, x0, x2, x4}; + // x2 : arguments list (FixedArray) + Register registers[] = {x1, x0, x4, x2}; data->InitializePlatformSpecific(arraysize(registers), registers); } @@ -126,9 +126,9 @@ void ConstructVarargsDescriptor::InitializePlatformSpecific( // x0 : number of arguments (on the stack, not including receiver) // x1 : the target to call // x3 : the new target - // x2 : arguments list (FixedArray) // x4 : arguments list length (untagged) - Register registers[] = {x1, x3, x0, x2, x4}; + // x2 : arguments list (FixedArray) + Register registers[] = {x1, x3, x0, x4, x2}; data->InitializePlatformSpecific(arraysize(registers), registers); } @@ -198,7 +198,7 @@ void BinaryOpDescriptor::InitializePlatformSpecific( data->InitializePlatformSpecific(arraysize(registers), registers); } -void ArgumentAdaptorDescriptor::InitializePlatformSpecific( +void ArgumentsAdaptorDescriptor::InitializePlatformSpecific( CallInterfaceDescriptorData* data) { Register registers[] = { x1, // JSFunction @@ -242,10 +242,10 @@ void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific( CallInterfaceDescriptorData* data) { Register registers[] = { x0, // argument count (not including receiver) - x3, // new target + x4, // address of the first argument x1, // constructor to call + x3, // new target x2, // allocation site feedback if available, undefined otherwise - x4 // address of the first argument }; data->InitializePlatformSpecific(arraysize(registers), registers); } diff --git a/deps/v8/src/arm64/macro-assembler-arm64.cc b/deps/v8/src/arm64/macro-assembler-arm64.cc index b15ab47473..97a75e5758 100644 --- a/deps/v8/src/arm64/macro-assembler-arm64.cc +++ b/deps/v8/src/arm64/macro-assembler-arm64.cc @@ -1516,7 +1516,7 @@ void TurboAssembler::CanonicalizeNaN(const VRegister& dst, Fsub(dst, src, fp_zero); } -void TurboAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { +void TurboAssembler::LoadRoot(Register destination, RootIndex index) { // TODO(jbramley): Most root values are constants, and can be synthesized // without a load. Refer to the ARM back end for details. Ldr(destination, MemOperand(kRootRegister, RootRegisterOffset(index))); @@ -1646,7 +1646,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) { Register scratch = temps.AcquireX(); Label done_checking; AssertNotSmi(object); - JumpIfRoot(object, Heap::kUndefinedValueRootIndex, &done_checking); + JumpIfRoot(object, RootIndex::kUndefinedValue, &done_checking); Ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); CompareInstanceType(scratch, scratch, ALLOCATION_SITE_TYPE); Assert(eq, AbortReason::kExpectedUndefinedOrCell); @@ -1727,7 +1727,7 @@ void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, } void MacroAssembler::JumpToInstructionStream(Address entry) { - Mov(kOffHeapTrampolineRegister, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); + Ldr(kOffHeapTrampolineRegister, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); Br(kOffHeapTrampolineRegister); } @@ -1806,8 +1806,8 @@ void TurboAssembler::CallCFunction(Register function, int num_of_reg_args, void TurboAssembler::LoadFromConstantsTable(Register destination, int constant_index) { DCHECK(isolate()->heap()->RootCanBeTreatedAsConstant( - Heap::kBuiltinsConstantsTableRootIndex)); - LoadRoot(destination, Heap::kBuiltinsConstantsTableRootIndex); + RootIndex::kBuiltinsConstantsTable)); + LoadRoot(destination, RootIndex::kBuiltinsConstantsTable); Ldr(destination, FieldMemOperand(destination, FixedArray::kHeaderSize + constant_index * kPointerSize)); @@ -1905,7 +1905,7 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, Register scratch = temps.AcquireX(); EmbeddedData d = EmbeddedData::FromBlob(); Address entry = d.InstructionStartOfBuiltin(builtin_index); - Mov(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); + Ldr(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); Jump(scratch, cond); return; } @@ -1963,7 +1963,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode) { Register scratch = temps.AcquireX(); EmbeddedData d = EmbeddedData::FromBlob(); Address entry = d.InstructionStartOfBuiltin(builtin_index); - Mov(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); + Ldr(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); Call(scratch); return; } @@ -2225,7 +2225,7 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, // Clear the new.target register if not given. if (!new_target.is_valid()) { - LoadRoot(x3, Heap::kUndefinedValueRootIndex); + LoadRoot(x3, RootIndex::kUndefinedValue); } Label done; @@ -2597,8 +2597,7 @@ void MacroAssembler::LoadElementsKindFromMap(Register result, Register map) { DecodeField<Map::ElementsKindBits>(result); } -void MacroAssembler::CompareRoot(const Register& obj, - Heap::RootListIndex index) { +void MacroAssembler::CompareRoot(const Register& obj, RootIndex index) { UseScratchRegisterScope temps(this); Register temp = temps.AcquireX(); DCHECK(!AreAliased(obj, temp)); @@ -2606,17 +2605,13 @@ void MacroAssembler::CompareRoot(const Register& obj, Cmp(obj, temp); } - -void MacroAssembler::JumpIfRoot(const Register& obj, - Heap::RootListIndex index, +void MacroAssembler::JumpIfRoot(const Register& obj, RootIndex index, Label* if_equal) { CompareRoot(obj, index); B(eq, if_equal); } - -void MacroAssembler::JumpIfNotRoot(const Register& obj, - Heap::RootListIndex index, +void MacroAssembler::JumpIfNotRoot(const Register& obj, RootIndex index, Label* if_not_equal) { CompareRoot(obj, index); B(ne, if_not_equal); @@ -2823,8 +2818,6 @@ void TurboAssembler::CallRecordWriteStub( RecordWriteDescriptor::kObject)); Register slot_parameter( callable.descriptor().GetRegisterParameter(RecordWriteDescriptor::kSlot)); - Register isolate_parameter(callable.descriptor().GetRegisterParameter( - RecordWriteDescriptor::kIsolate)); Register remembered_set_parameter(callable.descriptor().GetRegisterParameter( RecordWriteDescriptor::kRememberedSet)); Register fp_mode_parameter(callable.descriptor().GetRegisterParameter( @@ -2834,7 +2827,6 @@ void TurboAssembler::CallRecordWriteStub( Pop(slot_parameter, object_parameter); - Mov(isolate_parameter, ExternalReference::isolate_address(isolate())); Mov(remembered_set_parameter, Smi::FromEnum(remembered_set_action)); Mov(fp_mode_parameter, Smi::FromEnum(fp_mode)); Call(callable.code(), RelocInfo::CODE_TARGET); @@ -2915,8 +2907,7 @@ void TurboAssembler::AssertUnreachable(AbortReason reason) { if (emit_debug_code()) Abort(reason); } -void MacroAssembler::AssertRegisterIsRoot(Register reg, - Heap::RootListIndex index, +void MacroAssembler::AssertRegisterIsRoot(Register reg, RootIndex index, AbortReason reason) { if (emit_debug_code()) { CompareRoot(reg, index); diff --git a/deps/v8/src/arm64/macro-assembler-arm64.h b/deps/v8/src/arm64/macro-assembler-arm64.h index a2862748a6..8648ff0439 100644 --- a/deps/v8/src/arm64/macro-assembler-arm64.h +++ b/deps/v8/src/arm64/macro-assembler-arm64.h @@ -180,6 +180,9 @@ enum PreShiftImmMode { class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { public: + TurboAssembler(const AssemblerOptions& options, void* buffer, int buffer_size) + : TurboAssemblerBase(options, buffer, buffer_size) {} + TurboAssembler(Isolate* isolate, const AssemblerOptions& options, void* buffer, int buffer_size, CodeObjectRequired create_code_object) @@ -1126,7 +1129,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { #undef DECLARE_FUNCTION // Load an object from the root table. - void LoadRoot(Register destination, Heap::RootListIndex index) override; + void LoadRoot(Register destination, RootIndex index) override; inline void Ret(const Register& xn = lr); @@ -1262,10 +1265,14 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { class MacroAssembler : public TurboAssembler { public: + MacroAssembler(const AssemblerOptions& options, void* buffer, int size) + : TurboAssembler(options, buffer, size) {} + MacroAssembler(Isolate* isolate, void* buffer, int size, CodeObjectRequired create_code_object) : MacroAssembler(isolate, AssemblerOptions::Default(isolate), buffer, size, create_code_object) {} + MacroAssembler(Isolate* isolate, const AssemblerOptions& options, void* buffer, int size, CodeObjectRequired create_code_object); @@ -1821,17 +1828,13 @@ class MacroAssembler : public TurboAssembler { void LoadElementsKindFromMap(Register result, Register map); // Compare the object in a register to a value from the root list. - void CompareRoot(const Register& obj, Heap::RootListIndex index); + void CompareRoot(const Register& obj, RootIndex index); // Compare the object in a register to a value and jump if they are equal. - void JumpIfRoot(const Register& obj, - Heap::RootListIndex index, - Label* if_equal); + void JumpIfRoot(const Register& obj, RootIndex index, Label* if_equal); // Compare the object in a register to a value and jump if they are not equal. - void JumpIfNotRoot(const Register& obj, - Heap::RootListIndex index, - Label* if_not_equal); + void JumpIfNotRoot(const Register& obj, RootIndex index, Label* if_not_equal); // Compare the contents of a register with an operand, and branch to true, // false or fall through, depending on condition. @@ -1944,7 +1947,7 @@ class MacroAssembler : public TurboAssembler { // Debugging. void AssertRegisterIsRoot( - Register reg, Heap::RootListIndex index, + Register reg, RootIndex index, AbortReason reason = AbortReason::kRegisterDidNotMatchExpectedRoot); // Abort if the specified register contains the invalid color bit pattern. @@ -2025,7 +2028,7 @@ class MacroAssembler : public TurboAssembler { // instructions. This scope prevents the MacroAssembler from being called and // literal pools from being emitted. It also asserts the number of instructions // emitted is what you specified when creating the scope. -class InstructionAccurateScope BASE_EMBEDDED { +class InstructionAccurateScope { public: explicit InstructionAccurateScope(TurboAssembler* tasm, size_t count = 0) : tasm_(tasm) |