Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: src/assembler-ia32.h

Issue 14886: Bring toiger up to date with bleeding edge 984. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/assembler-arm.h ('k') | src/assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Machine instruction Immediates 187 // Machine instruction Immediates
188 188
189 class Immediate BASE_EMBEDDED { 189 class Immediate BASE_EMBEDDED {
190 public: 190 public:
191 inline explicit Immediate(int x); 191 inline explicit Immediate(int x);
192 inline explicit Immediate(const char* s); 192 inline explicit Immediate(const char* s);
193 inline explicit Immediate(const ExternalReference& ext); 193 inline explicit Immediate(const ExternalReference& ext);
194 inline explicit Immediate(Handle<Object> handle); 194 inline explicit Immediate(Handle<Object> handle);
195 inline explicit Immediate(Smi* value); 195 inline explicit Immediate(Smi* value);
196 196
197 static Immediate CodeRelativeOffset(Label* label) {
198 return Immediate(label);
199 }
200
197 bool is_zero() const { return x_ == 0 && rmode_ == RelocInfo::NONE; } 201 bool is_zero() const { return x_ == 0 && rmode_ == RelocInfo::NONE; }
198 bool is_int8() const { 202 bool is_int8() const {
199 return -128 <= x_ && x_ < 128 && rmode_ == RelocInfo::NONE; 203 return -128 <= x_ && x_ < 128 && rmode_ == RelocInfo::NONE;
200 } 204 }
201 bool is_int16() const { 205 bool is_int16() const {
202 return -32768 <= x_ && x_ < 32768 && rmode_ == RelocInfo::NONE; 206 return -32768 <= x_ && x_ < 32768 && rmode_ == RelocInfo::NONE;
203 } 207 }
204 208
205 private: 209 private:
210 inline explicit Immediate(Label* value);
211
206 int x_; 212 int x_;
207 RelocInfo::Mode rmode_; 213 RelocInfo::Mode rmode_;
208 214
209 friend class Assembler; 215 friend class Assembler;
210 }; 216 };
211 217
212 218
213 // ----------------------------------------------------------------------------- 219 // -----------------------------------------------------------------------------
214 // Machine instruction Operands 220 // Machine instruction Operands
215 221
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 505
500 void add(Register dst, const Operand& src); 506 void add(Register dst, const Operand& src);
501 void add(const Operand& dst, const Immediate& x); 507 void add(const Operand& dst, const Immediate& x);
502 508
503 void and_(Register dst, int32_t imm32); 509 void and_(Register dst, int32_t imm32);
504 void and_(Register dst, const Operand& src); 510 void and_(Register dst, const Operand& src);
505 void and_(const Operand& src, Register dst); 511 void and_(const Operand& src, Register dst);
506 void and_(const Operand& dst, const Immediate& x); 512 void and_(const Operand& dst, const Immediate& x);
507 513
508 void cmpb(const Operand& op, int8_t imm8); 514 void cmpb(const Operand& op, int8_t imm8);
515 void cmpb_al(const Operand& op);
516 void cmpw_ax(const Operand& op);
509 void cmpw(const Operand& op, Immediate imm16); 517 void cmpw(const Operand& op, Immediate imm16);
510 void cmp(Register reg, int32_t imm32); 518 void cmp(Register reg, int32_t imm32);
511 void cmp(Register reg, Handle<Object> handle); 519 void cmp(Register reg, Handle<Object> handle);
512 void cmp(Register reg, const Operand& op); 520 void cmp(Register reg, const Operand& op);
513 void cmp(const Operand& op, const Immediate& imm); 521 void cmp(const Operand& op, const Immediate& imm);
514 522
515 void rep_cmpsb();
516 void rep_cmpsw();
517
518 void dec_b(Register dst); 523 void dec_b(Register dst);
519 524
520 void dec(Register dst); 525 void dec(Register dst);
521 void dec(const Operand& dst); 526 void dec(const Operand& dst);
522 527
523 void cdq(); 528 void cdq();
524 529
525 void idiv(Register src); 530 void idiv(Register src);
526 531
527 void imul(Register dst, const Operand& src); 532 void imul(Register dst, const Operand& src);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 738
734 protected: 739 protected:
735 void movsd(XMMRegister dst, const Operand& src); 740 void movsd(XMMRegister dst, const Operand& src);
736 void movsd(const Operand& dst, XMMRegister src); 741 void movsd(const Operand& dst, XMMRegister src);
737 742
738 void emit_sse_operand(XMMRegister reg, const Operand& adr); 743 void emit_sse_operand(XMMRegister reg, const Operand& adr);
739 void emit_sse_operand(XMMRegister dst, XMMRegister src); 744 void emit_sse_operand(XMMRegister dst, XMMRegister src);
740 745
741 746
742 private: 747 private:
743 // Code buffer:
744 // The buffer into which code and relocation info are generated.
745 byte* buffer_;
746 int buffer_size_;
747 // True if the assembler owns the buffer, false if buffer is external.
748 bool own_buffer_;
749
750 // code generation
751 byte* pc_; // the program counter; moves forward
752 RelocInfoWriter reloc_info_writer;
753
754 // push-pop elimination
755 byte* last_pc_;
756
757 // source position information
758 int last_position_;
759 int last_statement_position_;
760
761 byte* addr_at(int pos) { return buffer_ + pos; } 748 byte* addr_at(int pos) { return buffer_ + pos; }
762 byte byte_at(int pos) { return buffer_[pos]; } 749 byte byte_at(int pos) { return buffer_[pos]; }
763 uint32_t long_at(int pos) { 750 uint32_t long_at(int pos) {
764 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 751 return *reinterpret_cast<uint32_t*>(addr_at(pos));
765 } 752 }
766 void long_at_put(int pos, uint32_t x) { 753 void long_at_put(int pos, uint32_t x) {
767 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 754 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
768 } 755 }
769 756
770 // code emission 757 // code emission
771 void GrowBuffer(); 758 void GrowBuffer();
772 inline void emit(uint32_t x); 759 inline void emit(uint32_t x);
773 inline void emit(Handle<Object> handle); 760 inline void emit(Handle<Object> handle);
774 inline void emit(uint32_t x, RelocInfo::Mode rmode); 761 inline void emit(uint32_t x, RelocInfo::Mode rmode);
775 inline void emit(const Immediate& x); 762 inline void emit(const Immediate& x);
776 inline void emit_w(const Immediate& x); 763 inline void emit_w(const Immediate& x);
777 764
765 // Emit the code-object-relative offset of the label's position
766 inline void emit_code_relative_offset(Label* label);
767
778 // instruction generation 768 // instruction generation
779 void emit_arith_b(int op1, int op2, Register dst, int imm8); 769 void emit_arith_b(int op1, int op2, Register dst, int imm8);
780 770
781 // Emit a basic arithmetic instruction (i.e. first byte of the family is 0x81) 771 // Emit a basic arithmetic instruction (i.e. first byte of the family is 0x81)
782 // with a given destination expression and an immediate operand. It attempts 772 // with a given destination expression and an immediate operand. It attempts
783 // to use the shortest encoding possible. 773 // to use the shortest encoding possible.
784 // sel specifies the /n in the modrm byte (see the Intel PRM). 774 // sel specifies the /n in the modrm byte (see the Intel PRM).
785 void emit_arith(int sel, Operand dst, const Immediate& x); 775 void emit_arith(int sel, Operand dst, const Immediate& x);
786 776
787 void emit_operand(Register reg, const Operand& adr); 777 void emit_operand(Register reg, const Operand& adr);
788 778
789 void emit_farith(int b1, int b2, int i); 779 void emit_farith(int b1, int b2, int i);
790 780
791 // labels 781 // labels
792 void print(Label* L); 782 void print(Label* L);
793 void bind_to(Label* L, int pos); 783 void bind_to(Label* L, int pos);
794 void link_to(Label* L, Label* appendix); 784 void link_to(Label* L, Label* appendix);
795 785
796 // displacements 786 // displacements
797 inline Displacement disp_at(Label* L); 787 inline Displacement disp_at(Label* L);
798 inline void disp_at_put(Label* L, Displacement disp); 788 inline void disp_at_put(Label* L, Displacement disp);
799 inline void emit_disp(Label* L, Displacement::Type type); 789 inline void emit_disp(Label* L, Displacement::Type type);
800 790
801 // record reloc info for current pc_ 791 // record reloc info for current pc_
802 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); 792 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
803 793
804 friend class CodePatcher; 794 friend class CodePatcher;
805 friend class EnsureSpace; 795 friend class EnsureSpace;
796
797 // Code buffer:
798 // The buffer into which code and relocation info are generated.
799 byte* buffer_;
800 int buffer_size_;
801 // True if the assembler owns the buffer, false if buffer is external.
802 bool own_buffer_;
803
804 // code generation
805 byte* pc_; // the program counter; moves forward
806 RelocInfoWriter reloc_info_writer;
807
808 // push-pop elimination
809 byte* last_pc_;
810
811 // source position information
812 int last_position_;
813 int last_statement_position_;
806 }; 814 };
807 815
808 816
809 // Helper class that ensures that there is enough space for generating 817 // Helper class that ensures that there is enough space for generating
810 // instructions and relocation information. The constructor makes 818 // instructions and relocation information. The constructor makes
811 // sure that there is enough space and (in debug mode) the destructor 819 // sure that there is enough space and (in debug mode) the destructor
812 // checks that we did not generate too much. 820 // checks that we did not generate too much.
813 class EnsureSpace BASE_EMBEDDED { 821 class EnsureSpace BASE_EMBEDDED {
814 public: 822 public:
815 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { 823 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) {
(...skipping 13 matching lines...) Expand all
829 private: 837 private:
830 Assembler* assembler_; 838 Assembler* assembler_;
831 #ifdef DEBUG 839 #ifdef DEBUG
832 int space_before_; 840 int space_before_;
833 #endif 841 #endif
834 }; 842 };
835 843
836 } } // namespace v8::internal 844 } } // namespace v8::internal
837 845
838 #endif // V8_ASSEMBLER_IA32_H_ 846 #endif // V8_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/assembler-arm.h ('k') | src/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698