5 #ifndef INCLUDED_FROM_MACRO_ASSEMBLER_H 6 #error This header must be included via macro-assembler.h 9 #ifndef V8_PPC_MACRO_ASSEMBLER_PPC_H_ 10 #define V8_PPC_MACRO_ASSEMBLER_PPC_H_ 12 #include "src/bailout-reason.h" 13 #include "src/contexts.h" 14 #include "src/double.h" 15 #include "src/globals.h" 16 #include "src/ppc/assembler-ppc.h" 22 constexpr Register kReturnRegister0 = r3;
23 constexpr Register kReturnRegister1 = r4;
24 constexpr Register kReturnRegister2 = r5;
25 constexpr Register kJSFunctionRegister = r4;
26 constexpr Register kContextRegister = r30;
27 constexpr Register kAllocateSizeRegister = r4;
28 constexpr Register kSpeculationPoisonRegister = r14;
29 constexpr Register kInterpreterAccumulatorRegister = r3;
30 constexpr Register kInterpreterBytecodeOffsetRegister = r15;
31 constexpr Register kInterpreterBytecodeArrayRegister = r16;
32 constexpr Register kInterpreterDispatchTableRegister = r17;
34 constexpr Register kJavaScriptCallArgCountRegister = r3;
35 constexpr Register kJavaScriptCallCodeStartRegister = r5;
36 constexpr Register kJavaScriptCallTargetRegister = kJSFunctionRegister;
37 constexpr Register kJavaScriptCallNewTargetRegister = r6;
38 constexpr Register kJavaScriptCallExtraArg1Register = r5;
40 constexpr Register kOffHeapTrampolineRegister = ip;
41 constexpr Register kRuntimeCallFunctionRegister = r4;
42 constexpr Register kRuntimeCallArgCountRegister = r3;
43 constexpr Register kRuntimeCallArgvRegister = r5;
44 constexpr Register kWasmInstanceRegister = r10;
45 constexpr Register kWasmCompileLazyFuncIndexRegister = r15;
51 inline MemOperand FieldMemOperand(Register
object,
int offset) {
52 return MemOperand(
object, offset - kHeapObjectTag);
55 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET };
56 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK };
57 enum LinkRegisterStatus { kLRHasNotBeenSaved, kLRHasBeenSaved };
60 Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2 = no_reg,
61 Register reg3 = no_reg,
62 Register reg4 = no_reg,
63 Register reg5 = no_reg,
64 Register reg6 = no_reg);
67 #if V8_TARGET_ARCH_PPC64 71 #define StorePUX stdux 72 #define ShiftLeftImm sldi 73 #define ShiftRightImm srdi 74 #define ClearLeftImm clrldi 75 #define ClearRightImm clrrdi 76 #define ShiftRightArithImm sradi 77 #define ShiftLeft_ sld 78 #define ShiftRight_ srd 79 #define ShiftRightArith srad 84 #define StorePUX stwux 85 #define ShiftLeftImm slwi 86 #define ShiftRightImm srwi 87 #define ClearLeftImm clrlwi 88 #define ClearRightImm clrrwi 89 #define ShiftRightArithImm srawi 90 #define ShiftLeft_ slw 91 #define ShiftRight_ srw 92 #define ShiftRightArith sraw 95 class V8_EXPORT_PRIVATE TurboAssembler :
public TurboAssemblerBase {
97 TurboAssembler(
const AssemblerOptions& options,
void* buffer,
int buffer_size)
98 : TurboAssemblerBase(options, buffer, buffer_size) {}
100 TurboAssembler(Isolate* isolate,
const AssemblerOptions& options,
101 void* buffer,
int buffer_size,
102 CodeObjectRequired create_code_object)
103 : TurboAssemblerBase(isolate, options, buffer, buffer_size,
104 create_code_object) {}
108 void ConvertIntToDouble(Register src, DoubleRegister dst);
112 void ConvertUnsignedIntToDouble(Register src, DoubleRegister dst);
116 void ConvertIntToFloat(Register src, DoubleRegister dst);
120 void ConvertUnsignedIntToFloat(Register src, DoubleRegister dst);
122 #if V8_TARGET_ARCH_PPC64 123 void ConvertInt64ToFloat(Register src, DoubleRegister double_dst);
124 void ConvertInt64ToDouble(Register src, DoubleRegister double_dst);
125 void ConvertUnsignedInt64ToFloat(Register src, DoubleRegister double_dst);
126 void ConvertUnsignedInt64ToDouble(Register src, DoubleRegister double_dst);
131 void ConvertDoubleToInt64(
const DoubleRegister double_input,
132 #
if !V8_TARGET_ARCH_PPC64
133 const Register dst_hi,
135 const Register dst,
const DoubleRegister double_dst,
136 FPRoundingMode rounding_mode = kRoundToZero);
138 #if V8_TARGET_ARCH_PPC64 141 void ConvertDoubleToUnsignedInt64(
142 const DoubleRegister double_input,
const Register dst,
143 const DoubleRegister double_dst,
144 FPRoundingMode rounding_mode = kRoundToZero);
148 void EnterFrame(StackFrame::Type type,
149 bool load_constant_pool_pointer_reg =
false);
152 int LeaveFrame(StackFrame::Type type,
int stack_adjustment = 0);
155 void PushCommonFrame(Register marker_reg = no_reg);
158 void StubPrologue(StackFrame::Type type);
163 void PushStandardFrame(Register function_reg);
167 void RestoreFrameStateForTailCall();
170 static int ActivationFrameAlignment();
172 void InitializeRootRegister() {
173 ExternalReference isolate_root = ExternalReference::isolate_root(isolate());
174 mov(kRootRegister, Operand(isolate_root));
178 void LoadP(Register dst,
const MemOperand& mem, Register scratch = no_reg);
179 void LoadPU(Register dst,
const MemOperand& mem, Register scratch = no_reg);
180 void LoadWordArith(Register dst,
const MemOperand& mem,
181 Register scratch = no_reg);
182 void StoreP(Register src,
const MemOperand& mem, Register scratch = no_reg);
183 void StorePU(Register src,
const MemOperand& mem, Register scratch = no_reg);
185 void LoadDouble(DoubleRegister dst,
const MemOperand& mem,
186 Register scratch = no_reg);
187 void LoadDoubleLiteral(DoubleRegister result, Double value, Register scratch);
190 void LoadIntLiteral(Register dst,
int value);
192 void LoadSmiLiteral(Register dst, Smi smi);
194 void LoadSingle(DoubleRegister dst,
const MemOperand& mem,
195 Register scratch = no_reg);
196 void LoadSingleU(DoubleRegister dst,
const MemOperand& mem,
197 Register scratch = no_reg);
198 void LoadPC(Register dst);
199 void ComputeCodeStartAddress(Register dst);
201 void StoreDouble(DoubleRegister src,
const MemOperand& mem,
202 Register scratch = no_reg);
203 void StoreDoubleU(DoubleRegister src,
const MemOperand& mem,
204 Register scratch = no_reg);
206 void StoreSingle(DoubleRegister src,
const MemOperand& mem,
207 Register scratch = no_reg);
208 void StoreSingleU(DoubleRegister src,
const MemOperand& mem,
209 Register scratch = no_reg);
211 void Cmpi(Register src1,
const Operand& src2, Register scratch,
213 void Cmpli(Register src1,
const Operand& src2, Register scratch,
215 void Cmpwi(Register src1,
const Operand& src2, Register scratch,
218 void SetRoundingMode(FPRoundingMode RN);
221 void ResetRoundingMode();
222 void Add(Register dst, Register src, intptr_t value, Register scratch);
224 void Push(Register src) { push(src); }
226 void Push(Handle<HeapObject> handle);
230 void Push(Register src1, Register src2) {
231 StorePU(src2, MemOperand(sp, -2 * kPointerSize));
232 StoreP(src1, MemOperand(sp, kPointerSize));
236 void Push(Register src1, Register src2, Register src3) {
237 StorePU(src3, MemOperand(sp, -3 * kPointerSize));
238 StoreP(src2, MemOperand(sp, kPointerSize));
239 StoreP(src1, MemOperand(sp, 2 * kPointerSize));
243 void Push(Register src1, Register src2, Register src3, Register src4) {
244 StorePU(src4, MemOperand(sp, -4 * kPointerSize));
245 StoreP(src3, MemOperand(sp, kPointerSize));
246 StoreP(src2, MemOperand(sp, 2 * kPointerSize));
247 StoreP(src1, MemOperand(sp, 3 * kPointerSize));
251 void Push(Register src1, Register src2, Register src3, Register src4,
253 StorePU(src5, MemOperand(sp, -5 * kPointerSize));
254 StoreP(src4, MemOperand(sp, kPointerSize));
255 StoreP(src3, MemOperand(sp, 2 * kPointerSize));
256 StoreP(src2, MemOperand(sp, 3 * kPointerSize));
257 StoreP(src1, MemOperand(sp, 4 * kPointerSize));
260 void Pop(Register dst) { pop(dst); }
263 void Pop(Register src1, Register src2) {
264 LoadP(src2, MemOperand(sp, 0));
265 LoadP(src1, MemOperand(sp, kPointerSize));
266 addi(sp, sp, Operand(2 * kPointerSize));
270 void Pop(Register src1, Register src2, Register src3) {
271 LoadP(src3, MemOperand(sp, 0));
272 LoadP(src2, MemOperand(sp, kPointerSize));
273 LoadP(src1, MemOperand(sp, 2 * kPointerSize));
274 addi(sp, sp, Operand(3 * kPointerSize));
278 void Pop(Register src1, Register src2, Register src3, Register src4) {
279 LoadP(src4, MemOperand(sp, 0));
280 LoadP(src3, MemOperand(sp, kPointerSize));
281 LoadP(src2, MemOperand(sp, 2 * kPointerSize));
282 LoadP(src1, MemOperand(sp, 3 * kPointerSize));
283 addi(sp, sp, Operand(4 * kPointerSize));
287 void Pop(Register src1, Register src2, Register src3, Register src4,
289 LoadP(src5, MemOperand(sp, 0));
290 LoadP(src4, MemOperand(sp, kPointerSize));
291 LoadP(src3, MemOperand(sp, 2 * kPointerSize));
292 LoadP(src2, MemOperand(sp, 3 * kPointerSize));
293 LoadP(src1, MemOperand(sp, 4 * kPointerSize));
294 addi(sp, sp, Operand(5 * kPointerSize));
297 void SaveRegisters(RegList registers);
298 void RestoreRegisters(RegList registers);
300 void CallRecordWriteStub(Register
object, Register address,
301 RememberedSetAction remembered_set_action,
302 SaveFPRegsMode fp_mode);
303 void CallRecordWriteStub(Register
object, Register address,
304 RememberedSetAction remembered_set_action,
305 SaveFPRegsMode fp_mode, Address wasm_target);
307 void MultiPush(RegList regs, Register location = sp);
308 void MultiPop(RegList regs, Register location = sp);
310 void MultiPushDoubles(RegList dregs, Register location = sp);
311 void MultiPopDoubles(RegList dregs, Register location = sp);
315 int RequiredStackSizeForCallerSaved(SaveFPRegsMode fp_mode,
316 Register exclusion1 = no_reg,
317 Register exclusion2 = no_reg,
318 Register exclusion3 = no_reg)
const;
322 int PushCallerSaved(SaveFPRegsMode fp_mode, Register exclusion1 = no_reg,
323 Register exclusion2 = no_reg,
324 Register exclusion3 = no_reg);
327 int PopCallerSaved(SaveFPRegsMode fp_mode, Register exclusion1 = no_reg,
328 Register exclusion2 = no_reg,
329 Register exclusion3 = no_reg);
332 void LoadRoot(Register destination, RootIndex index)
override {
333 LoadRoot(destination, index, al);
335 void LoadRoot(Register destination, RootIndex index, Condition cond);
337 void SwapP(Register src, Register dst, Register scratch);
338 void SwapP(Register src, MemOperand dst, Register scratch);
339 void SwapP(MemOperand src, MemOperand dst, Register scratch_0,
341 void SwapFloat32(DoubleRegister src, DoubleRegister dst,
342 DoubleRegister scratch);
343 void SwapFloat32(DoubleRegister src, MemOperand dst, DoubleRegister scratch);
344 void SwapFloat32(MemOperand src, MemOperand dst, DoubleRegister scratch_0,
345 DoubleRegister scratch_1);
346 void SwapDouble(DoubleRegister src, DoubleRegister dst,
347 DoubleRegister scratch);
348 void SwapDouble(DoubleRegister src, MemOperand dst, DoubleRegister scratch);
349 void SwapDouble(MemOperand src, MemOperand dst, DoubleRegister scratch_0,
350 DoubleRegister scratch_1);
362 void PrepareCallCFunction(
int num_reg_arguments,
int num_double_registers,
364 void PrepareCallCFunction(
int num_reg_arguments, Register scratch);
366 void PrepareForTailCall(
const ParameterCount& callee_args_count,
367 Register caller_args_count_reg, Register scratch0,
374 void MovToFloatParameter(DoubleRegister src);
375 void MovToFloatParameters(DoubleRegister src1, DoubleRegister src2);
376 void MovToFloatResult(DoubleRegister src);
383 void CallCFunction(ExternalReference
function,
int num_arguments);
384 void CallCFunction(Register
function,
int num_arguments);
385 void CallCFunction(ExternalReference
function,
int num_reg_arguments,
386 int num_double_arguments);
387 void CallCFunction(Register
function,
int num_reg_arguments,
388 int num_double_arguments);
392 void CallRuntimeWithCEntry(Runtime::FunctionId fid, Register centry);
394 void MovFromFloatParameter(DoubleRegister dst);
395 void MovFromFloatResult(DoubleRegister dst);
399 void Assert(Condition cond, AbortReason reason, CRegister cr = cr7);
402 void Check(Condition cond, AbortReason reason, CRegister cr = cr7);
405 void Abort(AbortReason reason);
407 inline bool AllowThisStubCall(CodeStub* stub);
408 #if !V8_TARGET_ARCH_PPC64 409 void ShiftLeftPair(Register dst_low, Register dst_high, Register src_low,
410 Register src_high, Register scratch, Register shift);
411 void ShiftLeftPair(Register dst_low, Register dst_high, Register src_low,
413 void ShiftRightPair(Register dst_low, Register dst_high, Register src_low,
414 Register src_high, Register scratch, Register shift);
415 void ShiftRightPair(Register dst_low, Register dst_high, Register src_low,
417 void ShiftRightAlgPair(Register dst_low, Register dst_high, Register src_low,
418 Register src_high, Register scratch, Register shift);
419 void ShiftRightAlgPair(Register dst_low, Register dst_high, Register src_low,
423 void LoadFromConstantsTable(Register destination,
424 int constant_index)
override;
425 void LoadRootRegisterOffset(Register destination, intptr_t offset)
override;
426 void LoadRootRelative(Register destination, int32_t offset)
override;
429 void Jump(Register target);
430 void Jump(Address target, RelocInfo::Mode rmode, Condition cond = al,
432 void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al,
434 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al,
436 void Call(Register target);
437 void Call(Address target, RelocInfo::Mode rmode, Condition cond = al);
438 void Call(Handle<Code> code, RelocInfo::Mode rmode = RelocInfo::CODE_TARGET,
439 Condition cond = al);
440 void Call(Label* target);
442 void CallForDeoptimization(Address target,
int deopt_id,
443 RelocInfo::Mode rmode) {
450 void Drop(
int count);
451 void Drop(Register count, Register scratch = r0);
453 void Ret() { blr(); }
454 void Ret(Condition cond, CRegister cr = cr7) { bclr(cond, cr); }
461 void CanonicalizeNaN(
const DoubleRegister dst,
const DoubleRegister src);
462 void CanonicalizeNaN(
const DoubleRegister value) {
463 CanonicalizeNaN(value, value);
465 void CheckPageFlag(Register
object, Register scratch,
int mask, Condition cc,
466 Label* condition_met);
469 void MovIntToDouble(DoubleRegister dst, Register src, Register scratch);
470 void MovUnsignedIntToDouble(DoubleRegister dst, Register src,
472 void MovInt64ToDouble(DoubleRegister dst,
473 #
if !V8_TARGET_ARCH_PPC64
477 #if V8_TARGET_ARCH_PPC64 478 void MovInt64ComponentsToDouble(DoubleRegister dst, Register src_hi,
479 Register src_lo, Register scratch);
481 void InsertDoubleLow(DoubleRegister dst, Register src, Register scratch);
482 void InsertDoubleHigh(DoubleRegister dst, Register src, Register scratch);
483 void MovDoubleLowToInt(Register dst, DoubleRegister src);
484 void MovDoubleHighToInt(Register dst, DoubleRegister src);
485 void MovDoubleToInt64(
486 #
if !V8_TARGET_ARCH_PPC64
489 Register dst, DoubleRegister src);
490 void MovIntToFloat(DoubleRegister dst, Register src);
491 void MovFloatToInt(Register dst, DoubleRegister src);
493 void Move(Register dst, Smi smi) { LoadSmiLiteral(dst, smi); }
494 void Move(Register dst, Handle<HeapObject> value);
495 void Move(Register dst, ExternalReference reference);
496 void Move(Register dst, Register src, Condition cond = al);
497 void Move(DoubleRegister dst, DoubleRegister src);
499 void SmiUntag(Register reg, RCBit rc = LeaveRC,
int scale = 0) {
500 SmiUntag(reg, reg, rc, scale);
503 void SmiUntag(Register dst, Register src, RCBit rc = LeaveRC,
int scale = 0) {
504 if (scale > kSmiShift) {
505 ShiftLeftImm(dst, src, Operand(scale - kSmiShift), rc);
506 }
else if (scale < kSmiShift) {
507 ShiftRightArithImm(dst, src, kSmiShift - scale, rc);
520 inline void ExtractBitRange(Register dst, Register src,
int rangeStart,
521 int rangeEnd, RCBit rc = LeaveRC,
523 DCHECK(rangeStart >= rangeEnd && rangeStart < kBitsPerSystemPointer);
524 int rotate = (rangeEnd == 0) ? 0 : kBitsPerSystemPointer - rangeEnd;
525 int width = rangeStart - rangeEnd + 1;
526 if (rc == SetRC && rangeStart < 16 && (rangeEnd == 0 || test)) {
528 andi(dst, src, Operand(((1 << width) - 1) << rangeEnd));
530 #if V8_TARGET_ARCH_PPC64 531 rldicl(dst, src, rotate, kBitsPerSystemPointer - width, rc);
533 rlwinm(dst, src, rotate, kBitsPerSystemPointer - width,
534 kBitsPerSystemPointer - 1, rc);
539 inline void ExtractBit(Register dst, Register src,
uint32_t bitNumber,
540 RCBit rc = LeaveRC,
bool test =
false) {
541 ExtractBitRange(dst, src, bitNumber, bitNumber, rc, test);
546 inline void ExtractBitMask(Register dst, Register src,
uintptr_t mask,
547 RCBit rc = LeaveRC,
bool test =
false) {
548 int start = kBitsPerSystemPointer - 1;
552 while (bit && (mask & bit) == 0) {
559 while (bit && (mask & bit)) {
565 DCHECK(bit == 0 || (mask & ((bit << 1) - 1)) == 0);
567 ExtractBitRange(dst, src, start, end, rc, test);
571 inline void TestBit(Register value,
int bitNumber, Register scratch = r0) {
572 ExtractBitRange(scratch, value, bitNumber, bitNumber, SetRC,
true);
576 inline void TestBitMask(Register value,
uintptr_t mask,
577 Register scratch = r0) {
578 ExtractBitMask(scratch, value, mask, SetRC,
true);
582 inline void TestBitRange(Register value,
int rangeStart,
int rangeEnd,
583 Register scratch = r0) {
584 ExtractBitRange(scratch, value, rangeStart, rangeEnd, SetRC,
true);
587 inline void TestIfSmi(Register value, Register scratch) {
588 TestBitRange(value, kSmiTagSize - 1, 0, scratch);
591 inline void JumpIfSmi(Register value, Label* smi_label) {
592 TestIfSmi(value, r0);
595 void JumpIfEqual(Register x, int32_t y, Label* dest);
596 void JumpIfLessThan(Register x, int32_t y, Label* dest);
598 #if V8_TARGET_ARCH_PPC64 599 inline void TestIfInt32(Register value, Register scratch,
600 CRegister cr = cr7) {
602 extsw(scratch, value);
603 cmp(scratch, value, cr);
606 inline void TestIfInt32(Register hi_word, Register lo_word, Register scratch,
607 CRegister cr = cr7) {
609 srawi(scratch, lo_word, 31);
610 cmp(scratch, hi_word, cr);
621 void AddAndCheckForOverflow(Register dst, Register left, Register right,
622 Register overflow_dst, Register scratch = r0);
623 void AddAndCheckForOverflow(Register dst, Register left, intptr_t right,
624 Register overflow_dst, Register scratch = r0);
629 void SubAndCheckForOverflow(Register dst, Register left, Register right,
630 Register overflow_dst, Register scratch = r0);
638 void TryInlineTruncateDoubleToI(Register result, DoubleRegister input,
640 void TruncateDoubleToI(Isolate* isolate, Zone* zone, Register result,
641 DoubleRegister double_input, StubCallMode stub_mode);
643 void LoadConstantPoolPointerRegister();
646 void LoadConstantPoolPointerRegisterFromCodeTargetAddress(
647 Register code_target_address);
648 void AbortConstantPoolBuilding() {
651 bind(ConstantPoolPosition());
655 void ResetSpeculationPoisonRegister();
658 static const int kSmiShift = kSmiTagSize + kSmiShiftSize;
660 int CalculateStackPassedWords(
int num_reg_arguments,
661 int num_double_arguments);
662 void CallCFunctionHelper(Register
function,
int num_reg_arguments,
663 int num_double_arguments);
664 void CallRecordWriteStub(Register
object, Register address,
665 RememberedSetAction remembered_set_action,
666 SaveFPRegsMode fp_mode, Handle<Code> code_target,
667 Address wasm_target);
671 class MacroAssembler :
public TurboAssembler {
673 MacroAssembler(
const AssemblerOptions& options,
void* buffer,
int size)
674 : TurboAssembler(options, buffer, size) {}
676 MacroAssembler(Isolate* isolate,
void* buffer,
int size,
677 CodeObjectRequired create_code_object)
678 : MacroAssembler(isolate, AssemblerOptions::Default(isolate), buffer,
679 size, create_code_object) {}
681 MacroAssembler(Isolate* isolate,
const AssemblerOptions& options,
682 void* buffer,
int size, CodeObjectRequired create_code_object);
687 void IncrementalMarkingRecordWriteHelper(Register
object, Register value,
690 void JumpToJSEntry(Register target);
693 void JumpIfNotInNewSpace(Register
object, Register scratch, Label* branch) {
694 InNewSpace(
object, scratch, eq, branch);
699 void JumpIfInNewSpace(Register
object, Register scratch, Label* branch) {
700 InNewSpace(
object, scratch, ne, branch);
704 void HasColor(Register
object, Register scratch0, Register scratch1,
705 Label* has_color,
int first_bit,
int second_bit);
707 void JumpIfBlack(Register
object, Register scratch0, Register scratch1,
712 void JumpIfWhite(Register value, Register scratch1, Register scratch2,
713 Register scratch3, Label* value_is_white);
720 void RecordWriteField(
721 Register
object,
int offset, Register value, Register scratch,
722 LinkRegisterStatus lr_status, SaveFPRegsMode save_fp,
723 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
724 SmiCheck smi_check = INLINE_SMI_CHECK);
730 Register
object, Register address, Register value,
731 LinkRegisterStatus lr_status, SaveFPRegsMode save_fp,
732 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
733 SmiCheck smi_check = INLINE_SMI_CHECK);
737 void PushSafepointRegisters();
738 void PopSafepointRegisters();
743 void EnterExitFrame(
bool save_doubles,
int stack_space = 1,
744 StackFrame::Type frame_type = StackFrame::EXIT);
749 void LeaveExitFrame(
bool save_doubles, Register argument_count,
750 bool argument_count_is_length =
false);
753 void LoadGlobalProxy(Register dst) {
754 LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst);
757 void LoadNativeContextSlot(
int index, Register dst);
764 void LoadWord(Register dst,
const MemOperand& mem, Register scratch);
765 void StoreWord(Register src,
const MemOperand& mem, Register scratch);
767 void LoadHalfWord(Register dst,
const MemOperand& mem,
768 Register scratch = no_reg);
769 void LoadHalfWordArith(Register dst,
const MemOperand& mem,
770 Register scratch = no_reg);
771 void StoreHalfWord(Register src,
const MemOperand& mem, Register scratch);
773 void LoadByte(Register dst,
const MemOperand& mem, Register scratch);
774 void StoreByte(Register src,
const MemOperand& mem, Register scratch);
776 void LoadRepresentation(Register dst,
const MemOperand& mem, Representation r,
777 Register scratch = no_reg);
778 void StoreRepresentation(Register src,
const MemOperand& mem,
779 Representation r, Register scratch = no_reg);
780 void LoadDoubleU(DoubleRegister dst,
const MemOperand& mem,
781 Register scratch = no_reg);
783 void Cmplwi(Register src1,
const Operand& src2, Register scratch,
785 void And(Register ra, Register rs,
const Operand& rb, RCBit rc = LeaveRC);
786 void Or(Register ra, Register rs,
const Operand& rb, RCBit rc = LeaveRC);
787 void Xor(Register ra, Register rs,
const Operand& rb, RCBit rc = LeaveRC);
789 void AddSmiLiteral(Register dst, Register src, Smi smi, Register scratch);
790 void SubSmiLiteral(Register dst, Register src, Smi smi, Register scratch);
791 void CmpSmiLiteral(Register src1, Smi smi, Register scratch,
793 void CmplSmiLiteral(Register src1, Smi smi, Register scratch,
795 void AndSmiLiteral(Register dst, Register src, Smi smi, Register scratch,
808 void InvokeFunctionCode(Register
function, Register new_target,
809 const ParameterCount& expected,
810 const ParameterCount& actual, InvokeFlag flag);
813 void CheckDebugHook(Register fun, Register new_target,
814 const ParameterCount& expected,
815 const ParameterCount& actual);
819 void InvokeFunction(Register
function, Register new_target,
820 const ParameterCount& actual, InvokeFlag flag);
822 void InvokeFunction(Register
function,
const ParameterCount& expected,
823 const ParameterCount& actual, InvokeFlag flag);
827 void MaybeDropFrames();
832 void PushStackHandler();
836 void PopStackHandler();
849 void CompareObjectType(Register heap_object, Register map, Register type_reg,
855 void CompareInstanceType(Register map, Register type_reg, InstanceType type);
859 void CompareRoot(Register obj, RootIndex index);
860 void PushRoot(RootIndex index) {
866 void JumpIfRoot(Register with, RootIndex index, Label* if_equal) {
867 CompareRoot(with, index);
872 void JumpIfNotRoot(Register with, RootIndex index, Label* if_not_equal) {
873 CompareRoot(with, index);
879 void TryDoubleToInt32Exact(Register result, DoubleRegister double_input,
880 Register scratch, DoubleRegister double_scratch);
885 static int CallSizeNotPredictableCodeSize(Address target,
886 RelocInfo::Mode rmode,
887 Condition cond = al);
888 void CallJSEntry(Register target);
891 void CallStub(CodeStub* stub, Condition cond = al);
892 void TailCallStub(CodeStub* stub, Condition cond = al);
895 void CallRuntime(
const Runtime::Function* f,
int num_arguments,
896 SaveFPRegsMode save_doubles = kDontSaveFPRegs);
897 void CallRuntimeSaveDoubles(Runtime::FunctionId fid) {
898 const Runtime::Function*
function = Runtime::FunctionForId(fid);
899 CallRuntime(
function, function->nargs, kSaveFPRegs);
903 void CallRuntime(Runtime::FunctionId fid,
904 SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
905 const Runtime::Function*
function = Runtime::FunctionForId(fid);
906 CallRuntime(
function, function->nargs, save_doubles);
910 void CallRuntime(Runtime::FunctionId fid,
int num_arguments,
911 SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
912 CallRuntime(Runtime::FunctionForId(fid), num_arguments, save_doubles);
916 void TailCallRuntime(Runtime::FunctionId fid);
921 void JumpToExternalReference(
const ExternalReference& builtin,
922 bool builtin_exit_frame =
false);
925 void JumpToInstructionStream(Address entry);
929 void LoadWeakValue(Register out, Register in, Label* target_if_cleared);
934 void IncrementCounter(StatsCounter* counter,
int value, Register scratch1,
936 void DecrementCounter(StatsCounter* counter,
int value, Register scratch1,
943 void SmiTag(Register reg, RCBit rc = LeaveRC) { SmiTag(reg, reg, rc); }
944 void SmiTag(Register dst, Register src, RCBit rc = LeaveRC) {
945 ShiftLeftImm(dst, src, Operand(kSmiShift), rc);
948 void SmiToPtrArrayOffset(Register dst, Register src) {
949 #if V8_TARGET_ARCH_PPC64 950 STATIC_ASSERT(kSmiTag == 0 && kSmiShift > kPointerSizeLog2);
951 ShiftRightArithImm(dst, src, kSmiShift - kPointerSizeLog2);
953 STATIC_ASSERT(kSmiTag == 0 && kSmiShift < kPointerSizeLog2);
954 ShiftLeftImm(dst, src, Operand(kPointerSizeLog2 - kSmiShift));
960 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case);
963 inline void JumpIfNotSmi(Register value, Label* not_smi_label) {
964 TestIfSmi(value, r0);
965 bne(not_smi_label, cr0);
968 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi);
971 void AssertNotSmi(Register
object);
972 void AssertSmi(Register
object);
976 #if V8_TARGET_ARCH_PPC64 979 STATIC_ASSERT(kSmiTag == 0);
980 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32);
982 #if V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN 983 #define SmiWordOffset(offset) (offset + kPointerSize / 2) 985 #define SmiWordOffset(offset) offset 989 void AssertConstructor(Register
object);
992 void AssertFunction(Register
object);
996 void AssertBoundFunction(Register
object);
1000 void AssertGeneratorObject(Register
object);
1004 void AssertUndefinedOrAllocationSite(Register
object, Register scratch);
1009 template <
typename Field>
1010 void DecodeField(Register dst, Register src, RCBit rc = LeaveRC) {
1011 ExtractBitRange(dst, src, Field::kShift + Field::kSize - 1, Field::kShift,
1015 template <
typename Field>
1016 void DecodeField(Register reg, RCBit rc = LeaveRC) {
1017 DecodeField<Field>(reg, reg, rc);
1021 static const int kSmiShift = kSmiTagSize + kSmiShiftSize;
1024 void InvokePrologue(
const ParameterCount& expected,
1025 const ParameterCount& actual, Label* done,
1026 bool* definitely_mismatches, InvokeFlag flag);
1029 void InNewSpace(Register
object, Register scratch,
1034 static int SafepointRegisterStackIndex(
int reg_code);
1038 friend class StandardFrame;
1044 inline MemOperand ContextMemOperand(Register context,
int index = 0) {
1045 return MemOperand(context, Context::SlotOffset(index));
1049 inline MemOperand NativeContextMemOperand() {
1050 return ContextMemOperand(cp, Context::NATIVE_CONTEXT_INDEX);
1053 #define ACCESS_MASM(masm) masm-> 1058 #endif // V8_PPC_MACRO_ASSEMBLER_PPC_H_