| 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 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // buffer, and buffer_size determines the initial buffer size. The buffer is | 531 // buffer, and buffer_size determines the initial buffer size. The buffer is |
| 532 // owned by the assembler and deallocated upon destruction of the assembler. | 532 // owned by the assembler and deallocated upon destruction of the assembler. |
| 533 // | 533 // |
| 534 // If the provided buffer is not NULL, the assembler uses the provided buffer | 534 // If the provided buffer is not NULL, the assembler uses the provided buffer |
| 535 // for code generation and assumes its size to be buffer_size. If the buffer | 535 // for code generation and assumes its size to be buffer_size. If the buffer |
| 536 // is too small, a fatal error occurs. No deallocation of the buffer is done | 536 // is too small, a fatal error occurs. No deallocation of the buffer is done |
| 537 // upon destruction of the assembler. | 537 // upon destruction of the assembler. |
| 538 Assembler(void* buffer, int buffer_size); | 538 Assembler(void* buffer, int buffer_size); |
| 539 ~Assembler(); | 539 ~Assembler(); |
| 540 | 540 |
| 541 // Overrides the default provided by FLAG_debug_code. |
| 542 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } |
| 543 |
| 541 // GetCode emits any pending (non-emitted) code and fills the descriptor | 544 // GetCode emits any pending (non-emitted) code and fills the descriptor |
| 542 // desc. GetCode() is idempotent; it returns the same result if no other | 545 // desc. GetCode() is idempotent; it returns the same result if no other |
| 543 // Assembler functions are invoked in between GetCode() calls. | 546 // Assembler functions are invoked in between GetCode() calls. |
| 544 void GetCode(CodeDesc* desc); | 547 void GetCode(CodeDesc* desc); |
| 545 | 548 |
| 546 // Read/Modify the code target in the branch/call instruction at pc. | 549 // Read/Modify the code target in the branch/call instruction at pc. |
| 547 inline static Address target_address_at(Address pc); | 550 inline static Address target_address_at(Address pc); |
| 548 inline static void set_target_address_at(Address pc, Address target); | 551 inline static void set_target_address_at(Address pc, Address target); |
| 549 | 552 |
| 550 // This sets the branch destination (which is in the instruction on x86). | 553 // This sets the branch destination (which is in the instruction on x86). |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 994 |
| 992 int relocation_writer_size() { | 995 int relocation_writer_size() { |
| 993 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 996 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
| 994 } | 997 } |
| 995 | 998 |
| 996 // Avoid overflows for displacements etc. | 999 // Avoid overflows for displacements etc. |
| 997 static const int kMaximalBufferSize = 512*MB; | 1000 static const int kMaximalBufferSize = 512*MB; |
| 998 static const int kMinimalBufferSize = 4*KB; | 1001 static const int kMinimalBufferSize = 4*KB; |
| 999 | 1002 |
| 1000 protected: | 1003 protected: |
| 1004 bool emit_debug_code() const { return emit_debug_code_; } |
| 1005 |
| 1001 void movsd(XMMRegister dst, const Operand& src); | 1006 void movsd(XMMRegister dst, const Operand& src); |
| 1002 void movsd(const Operand& dst, XMMRegister src); | 1007 void movsd(const Operand& dst, XMMRegister src); |
| 1003 | 1008 |
| 1004 void emit_sse_operand(XMMRegister reg, const Operand& adr); | 1009 void emit_sse_operand(XMMRegister reg, const Operand& adr); |
| 1005 void emit_sse_operand(XMMRegister dst, XMMRegister src); | 1010 void emit_sse_operand(XMMRegister dst, XMMRegister src); |
| 1006 void emit_sse_operand(Register dst, XMMRegister src); | 1011 void emit_sse_operand(Register dst, XMMRegister src); |
| 1007 | 1012 |
| 1008 byte* addr_at(int pos) { return buffer_ + pos; } | 1013 byte* addr_at(int pos) { return buffer_ + pos; } |
| 1009 private: | 1014 private: |
| 1010 byte byte_at(int pos) { return buffer_[pos]; } | 1015 byte byte_at(int pos) { return buffer_[pos]; } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 | 1069 |
| 1065 // code generation | 1070 // code generation |
| 1066 byte* pc_; // the program counter; moves forward | 1071 byte* pc_; // the program counter; moves forward |
| 1067 RelocInfoWriter reloc_info_writer; | 1072 RelocInfoWriter reloc_info_writer; |
| 1068 | 1073 |
| 1069 // push-pop elimination | 1074 // push-pop elimination |
| 1070 byte* last_pc_; | 1075 byte* last_pc_; |
| 1071 | 1076 |
| 1072 PositionsRecorder positions_recorder_; | 1077 PositionsRecorder positions_recorder_; |
| 1073 | 1078 |
| 1079 bool emit_debug_code_; |
| 1080 |
| 1074 friend class PositionsRecorder; | 1081 friend class PositionsRecorder; |
| 1075 }; | 1082 }; |
| 1076 | 1083 |
| 1077 | 1084 |
| 1078 // Helper class that ensures that there is enough space for generating | 1085 // Helper class that ensures that there is enough space for generating |
| 1079 // instructions and relocation information. The constructor makes | 1086 // instructions and relocation information. The constructor makes |
| 1080 // sure that there is enough space and (in debug mode) the destructor | 1087 // sure that there is enough space and (in debug mode) the destructor |
| 1081 // checks that we did not generate too much. | 1088 // checks that we did not generate too much. |
| 1082 class EnsureSpace BASE_EMBEDDED { | 1089 class EnsureSpace BASE_EMBEDDED { |
| 1083 public: | 1090 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1098 private: | 1105 private: |
| 1099 Assembler* assembler_; | 1106 Assembler* assembler_; |
| 1100 #ifdef DEBUG | 1107 #ifdef DEBUG |
| 1101 int space_before_; | 1108 int space_before_; |
| 1102 #endif | 1109 #endif |
| 1103 }; | 1110 }; |
| 1104 | 1111 |
| 1105 } } // namespace v8::internal | 1112 } } // namespace v8::internal |
| 1106 | 1113 |
| 1107 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1114 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
| OLD | NEW |