28 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_
29 #define V8_X64_MACRO_ASSEMBLER_X64_H_
75 :
reg(index_register),
96 : variable_(&assembler->root_array_available_),
97 old_value_(assembler->root_array_available_) {
98 assembler->root_array_available_ =
false;
101 *variable_ = old_value_;
122 void Load(
Register destination, ExternalReference source);
180 Label* condition_met,
181 Label::Distance condition_met_distance = Label::kFar);
188 Label::Distance distance = Label::kFar) {
189 InNewSpace(
object, scratch,
not_equal, branch, distance);
197 Label::Distance distance = Label::kFar) {
198 InNewSpace(
object, scratch,
equal, branch, distance);
206 Label::Distance on_black_distance = Label::kFar);
212 Label* not_data_object,
213 Label::Distance not_data_object_distance);
223 Label* object_is_white_and_not_data,
224 Label::Distance distance);
255 remembered_set_action,
286 #ifdef ENABLE_DEBUGGER_SUPPORT
300 void EnterExitFrame(
int arg_stack_space = 0,
bool save_doubles =
false);
324 ExternalReference roots_array_start =
325 ExternalReference::roots_array_start(
isolate());
340 const ParameterCount& expected,
341 const ParameterCount& actual,
347 const ParameterCount& expected,
348 const ParameterCount& actual,
349 RelocInfo::Mode rmode,
357 const ParameterCount& actual,
363 const ParameterCount& actual,
433 Label::Distance near_jump = Label::kFar);
492 Label::Distance near_jump = Label::kFar);
496 Label::Distance near_jump = Label::kFar);
501 Label::Distance near_jump = Label::kFar);
506 Label::Distance near_jump = Label::kFar);
511 Label::Distance near_jump = Label::kFar);
518 Label::Distance near_jump = Label::kFar);
523 Label* on_not_both_smi,
524 Label::Distance near_jump = Label::kFar);
528 Label* on_not_both_smi,
529 Label::Distance near_jump = Label::kFar);
542 Label* on_not_smi_result,
543 Label::Distance near_jump = Label::kFar);
558 Label* on_not_smi_result,
559 Label::Distance near_jump = Label::kFar);
571 Label* on_not_smi_result,
572 Label::Distance near_jump = Label::kFar);
578 Label* on_smi_result,
579 Label::Distance near_jump = Label::kFar);
587 Label* on_not_smi_result,
588 Label::Distance near_jump = Label::kFar);
592 Label* on_not_smi_result,
593 Label::Distance near_jump = Label::kFar);
605 Label* on_not_smi_result,
606 Label::Distance near_jump = Label::kFar);
615 Label* on_not_smi_result,
616 Label::Distance near_jump = Label::kFar);
620 const Operand& src2);
629 Label* on_not_smi_result,
630 Label::Distance near_jump = Label::kFar);
637 Label* on_not_smi_result,
638 Label::Distance near_jump = Label::kFar);
645 Label* on_not_smi_result,
646 Label::Distance near_jump = Label::kFar);
663 Label* on_not_smi_result,
664 Label::Distance near_jump = Label::kFar);
680 Label* on_not_smi_result,
681 Label::Distance near_jump = Label::kFar);
699 Label::Distance near_jump = Label::kFar);
720 LoadSmiConstant(dst, source);
724 Register constant = GetSmiConstant(source);
729 void Test(
const Operand& dst,
Smi* source);
739 Label::Distance near_jump = Label::kFar);
747 Label* on_not_both_flat_ascii,
748 Label::Distance near_jump = Label::kFar);
756 Label*on_not_flat_ascii_string,
757 Label::Distance near_jump = Label::kFar);
760 Register first_object_instance_type,
761 Register second_object_instance_type,
765 Label::Distance near_jump = Label::kFar);
772 void Set(
const Operand& dst, int64_t x);
778 void TestBit(
const Operand& dst,
int bit_index);
786 void Cmp(
const Operand& dst,
Smi* src);
795 if (object->IsHeapObject()) {
798 Move(result,
object);
807 void Drop(
int stack_elements);
812 void Jump(
Address destination, RelocInfo::Mode rmode);
813 void Jump(ExternalReference ext);
816 void Call(
Address destination, RelocInfo::Mode rmode);
817 void Call(ExternalReference ext);
819 RelocInfo::Mode rmode,
826 int CallSize(ExternalReference ext);
833 return (target.
high_bit() != 0) ? 3 : 2;
837 return (target.requires_rex() ? 2 : 1) + target.operand_size();
843 Call(
self, RelocInfo::CODE_TARGET);
870 Label::Distance distance = Label::kFar);
876 Label::Distance distance = Label::kFar);
882 Label::Distance distance = Label::kFar);
900 Label* early_success,
964 const char* message);
1051 Label* gc_required);
1060 Label* gc_required);
1066 Label* gc_required);
1073 Label* gc_required);
1077 Label* gc_required);
1084 Label* gc_required);
1088 Label* gc_required);
1100 JumpTarget* then_target);
1105 Register scratch, Label* then_label);
1115 bool miss_on_bound_function =
false);
1139 Label* no_map_match);
1145 bool can_have_holes);
1221 void CallCFunction(ExternalReference
function,
int num_arguments);
1239 return code_object_;
1283 void Abort(
const char* msg);
1298 return SafepointRegisterStackIndex(reg.
code());
1308 Label* call_runtime);
1314 static const int kNumSafepointSavedRegisters = 11;
1317 bool generating_stub_;
1318 bool allow_stub_calls_;
1320 bool root_array_available_;
1333 void InvokePrologue(
const ParameterCount& expected,
1334 const ParameterCount& actual,
1338 bool* definitely_mismatches,
1340 Label::Distance near_jump = Label::kFar,
1344 void EnterExitFramePrologue(
bool save_rax);
1348 void EnterExitFrameEpilogue(
int arg_stack_space,
bool save_doubles);
1350 void LeaveExitFrameEpilogue();
1356 void LoadAllocationTopHelper(
Register result,
1375 Label::Distance distance = Label::kFar);
1381 inline void GetMarkBits(
Register addr_reg,
1387 void JumpToHandlerEntry();
1390 Operand SafepointRegisterSlot(
Register reg);
1391 static int SafepointRegisterStackIndex(
int reg_code) {
1425 inline Operand
FieldOperand(Register
object,
int offset) {
1452 const int kShaddowSpace = 4;
1455 return Operand(
rsp, index * kPointerSize);
1461 #ifdef GENERATED_CODE_COVERAGE
1462 extern void LogGeneratedCodeCoverage(
const char* file_line);
1463 #define CODE_COVERAGE_STRINGIFY(x) #x
1464 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
1465 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1466 #define ACCESS_MASM(masm) { \
1467 byte* x64_coverage_function = \
1468 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \
1471 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \
1472 masm->call(x64_coverage_function, RelocInfo::RUNTIME_ENTRY); \
1479 #define ACCESS_MASM(masm) masm->
1484 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
void CallRuntime(const Runtime::Function *f, int num_arguments)
void ClampDoubleToUint8(Register result_reg, DoubleRegister input_reg, DoubleRegister temp_double_reg)
void Push(Handle< Object > handle)
void JumpIfSmiEqualsConstant(Register src, Smi *constant, Label *on_equals, Label::Distance near_jump=Label::kFar)
void ClampUint8(Register output_reg, Register input_reg)
Isolate * isolate() const
void JumpIfNotString(Register object, Register object_map, Label *not_string, Label::Distance near_jump=Label::kFar)
void PushSafepointRegisters()
void Assert(Condition cond, const char *msg)
void CheckStackAlignment()
void SmiShiftArithmeticRight(Register dst, Register src1, Register src2)
void JumpIfNotValidSmiValue(Register src, Label *on_invalid, Label::Distance near_jump=Label::kFar)
static int SlotOffset(int index)
void LoadRootIndexed(Register destination, Register variable_offset, int fixed_offset)
int LoadAddressSize(ExternalReference source)
void RecordWriteContextSlot(Register context, int offset, Register value, Register scratch, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action=EMIT_REMEMBERED_SET, SmiCheck smi_check=INLINE_SMI_CHECK)
SmiIndex SmiToNegativeIndex(Register dst, Register src, int shift)
void SmiDiv(Register dst, Register src1, Register src2, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
void SmiOrIfSmis(Register dst, Register src1, Register src2, Label *on_not_smis, Label::Distance near_jump=Label::kFar)
void SmiOr(Register dst, Register src1, Register src2)
void AllocateTwoByteSlicedString(Register result, Register length, Register scratch1, Register scratch2, Label *gc_required)
Condition CheckUInteger32ValidSmiValue(Register src)
friend class OptimizedFrame
void LeaveExitFrame(bool save_doubles, Register argument_count)
void LoadGlobalCell(Register dst, Handle< JSGlobalPropertyCell > cell)
static Smi * FromInt(int value)
void RecordWriteArray(Register array, Register value, Register index, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action=EMIT_REMEMBERED_SET, SmiCheck smi_check=INLINE_SMI_CHECK)
void JumpToExternalReference(const ExternalReference &builtin)
void Cmp(Register dst, Handle< Object > source)
void LoadInstanceDescriptors(Register map, Register descriptors)
void AllocateAsciiString(Register result, Register length, Register scratch1, Register scratch2, Register scratch3, Label *gc_required)
void JumpIfNotBothSequentialAsciiStrings(Register first, Register second, Register scratch1, Register scratch2, Label *not_flat_ascii_strings)
void LoadFromNumberDictionary(Label *miss, Register elements, Register key, Register result, Register t0, Register t1, Register t2)
int CallSize(Register target)
void addq(Register dst, Register src)
void SmiAdd(Register dst, Register src1, Register src2, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
void GetBuiltinEntry(Register target, Builtins::JavaScript id)
void JumpIfSmi(Register value, Label *smi_label)
void DispatchMap(Register obj, Register scratch, Handle< Map > map, Handle< Code > success, SmiCheckType smi_check_type)
bool AllowThisStubCall(CodeStub *stub)
void StoreToSafepointRegisterSlot(Register src, Register dst)
void CheckSmiToIndicator(Register dst, Register src)
static const int kCallInstructionLength
void set_allow_stub_calls(bool value)
void CheckFastObjectElements(Register map, Register scratch, Label *fail)
SmiIndex SmiToIndex(Register dst, Register src, int shift)
bool AreAliased(Register r1, Register r2, Register r3, Register r4)
#define ASSERT(condition)
void RecordWriteField(Register object, int offset, Register value, Register scratch, LinkRegisterStatus lr_status, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action=EMIT_REMEMBERED_SET, SmiCheck smi_check=INLINE_SMI_CHECK)
static const int kShortCallInstructionLength
Condition CheckIsMinSmi(Register src)
void PushTryHandler(StackHandler::Kind kind, int handler_index)
void LoadTransitionedArrayMapConditional(ElementsKind expected_kind, ElementsKind transitioned_kind, Register map_in_out, Register scratch, Label *no_map_match)
void SmiAndConstant(Register dst, Register src1, Smi *constant)
void SmiOrConstant(Register dst, Register src1, Smi *constant)
MemOperand GlobalObjectOperand()
void IncrementCounter(StatsCounter *counter, int value, Register scratch1, Register scratch2)
void Abort(const char *msg)
void SmiSub(Register dst, Register src1, Register src2, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
void SmiTryAddConstant(Register dst, Register src, Smi *constant, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
MemOperand ContextOperand(Register context, int index)
void CheckMap(Register obj, Register scratch, Handle< Map > map, Label *fail, SmiCheckType smi_check_type, CompareMapMode mode=REQUIRE_EXACT_MAP)
void SmiMod(Register dst, Register src1, Register src2, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
Condition CheckBothSmi(Register first, Register second)
void CompareRoot(Register obj, Heap::RootListIndex index)
void PushHeapObject(Handle< HeapObject > object)
void DecrementCounter(StatsCounter *counter, int value, Register scratch1, Register scratch2)
static int SafepointRegisterStackIndex(Register reg)
static const int kNumRegisters
void AllocateHeapNumber(Register result, Register scratch1, Register scratch2, Register heap_number_map, Label *gc_required)
void Move(Register dst, Smi *source)
const Register kRootRegister
void PopCallerSaved(SaveFPRegsMode fp_mode, Register exclusion1=no_reg, Register exclusion2=no_reg, Register exclusion3=no_reg)
void JumpIfInNewSpace(Register object, Register scratch, Label *branch, Label::Distance distance=Label::kFar)
void JumpIfInstanceTypeIsNotSequentialAscii(Register type, Register scratch, Label *failure)
int CallSize(const Operand &target)
void SmiToInteger64(Register dst, Register src)
void AbortIfNotRootValue(Register src, Heap::RootListIndex root_value_index, const char *message)
void Load(Register destination, ExternalReference source)
void LeaveFrame(StackFrame::Type type)
void CheckFastElements(Register map, Register scratch, Label *fail)
void LoadGlobalFunction(int index, Register function)
void CheckPageFlag(Register object, Register scratch, int mask, Condition cc, Label *condition_met)
void Integer64PlusConstantToSmi(Register dst, Register src, int constant)
void TryGetFunctionPrototype(Register function, Register result, Register scratch, Label *miss, bool miss_on_bound_function=false)
void AbortIfNotSmi(Register object)
void SmiMul(Register dst, Register src1, Register src2, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
void SmiShiftLogicalRight(Register dst, Register src1, Register src2, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
void CallCFunction(ExternalReference function, int num_arguments)
Condition IsObjectStringType(Register obj, Register type)
void AllocateAsciiConsString(Register result, Register length, Register scratch1, Register scratch2, Label *gc_required)
Operand FieldOperand(Register object, int offset)
void SmiShiftLeftConstant(Register dst, Register src, int shift_value)
void CheckFastSmiElements(Register map, Register scratch, Label *fail)
void AbortIfNotZeroExtended(Register reg)
void Jump(Register target, Condition cond=al)
void RecordWrite(Register object, Register address, Register value, LinkRegisterStatus lr_status, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action=EMIT_REMEMBERED_SET, SmiCheck smi_check=INLINE_SMI_CHECK)
void JumpIfDataObject(Register value, Register scratch, Label *not_data_object)
void SmiXorConstant(Register dst, Register src1, Smi *constant)
Operand ExternalOperand(ExternalReference reference, Register scratch=kScratchRegister)
void CopyBytes(Register src, Register dst, Register length, Register scratch)
void SmiXor(Register dst, Register src1, Register src2)
void LoadHeapObject(Register dst, Handle< HeapObject > object)
void SmiShiftLeft(Register dst, Register src1, Register src2)
void Throw(Register value)
Condition CheckInteger32ValidSmiValue(Register src)
void Move(Register dst, Handle< Object > value)
Operand StackSpaceOperand(int index)
void EnterApiExitFrame(int argc)
void PrepareCallApiFunction(int argc)
void set_has_frame(bool value)
void SetCounter(StatsCounter *counter, int value, Register scratch1, Register scratch2)
SmiIndex(Register index_register, ScaleFactor scale)
void InvokeCode(Register code, const ParameterCount &expected, const ParameterCount &actual, InvokeFlag flag, const CallWrapper &call_wrapper, CallKind call_kind)
void NegativeZeroTest(Register result, Register op, Label *then_label)
const int kRootRegisterBias
MacroAssembler(Isolate *isolate, void *buffer, int size)
void SmiCompareInteger32(const Operand &dst, Register src)
void LoadContext(Register dst, int context_chain_length)
void CallExternalReference(const ExternalReference &ext, int num_arguments)
static int CallSize(Register target, Condition cond=al)
void StoreNumberToDoubleElements(Register value_reg, Register key_reg, Register receiver_reg, Register elements_reg, Register scratch1, Register scratch2, Register scratch3, Register scratch4, Label *fail)
void JumpIfNotInNewSpace(Register object, Register scratch, Label *branch, Label::Distance distance=Label::kFar)
void AssertFastElements(Register elements)
void LoadAddress(Register destination, ExternalReference source)
void JumpIfNotBothSmi(Register reg1, Register reg2, Label *on_not_both_smi)
void JumpIfBlack(Register object, Register scratch0, Register scratch1, Label *on_black)
void SmiSubConstant(Register dst, Register src, Smi *constant)
void AllocateTwoByteConsString(Register result, Register length, Register scratch1, Register scratch2, Label *gc_required)
void SmiAnd(Register dst, Register src1, Register src2)
void Drop(int count, Condition cond=al)
void Integer32ToSmiField(const Operand &dst, Register src)
void JumpIfUIntNotValidSmiValue(Register src, Label *on_invalid, Label::Distance near_jump=Label::kFar)
int CallSize(Address destination, RelocInfo::Mode rmode)
void GetBuiltinFunction(Register target, Builtins::JavaScript id)
void IllegalOperation(int num_arguments)
void CheckAccessGlobalProxy(Register holder_reg, Register scratch, Label *miss)
void CallApiFunctionAndReturn(ExternalReference function, int stack_space)
NoRootArrayScope(MacroAssembler *assembler)
void LoadObject(Register result, Handle< Object > object)
void SmiTest(Register src)
void SmiShiftArithmeticRightConstant(Register dst, Register src, int shift_value)
void InitializeSmiConstantRegister()
void CallRuntimeSaveDoubles(Runtime::FunctionId id)
void ThrowUncatchable(Register value)
void StoreRoot(Register source, Heap::RootListIndex index, Condition cond=al)
void AllocateInNewSpace(int object_size, Register result, Register scratch1, Register scratch2, Label *gc_required, AllocationFlags flags)
void SmiCompare(Register smi1, Register smi2)
void PrepareCallCFunction(int num_reg_arguments, int num_double_registers, Register scratch)
void CompareMap(Register obj, Register scratch, Handle< Map > map, Label *early_success, CompareMapMode mode=REQUIRE_EXACT_MAP)
const int kNumSafepointRegisters
void PushCallerSaved(SaveFPRegsMode fp_mode, Register exclusion1=no_reg, Register exclusion2=no_reg, Register exclusion3=no_reg)
const Register kScratchRegister
void LoadGlobalFunctionInitialMap(Register function, Register map, Register scratch)
void GetNumberHash(Register t0, Register scratch)
void AbortIfNotString(Register object)
void InvokeFunction(Register function, const ParameterCount &actual, InvokeFlag flag, const CallWrapper &call_wrapper, CallKind call_kind)
Handle< Object > CodeObject()
void Store(ExternalReference destination, Register source)
void PositiveSmiDivPowerOfTwoToInteger32(Register dst, Register src, int power)
void JumpIfBothInstanceTypesAreNotSequentialAscii(Register first_object_instance_type, Register second_object_instance_type, Register scratch1, Register scratch2, Label *failure)
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kThisPropertyAssignmentsOffset flag
void SmiToInteger32(Register dst, Register src)
void UndoAllocationInNewSpace(Register object, Register scratch)
void SmiNot(Register dst, Register src)
void LoadFromSafepointRegisterSlot(Register dst, Register src)
void AbortIfNotNumber(Register object)
void Call(Register target, Condition cond=al)
void Set(Register dst, const Immediate &x)
void SmiShiftLogicalRightConstant(Register dst, Register src, int shift_value, Label *on_not_smi_result, Label::Distance near_jump=Label::kFar)
void AllocateAsciiSlicedString(Register result, Register length, Register scratch1, Register scratch2, Label *gc_required)
Condition CheckNonNegativeSmi(Register src)
void set_generating_stub(bool value)
void Check(Condition cond, const char *msg)
void SmiAddConstant(Register dst, Register src, Smi *constant)
void LoadInitialArrayMap(Register function_in, Register scratch, Register map_out, bool can_have_holes)
void JumpIfNotSmi(Register value, Label *not_smi_label)
Condition CheckEitherSmi(Register first, Register second, Register scratch=kScratchRegister)
void SmiNeg(Register dst, Register src, Label *on_smi_result, Label::Distance near_jump=Label::kFar)
const int kSmiConstantRegisterValue
void InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag, const CallWrapper &call_wrapper=NullCallWrapper())
void AddSmiField(Register dst, const Operand &src)
void TestBit(const Operand &dst, int bit_index)
Condition CheckSmi(Register src)
void SelectNonSmi(Register dst, Register src1, Register src2, Label *on_not_smis, Label::Distance near_jump=Label::kFar)
void TailCallStub(CodeStub *stub, Condition cond=al)
CodePatcher(byte *address, int instructions)
void EnsureNotWhite(Register object, Register scratch1, Register scratch2, Register scratch3, Label *object_is_white_and_not_data)
void InitializeRootRegister()
void Integer32ToSmi(Register dst, Register src)
const Register kSmiConstantRegister
void CallStub(CodeStub *stub, Condition cond=al)
void IndexFromHash(Register hash, Register index)
void TailCallExternalReference(const ExternalReference &ext, int num_arguments, int result_size)
Condition CheckBothNonNegativeSmi(Register first, Register second)
int ArgumentStackSlotsForCFunctionCall(int num_arguments)
void EnterExitFrame(bool save_doubles, int stack_space=0)
void InitializeFieldsWithFiller(Register start_offset, Register end_offset, Register filler)
int CallSize(Handle< Code > code_object)
void TailCallRuntime(Runtime::FunctionId fid, int num_arguments, int result_size)
void SetCallKind(Register dst, CallKind kind)
void AllocateTwoByteString(Register result, Register length, Register scratch1, Register scratch2, Register scratch3, Label *gc_required)
void LoadRoot(Register destination, Heap::RootListIndex index, Condition cond=al)
void RememberedSetHelper(Register object, Register addr, Register scratch, SaveFPRegsMode save_fp, RememberedSetFinalAction and_then)
void AbortIfSmi(Register object)
void JumpUnlessBothNonNegativeSmi(Register src1, Register src2, Label *on_not_both_smi, Label::Distance near_jump=Label::kFar)
void PositiveSmiTimesPowerOfTwoToInteger64(Register dst, Register src, int power)
void Test(const Operand &dst, Smi *source)
void PushRoot(Heap::RootListIndex index)
void CmpObjectType(Register heap_object, InstanceType type, Register map)
void CmpInstanceType(Register map, InstanceType type)
void JumpUnlessNonNegativeSmi(Register src, Label *on_not_smi, Label::Distance near_jump=Label::kFar)
void EnterFrame(StackFrame::Type type)
void movq(const Operand &dst, Register src)
void PushAddress(ExternalReference source)
void CheckEnumCache(Register null_value, Label *call_runtime)
void PopSafepointRegisters()
void StubReturn(int argc)
void Move(const Operand &dst, Smi *source)