| 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 12 matching lines...) Expand all Loading... |
| 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 // The original source code covered by the above license above has been | 31 // The original source code covered by the above license above has been |
| 32 // modified significantly by Google Inc. | 32 // modified significantly by Google Inc. |
| 33 // Copyright 2010 the V8 project authors. All rights reserved. | 33 // Copyright 2011 the V8 project authors. All rights reserved. |
| 34 | 34 |
| 35 // A lightweight X64 Assembler. | 35 // A lightweight X64 Assembler. |
| 36 | 36 |
| 37 #ifndef V8_X64_ASSEMBLER_X64_H_ | 37 #ifndef V8_X64_ASSEMBLER_X64_H_ |
| 38 #define V8_X64_ASSEMBLER_X64_H_ | 38 #define V8_X64_ASSEMBLER_X64_H_ |
| 39 | 39 |
| 40 #include "serialize.h" | 40 #include "serialize.h" |
| 41 | 41 |
| 42 namespace v8 { | 42 namespace v8 { |
| 43 namespace internal { | 43 namespace internal { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // mode. This way we get the compile-time error checking in debug mode | 86 // mode. This way we get the compile-time error checking in debug mode |
| 87 // and best performance in optimized code. | 87 // and best performance in optimized code. |
| 88 // | 88 // |
| 89 | 89 |
| 90 struct Register { | 90 struct Register { |
| 91 // The non-allocatable registers are: | 91 // The non-allocatable registers are: |
| 92 // rsp - stack pointer | 92 // rsp - stack pointer |
| 93 // rbp - frame pointer | 93 // rbp - frame pointer |
| 94 // rsi - context register | 94 // rsi - context register |
| 95 // r10 - fixed scratch register | 95 // r10 - fixed scratch register |
| 96 // r12 - smi constant register |
| 96 // r13 - root register | 97 // r13 - root register |
| 97 // r15 - smi constant register | |
| 98 static const int kNumRegisters = 16; | 98 static const int kNumRegisters = 16; |
| 99 static const int kNumAllocatableRegisters = 10; | 99 static const int kNumAllocatableRegisters = 10; |
| 100 | 100 |
| 101 static int ToAllocationIndex(Register reg) { | 101 static int ToAllocationIndex(Register reg) { |
| 102 return allocationIndexByRegisterCode[reg.code()]; | 102 return kAllocationIndexByRegisterCode[reg.code()]; |
| 103 } | 103 } |
| 104 | 104 |
| 105 static Register FromAllocationIndex(int index) { | 105 static Register FromAllocationIndex(int index) { |
| 106 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 106 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 107 Register result = { registerCodeByAllocationIndex[index] }; | 107 Register result = { kRegisterCodeByAllocationIndex[index] }; |
| 108 return result; | 108 return result; |
| 109 } | 109 } |
| 110 | 110 |
| 111 static const char* AllocationIndexToString(int index) { | 111 static const char* AllocationIndexToString(int index) { |
| 112 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 112 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 113 const char* const names[] = { | 113 const char* const names[] = { |
| 114 "rax", | 114 "rax", |
| 115 "rbx", | 115 "rbx", |
| 116 "rdx", | 116 "rdx", |
| 117 "rcx", | 117 "rcx", |
| 118 "rdi", | 118 "rdi", |
| 119 "r8", | 119 "r8", |
| 120 "r9", | 120 "r9", |
| 121 "r11", | 121 "r11", |
| 122 "r14", | 122 "r14", |
| 123 "r12" | 123 "r15" |
| 124 }; | 124 }; |
| 125 return names[index]; | 125 return names[index]; |
| 126 } | 126 } |
| 127 | 127 |
| 128 static Register toRegister(int code) { | 128 static Register toRegister(int code) { |
| 129 Register r = { code }; | 129 Register r = { code }; |
| 130 return r; | 130 return r; |
| 131 } | 131 } |
| 132 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } | 132 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } |
| 133 bool is(Register reg) const { return code_ == reg.code_; } | 133 bool is(Register reg) const { return code_ == reg.code_; } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 148 // in modR/M, SIB, and opcode bytes. | 148 // in modR/M, SIB, and opcode bytes. |
| 149 int low_bits() const { | 149 int low_bits() const { |
| 150 return code_ & 0x7; | 150 return code_ & 0x7; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Unfortunately we can't make this private in a struct when initializing | 153 // Unfortunately we can't make this private in a struct when initializing |
| 154 // by assignment. | 154 // by assignment. |
| 155 int code_; | 155 int code_; |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 static const int registerCodeByAllocationIndex[kNumAllocatableRegisters]; | 158 static const int kRegisterCodeByAllocationIndex[kNumAllocatableRegisters]; |
| 159 static const int allocationIndexByRegisterCode[kNumRegisters]; | 159 static const int kAllocationIndexByRegisterCode[kNumRegisters]; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 const Register rax = { 0 }; | 162 const Register rax = { 0 }; |
| 163 const Register rcx = { 1 }; | 163 const Register rcx = { 1 }; |
| 164 const Register rdx = { 2 }; | 164 const Register rdx = { 2 }; |
| 165 const Register rbx = { 3 }; | 165 const Register rbx = { 3 }; |
| 166 const Register rsp = { 4 }; | 166 const Register rsp = { 4 }; |
| 167 const Register rbp = { 5 }; | 167 const Register rbp = { 5 }; |
| 168 const Register rsi = { 6 }; | 168 const Register rsi = { 6 }; |
| 169 const Register rdi = { 7 }; | 169 const Register rdi = { 7 }; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 // Offset from existing memory operand. | 395 // Offset from existing memory operand. |
| 396 // Offset is added to existing displacement as 32-bit signed values and | 396 // Offset is added to existing displacement as 32-bit signed values and |
| 397 // this must not overflow. | 397 // this must not overflow. |
| 398 Operand(const Operand& base, int32_t offset); | 398 Operand(const Operand& base, int32_t offset); |
| 399 | 399 |
| 400 // Checks whether either base or index register is the given register. | 400 // Checks whether either base or index register is the given register. |
| 401 // Does not check the "reg" part of the Operand. | 401 // Does not check the "reg" part of the Operand. |
| 402 bool AddressUsesRegister(Register reg) const; | 402 bool AddressUsesRegister(Register reg) const; |
| 403 | 403 |
| 404 // Queries related to the size of the generated instruction. |
| 405 // Whether the generated instruction will have a REX prefix. |
| 406 bool requires_rex() const { return rex_ != 0; } |
| 407 // Size of the ModR/M, SIB and displacement parts of the generated |
| 408 // instruction. |
| 409 int operand_size() const { return len_; } |
| 410 |
| 404 private: | 411 private: |
| 405 byte rex_; | 412 byte rex_; |
| 406 byte buf_[6]; | 413 byte buf_[6]; |
| 407 // The number of bytes of buf_ in use. | 414 // The number of bytes of buf_ in use. |
| 408 byte len_; | 415 byte len_; |
| 409 | 416 |
| 410 // Set the ModR/M byte without an encoded 'reg' register. The | 417 // Set the ModR/M byte without an encoded 'reg' register. The |
| 411 // register is encoded later as part of the emit_operand operation. | 418 // register is encoded later as part of the emit_operand operation. |
| 412 // set_modrm can be called before or after set_sib and set_disp*. | 419 // set_modrm can be called before or after set_sib and set_disp*. |
| 413 inline void set_modrm(int mod, Register rm); | 420 inline void set_modrm(int mod, Register rm); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // buffer, and buffer_size determines the initial buffer size. The buffer is | 510 // buffer, and buffer_size determines the initial buffer size. The buffer is |
| 504 // owned by the assembler and deallocated upon destruction of the assembler. | 511 // owned by the assembler and deallocated upon destruction of the assembler. |
| 505 // | 512 // |
| 506 // If the provided buffer is not NULL, the assembler uses the provided buffer | 513 // If the provided buffer is not NULL, the assembler uses the provided buffer |
| 507 // for code generation and assumes its size to be buffer_size. If the buffer | 514 // for code generation and assumes its size to be buffer_size. If the buffer |
| 508 // is too small, a fatal error occurs. No deallocation of the buffer is done | 515 // is too small, a fatal error occurs. No deallocation of the buffer is done |
| 509 // upon destruction of the assembler. | 516 // upon destruction of the assembler. |
| 510 Assembler(void* buffer, int buffer_size); | 517 Assembler(void* buffer, int buffer_size); |
| 511 ~Assembler(); | 518 ~Assembler(); |
| 512 | 519 |
| 520 // Overrides the default provided by FLAG_debug_code. |
| 521 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } |
| 522 |
| 513 // GetCode emits any pending (non-emitted) code and fills the descriptor | 523 // GetCode emits any pending (non-emitted) code and fills the descriptor |
| 514 // desc. GetCode() is idempotent; it returns the same result if no other | 524 // desc. GetCode() is idempotent; it returns the same result if no other |
| 515 // Assembler functions are invoked in between GetCode() calls. | 525 // Assembler functions are invoked in between GetCode() calls. |
| 516 void GetCode(CodeDesc* desc); | 526 void GetCode(CodeDesc* desc); |
| 517 | 527 |
| 518 // Read/Modify the code target in the relative branch/call instruction at pc. | 528 // Read/Modify the code target in the relative branch/call instruction at pc. |
| 519 // On the x64 architecture, we use relative jumps with a 32-bit displacement | 529 // On the x64 architecture, we use relative jumps with a 32-bit displacement |
| 520 // to jump to other Code objects in the Code space in the heap. | 530 // to jump to other Code objects in the Code space in the heap. |
| 521 // Jumps to C functions are done indirectly through a 64-bit register holding | 531 // Jumps to C functions are done indirectly through a 64-bit register holding |
| 522 // the absolute address of the target. | 532 // the absolute address of the target. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 void movq(Register dst, const Operand& src); | 658 void movq(Register dst, const Operand& src); |
| 649 void movq(Register dst, Register src); | 659 void movq(Register dst, Register src); |
| 650 // Sign extends immediate 32-bit value to 64 bits. | 660 // Sign extends immediate 32-bit value to 64 bits. |
| 651 void movq(Register dst, Immediate x); | 661 void movq(Register dst, Immediate x); |
| 652 // Move the offset of the label location relative to the current | 662 // Move the offset of the label location relative to the current |
| 653 // position (after the move) to the destination. | 663 // position (after the move) to the destination. |
| 654 void movl(const Operand& dst, Label* src); | 664 void movl(const Operand& dst, Label* src); |
| 655 | 665 |
| 656 // Move sign extended immediate to memory location. | 666 // Move sign extended immediate to memory location. |
| 657 void movq(const Operand& dst, Immediate value); | 667 void movq(const Operand& dst, Immediate value); |
| 658 // New x64 instructions to load a 64-bit immediate into a register. | 668 // Instructions to load a 64-bit immediate into a register. |
| 659 // All 64-bit immediates must have a relocation mode. | 669 // All 64-bit immediates must have a relocation mode. |
| 660 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); | 670 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); |
| 661 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); | 671 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); |
| 662 void movq(Register dst, const char* s, RelocInfo::Mode rmode); | 672 void movq(Register dst, const char* s, RelocInfo::Mode rmode); |
| 663 // Moves the address of the external reference into the register. | 673 // Moves the address of the external reference into the register. |
| 664 void movq(Register dst, ExternalReference ext); | 674 void movq(Register dst, ExternalReference ext); |
| 665 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); | 675 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); |
| 666 | 676 |
| 667 void movsxbq(Register dst, const Operand& src); | 677 void movsxbq(Register dst, const Operand& src); |
| 668 void movsxwq(Register dst, const Operand& src); | 678 void movsxwq(Register dst, const Operand& src); |
| 669 void movsxlq(Register dst, Register src); | 679 void movsxlq(Register dst, Register src); |
| 670 void movsxlq(Register dst, const Operand& src); | 680 void movsxlq(Register dst, const Operand& src); |
| 671 void movzxbq(Register dst, const Operand& src); | 681 void movzxbq(Register dst, const Operand& src); |
| 672 void movzxbl(Register dst, const Operand& src); | 682 void movzxbl(Register dst, const Operand& src); |
| 673 void movzxwq(Register dst, const Operand& src); | 683 void movzxwq(Register dst, const Operand& src); |
| 674 void movzxwl(Register dst, const Operand& src); | 684 void movzxwl(Register dst, const Operand& src); |
| 675 | 685 |
| 676 // Repeated moves. | 686 // Repeated moves. |
| 677 | 687 |
| 678 void repmovsb(); | 688 void repmovsb(); |
| 679 void repmovsw(); | 689 void repmovsw(); |
| 680 void repmovsl(); | 690 void repmovsl(); |
| 681 void repmovsq(); | 691 void repmovsq(); |
| 682 | 692 |
| 683 // New x64 instruction to load from an immediate 64-bit pointer into RAX. | 693 // Instruction to load from an immediate 64-bit pointer into RAX. |
| 684 void load_rax(void* ptr, RelocInfo::Mode rmode); | 694 void load_rax(void* ptr, RelocInfo::Mode rmode); |
| 685 void load_rax(ExternalReference ext); | 695 void load_rax(ExternalReference ext); |
| 686 | 696 |
| 687 // Conditional moves. | 697 // Conditional moves. |
| 688 void cmovq(Condition cc, Register dst, Register src); | 698 void cmovq(Condition cc, Register dst, Register src); |
| 689 void cmovq(Condition cc, Register dst, const Operand& src); | 699 void cmovq(Condition cc, Register dst, const Operand& src); |
| 690 void cmovl(Condition cc, Register dst, Register src); | 700 void cmovl(Condition cc, Register dst, Register src); |
| 691 void cmovl(Condition cc, Register dst, const Operand& src); | 701 void cmovl(Condition cc, Register dst, const Operand& src); |
| 692 | 702 |
| 693 // Exchange two registers | 703 // Exchange two registers |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 void cvtsd2ss(XMMRegister dst, XMMRegister src); | 1293 void cvtsd2ss(XMMRegister dst, XMMRegister src); |
| 1284 | 1294 |
| 1285 void cvtsd2si(Register dst, XMMRegister src); | 1295 void cvtsd2si(Register dst, XMMRegister src); |
| 1286 void cvtsd2siq(Register dst, XMMRegister src); | 1296 void cvtsd2siq(Register dst, XMMRegister src); |
| 1287 | 1297 |
| 1288 void addsd(XMMRegister dst, XMMRegister src); | 1298 void addsd(XMMRegister dst, XMMRegister src); |
| 1289 void subsd(XMMRegister dst, XMMRegister src); | 1299 void subsd(XMMRegister dst, XMMRegister src); |
| 1290 void mulsd(XMMRegister dst, XMMRegister src); | 1300 void mulsd(XMMRegister dst, XMMRegister src); |
| 1291 void divsd(XMMRegister dst, XMMRegister src); | 1301 void divsd(XMMRegister dst, XMMRegister src); |
| 1292 | 1302 |
| 1303 void andpd(XMMRegister dst, XMMRegister src); |
| 1304 void orpd(XMMRegister dst, XMMRegister src); |
| 1293 void xorpd(XMMRegister dst, XMMRegister src); | 1305 void xorpd(XMMRegister dst, XMMRegister src); |
| 1294 void sqrtsd(XMMRegister dst, XMMRegister src); | 1306 void sqrtsd(XMMRegister dst, XMMRegister src); |
| 1295 | 1307 |
| 1296 void ucomisd(XMMRegister dst, XMMRegister src); | 1308 void ucomisd(XMMRegister dst, XMMRegister src); |
| 1297 void ucomisd(XMMRegister dst, const Operand& src); | 1309 void ucomisd(XMMRegister dst, const Operand& src); |
| 1298 | 1310 |
| 1299 void movmskpd(Register dst, XMMRegister src); | 1311 void movmskpd(Register dst, XMMRegister src); |
| 1300 | 1312 |
| 1301 // The first argument is the reg field, the second argument is the r/m field. | 1313 // The first argument is the reg field, the second argument is the r/m field. |
| 1302 void emit_sse_operand(XMMRegister dst, XMMRegister src); | 1314 void emit_sse_operand(XMMRegister dst, XMMRegister src); |
| 1303 void emit_sse_operand(XMMRegister reg, const Operand& adr); | 1315 void emit_sse_operand(XMMRegister reg, const Operand& adr); |
| 1304 void emit_sse_operand(XMMRegister dst, Register src); | 1316 void emit_sse_operand(XMMRegister dst, Register src); |
| 1305 void emit_sse_operand(Register dst, XMMRegister src); | 1317 void emit_sse_operand(Register dst, XMMRegister src); |
| 1306 | 1318 |
| 1307 // Debugging | 1319 // Debugging |
| 1308 void Print(); | 1320 void Print(); |
| 1309 | 1321 |
| 1310 // Check the code size generated from label to here. | 1322 // Check the code size generated from label to here. |
| 1311 int SizeOfCodeGeneratedSince(Label* l) { return pc_offset() - l->pos(); } | 1323 int SizeOfCodeGeneratedSince(Label* l) { return pc_offset() - l->pos(); } |
| 1312 | 1324 |
| 1313 // Mark address of the ExitJSFrame code. | 1325 // Mark address of the ExitJSFrame code. |
| 1314 void RecordJSReturn(); | 1326 void RecordJSReturn(); |
| 1315 | 1327 |
| 1316 // Mark address of a debug break slot. | 1328 // Mark address of a debug break slot. |
| 1317 void RecordDebugBreakSlot(); | 1329 void RecordDebugBreakSlot(); |
| 1318 | 1330 |
| 1319 // Record a comment relocation entry that can be used by a disassembler. | 1331 // Record a comment relocation entry that can be used by a disassembler. |
| 1320 // Use --code-comments to enable. | 1332 // Use --code-comments to enable. |
| 1321 void RecordComment(const char* msg); | 1333 void RecordComment(const char* msg, bool force = false); |
| 1322 | 1334 |
| 1323 // Writes a single word of data in the code stream. | 1335 // Writes a single word of data in the code stream. |
| 1324 // Used for inline tables, e.g., jump-tables. | 1336 // Used for inline tables, e.g., jump-tables. |
| 1325 void db(uint8_t data); | 1337 void db(uint8_t data); |
| 1326 void dd(uint32_t data); | 1338 void dd(uint32_t data); |
| 1327 | 1339 |
| 1328 int pc_offset() const { return static_cast<int>(pc_ - buffer_); } | 1340 int pc_offset() const { return static_cast<int>(pc_ - buffer_); } |
| 1329 | 1341 |
| 1330 PositionsRecorder* positions_recorder() { return &positions_recorder_; } | 1342 PositionsRecorder* positions_recorder() { return &positions_recorder_; } |
| 1331 | 1343 |
| 1332 // Check if there is less than kGap bytes available in the buffer. | 1344 // Check if there is less than kGap bytes available in the buffer. |
| 1333 // If this is the case, we need to grow the buffer before emitting | 1345 // If this is the case, we need to grow the buffer before emitting |
| 1334 // an instruction or relocation information. | 1346 // an instruction or relocation information. |
| 1335 inline bool buffer_overflow() const { | 1347 inline bool buffer_overflow() const { |
| 1336 return pc_ >= reloc_info_writer.pos() - kGap; | 1348 return pc_ >= reloc_info_writer.pos() - kGap; |
| 1337 } | 1349 } |
| 1338 | 1350 |
| 1339 // Get the number of bytes available in the buffer. | 1351 // Get the number of bytes available in the buffer. |
| 1340 inline int available_space() const { | 1352 inline int available_space() const { |
| 1341 return static_cast<int>(reloc_info_writer.pos() - pc_); | 1353 return static_cast<int>(reloc_info_writer.pos() - pc_); |
| 1342 } | 1354 } |
| 1343 | 1355 |
| 1344 static bool IsNop(Address addr) { return *addr == 0x90; } | 1356 static bool IsNop(Address addr) { return *addr == 0x90; } |
| 1345 | 1357 |
| 1346 // Avoid overflows for displacements etc. | 1358 // Avoid overflows for displacements etc. |
| 1347 static const int kMaximalBufferSize = 512*MB; | 1359 static const int kMaximalBufferSize = 512*MB; |
| 1348 static const int kMinimalBufferSize = 4*KB; | 1360 static const int kMinimalBufferSize = 4*KB; |
| 1349 | 1361 |
| 1362 protected: |
| 1363 bool emit_debug_code() const { return emit_debug_code_; } |
| 1364 |
| 1350 private: | 1365 private: |
| 1351 byte* addr_at(int pos) { return buffer_ + pos; } | 1366 byte* addr_at(int pos) { return buffer_ + pos; } |
| 1352 byte byte_at(int pos) { return buffer_[pos]; } | 1367 byte byte_at(int pos) { return buffer_[pos]; } |
| 1353 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } | 1368 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } |
| 1354 uint32_t long_at(int pos) { | 1369 uint32_t long_at(int pos) { |
| 1355 return *reinterpret_cast<uint32_t*>(addr_at(pos)); | 1370 return *reinterpret_cast<uint32_t*>(addr_at(pos)); |
| 1356 } | 1371 } |
| 1357 void long_at_put(int pos, uint32_t x) { | 1372 void long_at_put(int pos, uint32_t x) { |
| 1358 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; | 1373 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; |
| 1359 } | 1374 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 | 1560 |
| 1546 // code generation | 1561 // code generation |
| 1547 byte* pc_; // the program counter; moves forward | 1562 byte* pc_; // the program counter; moves forward |
| 1548 RelocInfoWriter reloc_info_writer; | 1563 RelocInfoWriter reloc_info_writer; |
| 1549 | 1564 |
| 1550 List< Handle<Code> > code_targets_; | 1565 List< Handle<Code> > code_targets_; |
| 1551 // push-pop elimination | 1566 // push-pop elimination |
| 1552 byte* last_pc_; | 1567 byte* last_pc_; |
| 1553 | 1568 |
| 1554 PositionsRecorder positions_recorder_; | 1569 PositionsRecorder positions_recorder_; |
| 1570 |
| 1571 bool emit_debug_code_; |
| 1572 |
| 1555 friend class PositionsRecorder; | 1573 friend class PositionsRecorder; |
| 1556 }; | 1574 }; |
| 1557 | 1575 |
| 1558 | 1576 |
| 1559 // Helper class that ensures that there is enough space for generating | 1577 // Helper class that ensures that there is enough space for generating |
| 1560 // instructions and relocation information. The constructor makes | 1578 // instructions and relocation information. The constructor makes |
| 1561 // sure that there is enough space and (in debug mode) the destructor | 1579 // sure that there is enough space and (in debug mode) the destructor |
| 1562 // checks that we did not generate too much. | 1580 // checks that we did not generate too much. |
| 1563 class EnsureSpace BASE_EMBEDDED { | 1581 class EnsureSpace BASE_EMBEDDED { |
| 1564 public: | 1582 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1579 private: | 1597 private: |
| 1580 Assembler* assembler_; | 1598 Assembler* assembler_; |
| 1581 #ifdef DEBUG | 1599 #ifdef DEBUG |
| 1582 int space_before_; | 1600 int space_before_; |
| 1583 #endif | 1601 #endif |
| 1584 }; | 1602 }; |
| 1585 | 1603 |
| 1586 } } // namespace v8::internal | 1604 } } // namespace v8::internal |
| 1587 | 1605 |
| 1588 #endif // V8_X64_ASSEMBLER_X64_H_ | 1606 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |