OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // ----------------------------------------------------------------------------- | 306 // ----------------------------------------------------------------------------- |
307 // Implementation of Operand and MemOperand | 307 // Implementation of Operand and MemOperand |
308 // See assembler-s390-inl.h for inlined constructors | 308 // See assembler-s390-inl.h for inlined constructors |
309 | 309 |
310 Operand::Operand(Handle<Object> handle) { | 310 Operand::Operand(Handle<Object> handle) { |
311 AllowDeferredHandleDereference using_raw_address; | 311 AllowDeferredHandleDereference using_raw_address; |
312 rm_ = no_reg; | 312 rm_ = no_reg; |
313 // Verify all Objects referred by code are NOT in new space. | 313 // Verify all Objects referred by code are NOT in new space. |
314 Object* obj = *handle; | 314 Object* obj = *handle; |
315 if (obj->IsHeapObject()) { | 315 if (obj->IsHeapObject()) { |
316 imm_ = reinterpret_cast<intptr_t>(handle.location()); | 316 value_.immediate = reinterpret_cast<intptr_t>(handle.location()); |
317 rmode_ = RelocInfo::EMBEDDED_OBJECT; | 317 rmode_ = RelocInfo::EMBEDDED_OBJECT; |
318 } else { | 318 } else { |
319 // no relocation needed | 319 // no relocation needed |
320 imm_ = reinterpret_cast<intptr_t>(obj); | 320 value_.immediate = reinterpret_cast<intptr_t>(obj); |
321 rmode_ = kRelocInfo_NONEPTR; | 321 rmode_ = kRelocInfo_NONEPTR; |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
| 325 Operand Operand::EmbeddedNumber(double value) { |
| 326 int32_t smi; |
| 327 if (DoubleToSmiInteger(value, &smi)) return Operand(Smi::FromInt(smi)); |
| 328 Operand result(0, RelocInfo::EMBEDDED_OBJECT); |
| 329 result.is_heap_number_ = true; |
| 330 result.value_.heap_number = value; |
| 331 return result; |
| 332 } |
| 333 |
325 MemOperand::MemOperand(Register rn, int32_t offset) { | 334 MemOperand::MemOperand(Register rn, int32_t offset) { |
326 baseRegister = rn; | 335 baseRegister = rn; |
327 indexRegister = r0; | 336 indexRegister = r0; |
328 offset_ = offset; | 337 offset_ = offset; |
329 } | 338 } |
330 | 339 |
331 MemOperand::MemOperand(Register rx, Register rb, int32_t offset) { | 340 MemOperand::MemOperand(Register rx, Register rb, int32_t offset) { |
332 baseRegister = rb; | 341 baseRegister = rb; |
333 indexRegister = rx; | 342 indexRegister = rx; |
334 offset_ = offset; | 343 offset_ = offset; |
335 } | 344 } |
336 | 345 |
337 // ----------------------------------------------------------------------------- | 346 // ----------------------------------------------------------------------------- |
338 // Specific instructions, constants, and masks. | 347 // Specific instructions, constants, and masks. |
339 | 348 |
340 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) | 349 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) |
341 : AssemblerBase(isolate_data, buffer, buffer_size), | 350 : AssemblerBase(isolate_data, buffer, buffer_size), |
342 recorded_ast_id_(TypeFeedbackId::None()), | 351 recorded_ast_id_(TypeFeedbackId::None()), |
343 code_targets_(100) { | 352 code_targets_(100) { |
344 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 353 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
345 | 354 |
346 last_bound_pos_ = 0; | 355 last_bound_pos_ = 0; |
347 ClearRecordedAstId(); | 356 ClearRecordedAstId(); |
348 relocations_.reserve(128); | 357 relocations_.reserve(128); |
349 } | 358 } |
350 | 359 |
351 void Assembler::GetCode(CodeDesc* desc) { | 360 void Assembler::GetCode(Isolate* isolate, CodeDesc* desc) { |
352 EmitRelocations(); | 361 EmitRelocations(); |
353 | 362 |
| 363 AllocateRequestedHeapNumbers(isolate); |
| 364 |
354 // Set up code descriptor. | 365 // Set up code descriptor. |
355 desc->buffer = buffer_; | 366 desc->buffer = buffer_; |
356 desc->buffer_size = buffer_size_; | 367 desc->buffer_size = buffer_size_; |
357 desc->instr_size = pc_offset(); | 368 desc->instr_size = pc_offset(); |
358 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 369 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
359 desc->origin = this; | 370 desc->origin = this; |
360 desc->unwinding_info_size = 0; | 371 desc->unwinding_info_size = 0; |
361 desc->unwinding_info = nullptr; | 372 desc->unwinding_info = nullptr; |
362 } | 373 } |
363 | 374 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 // RI1 format: <insn> R1,I2 | 655 // RI1 format: <insn> R1,I2 |
645 // +--------+----+----+------------------+ | 656 // +--------+----+----+------------------+ |
646 // | OpCode | R1 |OpCd| I2 | | 657 // | OpCode | R1 |OpCd| I2 | |
647 // +--------+----+----+------------------+ | 658 // +--------+----+----+------------------+ |
648 // 0 8 12 16 31 | 659 // 0 8 12 16 31 |
649 #define RI1_FORM_EMIT(name, op) \ | 660 #define RI1_FORM_EMIT(name, op) \ |
650 void Assembler::name(Register r, const Operand& i2) { ri_form(op, r, i2); } | 661 void Assembler::name(Register r, const Operand& i2) { ri_form(op, r, i2); } |
651 | 662 |
652 void Assembler::ri_form(Opcode op, Register r1, const Operand& i2) { | 663 void Assembler::ri_form(Opcode op, Register r1, const Operand& i2) { |
653 DCHECK(is_uint12(op)); | 664 DCHECK(is_uint12(op)); |
654 DCHECK(is_uint16(i2.imm_) || is_int16(i2.imm_)); | 665 DCHECK(is_uint16(i2.immediate()) || is_int16(i2.immediate())); |
655 emit4bytes((op & 0xFF0) * B20 | r1.code() * B20 | (op & 0xF) * B16 | | 666 emit4bytes((op & 0xFF0) * B20 | r1.code() * B20 | (op & 0xF) * B16 | |
656 (i2.imm_ & 0xFFFF)); | 667 (i2.immediate() & 0xFFFF)); |
657 } | 668 } |
658 | 669 |
659 // RI2 format: <insn> M1,I2 | 670 // RI2 format: <insn> M1,I2 |
660 // +--------+----+----+------------------+ | 671 // +--------+----+----+------------------+ |
661 // | OpCode | M1 |OpCd| I2 | | 672 // | OpCode | M1 |OpCd| I2 | |
662 // +--------+----+----+------------------+ | 673 // +--------+----+----+------------------+ |
663 // 0 8 12 16 31 | 674 // 0 8 12 16 31 |
664 #define RI2_FORM_EMIT(name, op) \ | 675 #define RI2_FORM_EMIT(name, op) \ |
665 void Assembler::name(Condition m, const Operand& i2) { ri_form(op, m, i2); } | 676 void Assembler::name(Condition m, const Operand& i2) { ri_form(op, m, i2); } |
666 | 677 |
667 void Assembler::ri_form(Opcode op, Condition m1, const Operand& i2) { | 678 void Assembler::ri_form(Opcode op, Condition m1, const Operand& i2) { |
668 DCHECK(is_uint12(op)); | 679 DCHECK(is_uint12(op)); |
669 DCHECK(is_uint4(m1)); | 680 DCHECK(is_uint4(m1)); |
670 DCHECK(op == BRC ? is_int16(i2.imm_) : is_uint16(i2.imm_)); | 681 DCHECK(op == BRC ? is_int16(i2.immediate()) : is_uint16(i2.immediate())); |
671 emit4bytes((op & 0xFF0) * B20 | m1 * B20 | (op & 0xF) * B16 | | 682 emit4bytes((op & 0xFF0) * B20 | m1 * B20 | (op & 0xF) * B16 | |
672 (i2.imm_ & 0xFFFF)); | 683 (i2.immediate() & 0xFFFF)); |
673 } | 684 } |
674 | 685 |
675 // RIE-f format: <insn> R1,R2,I3,I4,I5 | 686 // RIE-f format: <insn> R1,R2,I3,I4,I5 |
676 // +--------+----+----+------------------+--------+--------+ | 687 // +--------+----+----+------------------+--------+--------+ |
677 // | OpCode | R1 | R2 | I3 | I4 | I5 | OpCode | | 688 // | OpCode | R1 | R2 | I3 | I4 | I5 | OpCode | |
678 // +--------+----+----+------------------+--------+--------+ | 689 // +--------+----+----+------------------+--------+--------+ |
679 // 0 8 12 16 24 32 40 47 | 690 // 0 8 12 16 24 32 40 47 |
680 void Assembler::rie_f_form(Opcode op, Register r1, Register r2, | 691 void Assembler::rie_f_form(Opcode op, Register r1, Register r2, |
681 const Operand& i3, const Operand& i4, | 692 const Operand& i3, const Operand& i4, |
682 const Operand& i5) { | 693 const Operand& i5) { |
683 DCHECK(is_uint16(op)); | 694 DCHECK(is_uint16(op)); |
684 DCHECK(is_uint8(i3.imm_)); | 695 DCHECK(is_uint8(i3.immediate())); |
685 DCHECK(is_uint8(i4.imm_)); | 696 DCHECK(is_uint8(i4.immediate())); |
686 DCHECK(is_uint8(i5.imm_)); | 697 DCHECK(is_uint8(i5.immediate())); |
687 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | | 698 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | |
688 (static_cast<uint64_t>(r1.code())) * B36 | | 699 (static_cast<uint64_t>(r1.code())) * B36 | |
689 (static_cast<uint64_t>(r2.code())) * B32 | | 700 (static_cast<uint64_t>(r2.code())) * B32 | |
690 (static_cast<uint64_t>(i3.imm_)) * B24 | | 701 (static_cast<uint64_t>(i3.immediate())) * B24 | |
691 (static_cast<uint64_t>(i4.imm_)) * B16 | | 702 (static_cast<uint64_t>(i4.immediate())) * B16 | |
692 (static_cast<uint64_t>(i5.imm_)) * B8 | | 703 (static_cast<uint64_t>(i5.immediate())) * B8 | |
693 (static_cast<uint64_t>(op & 0x00FF)); | 704 (static_cast<uint64_t>(op & 0x00FF)); |
694 emit6bytes(code); | 705 emit6bytes(code); |
695 } | 706 } |
696 | 707 |
697 // RIE format: <insn> R1,R3,I2 | 708 // RIE format: <insn> R1,R3,I2 |
698 // +--------+----+----+------------------+--------+--------+ | 709 // +--------+----+----+------------------+--------+--------+ |
699 // | OpCode | R1 | R3 | I2 |////////| OpCode | | 710 // | OpCode | R1 | R3 | I2 |////////| OpCode | |
700 // +--------+----+----+------------------+--------+--------+ | 711 // +--------+----+----+------------------+--------+--------+ |
701 // 0 8 12 16 32 40 47 | 712 // 0 8 12 16 32 40 47 |
702 #define RIE_FORM_EMIT(name, op) \ | 713 #define RIE_FORM_EMIT(name, op) \ |
703 void Assembler::name(Register r1, Register r3, const Operand& i2) { \ | 714 void Assembler::name(Register r1, Register r3, const Operand& i2) { \ |
704 rie_form(op, r1, r3, i2); \ | 715 rie_form(op, r1, r3, i2); \ |
705 } | 716 } |
706 | 717 |
707 void Assembler::rie_form(Opcode op, Register r1, Register r3, | 718 void Assembler::rie_form(Opcode op, Register r1, Register r3, |
708 const Operand& i2) { | 719 const Operand& i2) { |
709 DCHECK(is_uint16(op)); | 720 DCHECK(is_uint16(op)); |
710 DCHECK(is_int16(i2.imm_)); | 721 DCHECK(is_int16(i2.immediate())); |
711 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | | 722 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | |
712 (static_cast<uint64_t>(r1.code())) * B36 | | 723 (static_cast<uint64_t>(r1.code())) * B36 | |
713 (static_cast<uint64_t>(r3.code())) * B32 | | 724 (static_cast<uint64_t>(r3.code())) * B32 | |
714 (static_cast<uint64_t>(i2.imm_ & 0xFFFF)) * B16 | | 725 (static_cast<uint64_t>(i2.immediate() & 0xFFFF)) * B16 | |
715 (static_cast<uint64_t>(op & 0x00FF)); | 726 (static_cast<uint64_t>(op & 0x00FF)); |
716 emit6bytes(code); | 727 emit6bytes(code); |
717 } | 728 } |
718 | 729 |
719 // RS1 format: <insn> R1,R3,D2(B2) | 730 // RS1 format: <insn> R1,R3,D2(B2) |
720 // +--------+----+----+----+-------------+ | 731 // +--------+----+----+----+-------------+ |
721 // | OpCode | R1 | R3 | B2 | D2 | | 732 // | OpCode | R1 | R3 | B2 | D2 | |
722 // +--------+----+----+----+-------------+ | 733 // +--------+----+----+----+-------------+ |
723 // 0 8 12 16 20 31 | 734 // 0 8 12 16 20 31 |
724 #define RS1_FORM_EMIT(name, op) \ | 735 #define RS1_FORM_EMIT(name, op) \ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // +--------+----+----+------------------+ | 772 // +--------+----+----+------------------+ |
762 // 0 8 12 16 31 | 773 // 0 8 12 16 31 |
763 #define RSI_FORM_EMIT(name, op) \ | 774 #define RSI_FORM_EMIT(name, op) \ |
764 void Assembler::name(Register r1, Register r3, const Operand& i2) { \ | 775 void Assembler::name(Register r1, Register r3, const Operand& i2) { \ |
765 rsi_form(op, r1, r3, i2); \ | 776 rsi_form(op, r1, r3, i2); \ |
766 } | 777 } |
767 | 778 |
768 void Assembler::rsi_form(Opcode op, Register r1, Register r3, | 779 void Assembler::rsi_form(Opcode op, Register r1, Register r3, |
769 const Operand& i2) { | 780 const Operand& i2) { |
770 DCHECK(is_uint8(op)); | 781 DCHECK(is_uint8(op)); |
771 DCHECK(is_uint16(i2.imm_)); | 782 DCHECK(is_uint16(i2.immediate())); |
772 emit4bytes(op * B24 | r1.code() * B20 | r3.code() * B16 | (i2.imm_ & 0xFFFF)); | 783 emit4bytes(op * B24 | r1.code() * B20 | r3.code() * B16 | |
| 784 (i2.immediate() & 0xFFFF)); |
773 } | 785 } |
774 | 786 |
775 // RSL format: <insn> R1,R3,D2(B2) | 787 // RSL format: <insn> R1,R3,D2(B2) |
776 // +--------+----+----+----+-------------+--------+--------+ | 788 // +--------+----+----+----+-------------+--------+--------+ |
777 // | OpCode | L1 | | B2 | D2 | | OpCode | | 789 // | OpCode | L1 | | B2 | D2 | | OpCode | |
778 // +--------+----+----+----+-------------+--------+--------+ | 790 // +--------+----+----+----+-------------+--------+--------+ |
779 // 0 8 12 16 20 32 40 47 | 791 // 0 8 12 16 20 32 40 47 |
780 #define RSL_FORM_EMIT(name, op) \ | 792 #define RSL_FORM_EMIT(name, op) \ |
781 void Assembler::name(Length l1, Register b2, Disp d2) { \ | 793 void Assembler::name(Length l1, Register b2, Disp d2) { \ |
782 rsl_form(op, l1, b2, d2); \ | 794 rsl_form(op, l1, b2, d2); \ |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } \ | 926 } \ |
915 void Assembler::name(Register r1, const Operand& i2, Condition m3, \ | 927 void Assembler::name(Register r1, const Operand& i2, Condition m3, \ |
916 const MemOperand& opnd) { \ | 928 const MemOperand& opnd) { \ |
917 name(r1, m3, opnd.getBaseRegister(), opnd.getDisplacement(), i2); \ | 929 name(r1, m3, opnd.getBaseRegister(), opnd.getDisplacement(), i2); \ |
918 } | 930 } |
919 | 931 |
920 void Assembler::ris_form(Opcode op, Register r1, Condition m3, Register b4, | 932 void Assembler::ris_form(Opcode op, Register r1, Condition m3, Register b4, |
921 Disp d4, const Operand& i2) { | 933 Disp d4, const Operand& i2) { |
922 DCHECK(is_uint12(d4)); | 934 DCHECK(is_uint12(d4)); |
923 DCHECK(is_uint16(op)); | 935 DCHECK(is_uint16(op)); |
924 DCHECK(is_uint8(i2.imm_)); | 936 DCHECK(is_uint8(i2.immediate())); |
925 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | | 937 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | |
926 (static_cast<uint64_t>(r1.code())) * B36 | | 938 (static_cast<uint64_t>(r1.code())) * B36 | |
927 (static_cast<uint64_t>(m3)) * B32 | | 939 (static_cast<uint64_t>(m3)) * B32 | |
928 (static_cast<uint64_t>(b4.code())) * B28 | | 940 (static_cast<uint64_t>(b4.code())) * B28 | |
929 (static_cast<uint64_t>(d4)) * B16 | | 941 (static_cast<uint64_t>(d4)) * B16 | |
930 (static_cast<uint64_t>(i2.imm_)) << 8 | | 942 (static_cast<uint64_t>(i2.immediate())) << 8 | |
931 (static_cast<uint64_t>(op & 0x00FF)); | 943 (static_cast<uint64_t>(op & 0x00FF)); |
932 emit6bytes(code); | 944 emit6bytes(code); |
933 } | 945 } |
934 | 946 |
935 // S format: <insn> D2(B2) | 947 // S format: <insn> D2(B2) |
936 // +------------------+----+-------------+ | 948 // +------------------+----+-------------+ |
937 // | OpCode | B2 | D2 | | 949 // | OpCode | B2 | D2 | |
938 // +------------------+----+-------------+ | 950 // +------------------+----+-------------+ |
939 // 0 16 20 31 | 951 // 0 16 20 31 |
940 #define S_FORM_EMIT(name, op) \ | 952 #define S_FORM_EMIT(name, op) \ |
(...skipping 14 matching lines...) Expand all Loading... |
955 // 0 8 16 20 31 | 967 // 0 8 16 20 31 |
956 #define SI_FORM_EMIT(name, op) \ | 968 #define SI_FORM_EMIT(name, op) \ |
957 void Assembler::name(const Operand& i2, Register b1, Disp d1) { \ | 969 void Assembler::name(const Operand& i2, Register b1, Disp d1) { \ |
958 si_form(op, i2, b1, d1); \ | 970 si_form(op, i2, b1, d1); \ |
959 } \ | 971 } \ |
960 void Assembler::name(const MemOperand& opnd, const Operand& i2) { \ | 972 void Assembler::name(const MemOperand& opnd, const Operand& i2) { \ |
961 name(i2, opnd.getBaseRegister(), opnd.getDisplacement()); \ | 973 name(i2, opnd.getBaseRegister(), opnd.getDisplacement()); \ |
962 } | 974 } |
963 | 975 |
964 void Assembler::si_form(Opcode op, const Operand& i2, Register b1, Disp d1) { | 976 void Assembler::si_form(Opcode op, const Operand& i2, Register b1, Disp d1) { |
965 emit4bytes((op & 0x00FF) << 24 | i2.imm_ * B16 | b1.code() * B12 | d1); | 977 emit4bytes((op & 0x00FF) << 24 | i2.immediate() * B16 | b1.code() * B12 | d1); |
966 } | 978 } |
967 | 979 |
968 // SIY format: <insn> D1(B1),I2 | 980 // SIY format: <insn> D1(B1),I2 |
969 // +--------+---------+----+-------------+--------+--------+ | 981 // +--------+---------+----+-------------+--------+--------+ |
970 // | OpCode | I2 | B1 | DL1 | DH1 | OpCode | | 982 // | OpCode | I2 | B1 | DL1 | DH1 | OpCode | |
971 // +--------+---------+----+-------------+--------+--------+ | 983 // +--------+---------+----+-------------+--------+--------+ |
972 // 0 8 16 20 32 36 40 47 | 984 // 0 8 16 20 32 36 40 47 |
973 #define SIY_FORM_EMIT(name, op) \ | 985 #define SIY_FORM_EMIT(name, op) \ |
974 void Assembler::name(const Operand& i2, Register b1, Disp d1) { \ | 986 void Assembler::name(const Operand& i2, Register b1, Disp d1) { \ |
975 siy_form(op, i2, b1, d1); \ | 987 siy_form(op, i2, b1, d1); \ |
976 } \ | 988 } \ |
977 void Assembler::name(const MemOperand& opnd, const Operand& i2) { \ | 989 void Assembler::name(const MemOperand& opnd, const Operand& i2) { \ |
978 name(i2, opnd.getBaseRegister(), opnd.getDisplacement()); \ | 990 name(i2, opnd.getBaseRegister(), opnd.getDisplacement()); \ |
979 } | 991 } |
980 | 992 |
981 void Assembler::siy_form(Opcode op, const Operand& i2, Register b1, Disp d1) { | 993 void Assembler::siy_form(Opcode op, const Operand& i2, Register b1, Disp d1) { |
982 DCHECK(is_uint20(d1) || is_int20(d1)); | 994 DCHECK(is_uint20(d1) || is_int20(d1)); |
983 DCHECK(is_uint16(op)); | 995 DCHECK(is_uint16(op)); |
984 DCHECK(is_uint8(i2.imm_)); | 996 DCHECK(is_uint8(i2.immediate())); |
985 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | | 997 uint64_t code = (static_cast<uint64_t>(op & 0xFF00)) * B32 | |
986 (static_cast<uint64_t>(i2.imm_)) * B32 | | 998 (static_cast<uint64_t>(i2.immediate())) * B32 | |
987 (static_cast<uint64_t>(b1.code())) * B28 | | 999 (static_cast<uint64_t>(b1.code())) * B28 | |
988 (static_cast<uint64_t>(d1 & 0x0FFF)) * B16 | | 1000 (static_cast<uint64_t>(d1 & 0x0FFF)) * B16 | |
989 (static_cast<uint64_t>(d1 & 0x0FF000)) >> 4 | | 1001 (static_cast<uint64_t>(d1 & 0x0FF000)) >> 4 | |
990 (static_cast<uint64_t>(op & 0x00FF)); | 1002 (static_cast<uint64_t>(op & 0x00FF)); |
991 emit6bytes(code); | 1003 emit6bytes(code); |
992 } | 1004 } |
993 | 1005 |
994 // SIL format: <insn> D1(B1),I2 | 1006 // SIL format: <insn> D1(B1),I2 |
995 // +------------------+----+-------------+-----------------+ | 1007 // +------------------+----+-------------+-----------------+ |
996 // | OpCode | B1 | D1 | I2 | | 1008 // | OpCode | B1 | D1 | I2 | |
997 // +------------------+----+-------------+-----------------+ | 1009 // +------------------+----+-------------+-----------------+ |
998 // 0 16 20 32 47 | 1010 // 0 16 20 32 47 |
999 #define SIL_FORM_EMIT(name, op) \ | 1011 #define SIL_FORM_EMIT(name, op) \ |
1000 void Assembler::name(Register b1, Disp d1, const Operand& i2) { \ | 1012 void Assembler::name(Register b1, Disp d1, const Operand& i2) { \ |
1001 sil_form(op, b1, d1, i2); \ | 1013 sil_form(op, b1, d1, i2); \ |
1002 } \ | 1014 } \ |
1003 void Assembler::name(const MemOperand& opnd, const Operand& i2) { \ | 1015 void Assembler::name(const MemOperand& opnd, const Operand& i2) { \ |
1004 name(opnd.getBaseRegister(), opnd.getDisplacement(), i2); \ | 1016 name(opnd.getBaseRegister(), opnd.getDisplacement(), i2); \ |
1005 } | 1017 } |
1006 | 1018 |
1007 void Assembler::sil_form(Opcode op, Register b1, Disp d1, const Operand& i2) { | 1019 void Assembler::sil_form(Opcode op, Register b1, Disp d1, const Operand& i2) { |
1008 DCHECK(is_uint12(d1)); | 1020 DCHECK(is_uint12(d1)); |
1009 DCHECK(is_uint16(op)); | 1021 DCHECK(is_uint16(op)); |
1010 DCHECK(is_uint16(i2.imm_)); | 1022 DCHECK(is_uint16(i2.immediate())); |
1011 uint64_t code = (static_cast<uint64_t>(op)) * B32 | | 1023 uint64_t code = (static_cast<uint64_t>(op)) * B32 | |
1012 (static_cast<uint64_t>(b1.code())) * B28 | | 1024 (static_cast<uint64_t>(b1.code())) * B28 | |
1013 (static_cast<uint64_t>(d1)) * B16 | | 1025 (static_cast<uint64_t>(d1)) * B16 | |
1014 (static_cast<uint64_t>(i2.imm_)); | 1026 (static_cast<uint64_t>(i2.immediate())); |
1015 emit6bytes(code); | 1027 emit6bytes(code); |
1016 } | 1028 } |
1017 | 1029 |
1018 // RXF format: <insn> R1,R3,D2(X2,B2) | 1030 // RXF format: <insn> R1,R3,D2(X2,B2) |
1019 // +--------+----+----+----+-------------+----+---+--------+ | 1031 // +--------+----+----+----+-------------+----+---+--------+ |
1020 // | OpCode | R3 | X2 | B2 | D2 | R1 |///| OpCode | | 1032 // | OpCode | R3 | X2 | B2 | D2 | R1 |///| OpCode | |
1021 // +--------+----+----+----+-------------+----+---+--------+ | 1033 // +--------+----+----+----+-------------+----+---+--------+ |
1022 // 0 8 12 16 20 32 36 40 47 | 1034 // 0 8 12 16 20 32 36 40 47 |
1023 #define RXF_FORM_EMIT(name, op) \ | 1035 #define RXF_FORM_EMIT(name, op) \ |
1024 void Assembler::name(Register r1, Register r3, Register b2, Register x2, \ | 1036 void Assembler::name(Register r1, Register r3, Register b2, Register x2, \ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 void Assembler::name(const MemOperand& opnd1, const MemOperand& opnd2, \ | 1130 void Assembler::name(const MemOperand& opnd1, const MemOperand& opnd2, \ |
1119 Length length) { \ | 1131 Length length) { \ |
1120 DCHECK(false); \ | 1132 DCHECK(false); \ |
1121 } | 1133 } |
1122 void Assembler::ss_form(Opcode op, Length l1, const Operand& i3, Register b1, | 1134 void Assembler::ss_form(Opcode op, Length l1, const Operand& i3, Register b1, |
1123 Disp d1, Register b2, Disp d2) { | 1135 Disp d1, Register b2, Disp d2) { |
1124 DCHECK(is_uint12(d2)); | 1136 DCHECK(is_uint12(d2)); |
1125 DCHECK(is_uint12(d1)); | 1137 DCHECK(is_uint12(d1)); |
1126 DCHECK(is_uint8(op)); | 1138 DCHECK(is_uint8(op)); |
1127 DCHECK(is_uint4(l1)); | 1139 DCHECK(is_uint4(l1)); |
1128 DCHECK(is_uint4(i3.imm_)); | 1140 DCHECK(is_uint4(i3.immediate())); |
1129 uint64_t code = | 1141 uint64_t code = |
1130 (static_cast<uint64_t>(op)) * B40 | (static_cast<uint64_t>(l1)) * B36 | | 1142 (static_cast<uint64_t>(op)) * B40 | (static_cast<uint64_t>(l1)) * B36 | |
1131 (static_cast<uint64_t>(i3.imm_)) * B32 | | 1143 (static_cast<uint64_t>(i3.immediate())) * B32 | |
1132 (static_cast<uint64_t>(b1.code())) * B28 | | 1144 (static_cast<uint64_t>(b1.code())) * B28 | |
1133 (static_cast<uint64_t>(d1)) * B16 | | 1145 (static_cast<uint64_t>(d1)) * B16 | |
1134 (static_cast<uint64_t>(b2.code())) * B12 | (static_cast<uint64_t>(d2)); | 1146 (static_cast<uint64_t>(b2.code())) * B12 | (static_cast<uint64_t>(d2)); |
1135 emit6bytes(code); | 1147 emit6bytes(code); |
1136 } | 1148 } |
1137 | 1149 |
1138 // SS4 format: <insn> D1(R1,B1), D2(R3,B2) | 1150 // SS4 format: <insn> D1(R1,B1), D2(R3,B2) |
1139 // +--------+----+----+----+-------------+----+------------+ | 1151 // +--------+----+----+----+-------------+----+------------+ |
1140 // | OpCode | R1 | R3 | B1 | D1 | B2 | D2 | | 1152 // | OpCode | R1 | R3 | B1 | D1 | B2 | D2 | |
1141 // +--------+----+----+----+-------------+----+------------+ | 1153 // +--------+----+----+----+-------------+----+------------+ |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 | 1431 |
1420 // ------------------------------- | 1432 // ------------------------------- |
1421 // Rotate and Insert Selected Bits | 1433 // Rotate and Insert Selected Bits |
1422 // ------------------------------- | 1434 // ------------------------------- |
1423 // Rotate-And-Insert-Selected-Bits | 1435 // Rotate-And-Insert-Selected-Bits |
1424 void Assembler::risbg(Register dst, Register src, const Operand& startBit, | 1436 void Assembler::risbg(Register dst, Register src, const Operand& startBit, |
1425 const Operand& endBit, const Operand& shiftAmt, | 1437 const Operand& endBit, const Operand& shiftAmt, |
1426 bool zeroBits) { | 1438 bool zeroBits) { |
1427 // High tag the top bit of I4/EndBit to zero out any unselected bits | 1439 // High tag the top bit of I4/EndBit to zero out any unselected bits |
1428 if (zeroBits) | 1440 if (zeroBits) |
1429 rie_f_form(RISBG, dst, src, startBit, Operand(endBit.imm_ | 0x80), | 1441 rie_f_form(RISBG, dst, src, startBit, Operand(endBit.immediate() | 0x80), |
1430 shiftAmt); | 1442 shiftAmt); |
1431 else | 1443 else |
1432 rie_f_form(RISBG, dst, src, startBit, endBit, shiftAmt); | 1444 rie_f_form(RISBG, dst, src, startBit, endBit, shiftAmt); |
1433 } | 1445 } |
1434 | 1446 |
1435 // Rotate-And-Insert-Selected-Bits | 1447 // Rotate-And-Insert-Selected-Bits |
1436 void Assembler::risbgn(Register dst, Register src, const Operand& startBit, | 1448 void Assembler::risbgn(Register dst, Register src, const Operand& startBit, |
1437 const Operand& endBit, const Operand& shiftAmt, | 1449 const Operand& endBit, const Operand& shiftAmt, |
1438 bool zeroBits) { | 1450 bool zeroBits) { |
1439 // High tag the top bit of I4/EndBit to zero out any unselected bits | 1451 // High tag the top bit of I4/EndBit to zero out any unselected bits |
1440 if (zeroBits) | 1452 if (zeroBits) |
1441 rie_f_form(RISBGN, dst, src, startBit, Operand(endBit.imm_ | 0x80), | 1453 rie_f_form(RISBGN, dst, src, startBit, Operand(endBit.immediate() | 0x80), |
1442 shiftAmt); | 1454 shiftAmt); |
1443 else | 1455 else |
1444 rie_f_form(RISBGN, dst, src, startBit, endBit, shiftAmt); | 1456 rie_f_form(RISBGN, dst, src, startBit, endBit, shiftAmt); |
1445 } | 1457 } |
1446 | 1458 |
1447 // --------------------------- | 1459 // --------------------------- |
1448 // Move Character Instructions | 1460 // Move Character Instructions |
1449 // --------------------------- | 1461 // --------------------------- |
1450 // Move charactor - mem to mem operation | 1462 // Move charactor - mem to mem operation |
1451 void Assembler::mvc(const MemOperand& opnd1, const MemOperand& opnd2, | 1463 void Assembler::mvc(const MemOperand& opnd1, const MemOperand& opnd2, |
(...skipping 13 matching lines...) Expand all Loading... |
1465 rie_form(AHIK, r1, r3, i2); | 1477 rie_form(AHIK, r1, r3, i2); |
1466 } | 1478 } |
1467 | 1479 |
1468 // Add Register-Register-Register (32) | 1480 // Add Register-Register-Register (32) |
1469 void Assembler::ark(Register r1, Register r2, Register r3) { | 1481 void Assembler::ark(Register r1, Register r2, Register r3) { |
1470 rrf1_form(ARK, r1, r2, r3); | 1482 rrf1_form(ARK, r1, r2, r3); |
1471 } | 1483 } |
1472 | 1484 |
1473 // Add Storage-Imm (32) | 1485 // Add Storage-Imm (32) |
1474 void Assembler::asi(const MemOperand& opnd, const Operand& imm) { | 1486 void Assembler::asi(const MemOperand& opnd, const Operand& imm) { |
1475 DCHECK(is_int8(imm.imm_)); | 1487 DCHECK(is_int8(imm.immediate())); |
1476 DCHECK(is_int20(opnd.offset())); | 1488 DCHECK(is_int20(opnd.offset())); |
1477 siy_form(ASI, Operand(0xff & imm.imm_), opnd.rb(), 0xfffff & opnd.offset()); | 1489 siy_form(ASI, Operand(0xff & imm.immediate()), opnd.rb(), |
| 1490 0xfffff & opnd.offset()); |
1478 } | 1491 } |
1479 | 1492 |
1480 // ----------------------- | 1493 // ----------------------- |
1481 // 64-bit Add Instructions | 1494 // 64-bit Add Instructions |
1482 // ----------------------- | 1495 // ----------------------- |
1483 // Add Halfword Immediate (64) | 1496 // Add Halfword Immediate (64) |
1484 void Assembler::aghi(Register r1, const Operand& i2) { ri_form(AGHI, r1, i2); } | 1497 void Assembler::aghi(Register r1, const Operand& i2) { ri_form(AGHI, r1, i2); } |
1485 | 1498 |
1486 // Add Halfword Immediate (64) | 1499 // Add Halfword Immediate (64) |
1487 void Assembler::aghik(Register r1, Register r3, const Operand& i2) { | 1500 void Assembler::aghik(Register r1, Register r3, const Operand& i2) { |
1488 rie_form(AGHIK, r1, r3, i2); | 1501 rie_form(AGHIK, r1, r3, i2); |
1489 } | 1502 } |
1490 | 1503 |
1491 // Add Register-Register-Register (64) | 1504 // Add Register-Register-Register (64) |
1492 void Assembler::agrk(Register r1, Register r2, Register r3) { | 1505 void Assembler::agrk(Register r1, Register r2, Register r3) { |
1493 rrf1_form(AGRK, r1, r2, r3); | 1506 rrf1_form(AGRK, r1, r2, r3); |
1494 } | 1507 } |
1495 | 1508 |
1496 // Add Storage-Imm (64) | 1509 // Add Storage-Imm (64) |
1497 void Assembler::agsi(const MemOperand& opnd, const Operand& imm) { | 1510 void Assembler::agsi(const MemOperand& opnd, const Operand& imm) { |
1498 DCHECK(is_int8(imm.imm_)); | 1511 DCHECK(is_int8(imm.immediate())); |
1499 DCHECK(is_int20(opnd.offset())); | 1512 DCHECK(is_int20(opnd.offset())); |
1500 siy_form(AGSI, Operand(0xff & imm.imm_), opnd.rb(), 0xfffff & opnd.offset()); | 1513 siy_form(AGSI, Operand(0xff & imm.immediate()), opnd.rb(), |
| 1514 0xfffff & opnd.offset()); |
1501 } | 1515 } |
1502 | 1516 |
1503 // ------------------------------- | 1517 // ------------------------------- |
1504 // 32-bit Add Logical Instructions | 1518 // 32-bit Add Logical Instructions |
1505 // ------------------------------- | 1519 // ------------------------------- |
1506 // Add Logical Register-Register-Register (32) | 1520 // Add Logical Register-Register-Register (32) |
1507 void Assembler::alrk(Register r1, Register r2, Register r3) { | 1521 void Assembler::alrk(Register r1, Register r2, Register r3) { |
1508 rrf1_form(ALRK, r1, r2, r3); | 1522 rrf1_form(ALRK, r1, r2, r3); |
1509 } | 1523 } |
1510 | 1524 |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 SKIP_ICACHE_FLUSH); | 2222 SKIP_ICACHE_FLUSH); |
2209 } | 2223 } |
2210 | 2224 |
2211 reloc_info_writer.Write(&rinfo); | 2225 reloc_info_writer.Write(&rinfo); |
2212 } | 2226 } |
2213 } | 2227 } |
2214 | 2228 |
2215 } // namespace internal | 2229 } // namespace internal |
2216 } // namespace v8 | 2230 } // namespace v8 |
2217 #endif // V8_TARGET_ARCH_S390 | 2231 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |