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

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

Issue 6677076: Merge up to bleeding_edge r7201 to isolates branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/isolates
Patch Set: Fix lint. Created 9 years, 9 months 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/version.cc ('k') | src/x64/assembler-x64.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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // buffer, and buffer_size determines the initial buffer size. The buffer is 522 // buffer, and buffer_size determines the initial buffer size. The buffer is
523 // owned by the assembler and deallocated upon destruction of the assembler. 523 // owned by the assembler and deallocated upon destruction of the assembler.
524 // 524 //
525 // If the provided buffer is not NULL, the assembler uses the provided buffer 525 // If the provided buffer is not NULL, the assembler uses the provided buffer
526 // for code generation and assumes its size to be buffer_size. If the buffer 526 // for code generation and assumes its size to be buffer_size. If the buffer
527 // is too small, a fatal error occurs. No deallocation of the buffer is done 527 // is too small, a fatal error occurs. No deallocation of the buffer is done
528 // upon destruction of the assembler. 528 // upon destruction of the assembler.
529 Assembler(void* buffer, int buffer_size); 529 Assembler(void* buffer, int buffer_size);
530 ~Assembler(); 530 ~Assembler();
531 531
532 // Overrides the default provided by FLAG_debug_code.
533 void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
534
532 // GetCode emits any pending (non-emitted) code and fills the descriptor 535 // GetCode emits any pending (non-emitted) code and fills the descriptor
533 // desc. GetCode() is idempotent; it returns the same result if no other 536 // desc. GetCode() is idempotent; it returns the same result if no other
534 // Assembler functions are invoked in between GetCode() calls. 537 // Assembler functions are invoked in between GetCode() calls.
535 void GetCode(CodeDesc* desc); 538 void GetCode(CodeDesc* desc);
536 539
537 // Read/Modify the code target in the relative branch/call instruction at pc. 540 // Read/Modify the code target in the relative branch/call instruction at pc.
538 // On the x64 architecture, we use relative jumps with a 32-bit displacement 541 // On the x64 architecture, we use relative jumps with a 32-bit displacement
539 // to jump to other Code objects in the Code space in the heap. 542 // to jump to other Code objects in the Code space in the heap.
540 // Jumps to C functions are done indirectly through a 64-bit register holding 543 // Jumps to C functions are done indirectly through a 64-bit register holding
541 // the absolute address of the target. 544 // the absolute address of the target.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 void movq(Register dst, const Operand& src); 670 void movq(Register dst, const Operand& src);
668 void movq(Register dst, Register src); 671 void movq(Register dst, Register src);
669 // Sign extends immediate 32-bit value to 64 bits. 672 // Sign extends immediate 32-bit value to 64 bits.
670 void movq(Register dst, Immediate x); 673 void movq(Register dst, Immediate x);
671 // Move the offset of the label location relative to the current 674 // Move the offset of the label location relative to the current
672 // position (after the move) to the destination. 675 // position (after the move) to the destination.
673 void movl(const Operand& dst, Label* src); 676 void movl(const Operand& dst, Label* src);
674 677
675 // Move sign extended immediate to memory location. 678 // Move sign extended immediate to memory location.
676 void movq(const Operand& dst, Immediate value); 679 void movq(const Operand& dst, Immediate value);
677 // New x64 instructions to load a 64-bit immediate into a register. 680 // Instructions to load a 64-bit immediate into a register.
678 // All 64-bit immediates must have a relocation mode. 681 // All 64-bit immediates must have a relocation mode.
679 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); 682 void movq(Register dst, void* ptr, RelocInfo::Mode rmode);
680 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); 683 void movq(Register dst, int64_t value, RelocInfo::Mode rmode);
681 void movq(Register dst, const char* s, RelocInfo::Mode rmode); 684 void movq(Register dst, const char* s, RelocInfo::Mode rmode);
682 // Moves the address of the external reference into the register. 685 // Moves the address of the external reference into the register.
683 void movq(Register dst, ExternalReference ext); 686 void movq(Register dst, ExternalReference ext);
684 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); 687 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode);
685 688
686 void movsxbq(Register dst, const Operand& src); 689 void movsxbq(Register dst, const Operand& src);
687 void movsxwq(Register dst, const Operand& src); 690 void movsxwq(Register dst, const Operand& src);
688 void movsxlq(Register dst, Register src); 691 void movsxlq(Register dst, Register src);
689 void movsxlq(Register dst, const Operand& src); 692 void movsxlq(Register dst, const Operand& src);
690 void movzxbq(Register dst, const Operand& src); 693 void movzxbq(Register dst, const Operand& src);
691 void movzxbl(Register dst, const Operand& src); 694 void movzxbl(Register dst, const Operand& src);
692 void movzxwq(Register dst, const Operand& src); 695 void movzxwq(Register dst, const Operand& src);
693 void movzxwl(Register dst, const Operand& src); 696 void movzxwl(Register dst, const Operand& src);
694 697
695 // Repeated moves. 698 // Repeated moves.
696 699
697 void repmovsb(); 700 void repmovsb();
698 void repmovsw(); 701 void repmovsw();
699 void repmovsl(); 702 void repmovsl();
700 void repmovsq(); 703 void repmovsq();
701 704
702 // New x64 instruction to load from an immediate 64-bit pointer into RAX. 705 // Instruction to load from an immediate 64-bit pointer into RAX.
703 void load_rax(void* ptr, RelocInfo::Mode rmode); 706 void load_rax(void* ptr, RelocInfo::Mode rmode);
704 void load_rax(ExternalReference ext); 707 void load_rax(ExternalReference ext);
705 708
706 // Conditional moves. 709 // Conditional moves.
707 void cmovq(Condition cc, Register dst, Register src); 710 void cmovq(Condition cc, Register dst, Register src);
708 void cmovq(Condition cc, Register dst, const Operand& src); 711 void cmovq(Condition cc, Register dst, const Operand& src);
709 void cmovl(Condition cc, Register dst, Register src); 712 void cmovl(Condition cc, Register dst, Register src);
710 void cmovl(Condition cc, Register dst, const Operand& src); 713 void cmovl(Condition cc, Register dst, const Operand& src);
711 714
712 // Exchange two registers 715 // Exchange two registers
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 inline int available_space() const { 1364 inline int available_space() const {
1362 return static_cast<int>(reloc_info_writer.pos() - pc_); 1365 return static_cast<int>(reloc_info_writer.pos() - pc_);
1363 } 1366 }
1364 1367
1365 static bool IsNop(Address addr) { return *addr == 0x90; } 1368 static bool IsNop(Address addr) { return *addr == 0x90; }
1366 1369
1367 // Avoid overflows for displacements etc. 1370 // Avoid overflows for displacements etc.
1368 static const int kMaximalBufferSize = 512*MB; 1371 static const int kMaximalBufferSize = 512*MB;
1369 static const int kMinimalBufferSize = 4*KB; 1372 static const int kMinimalBufferSize = 4*KB;
1370 1373
1374 protected:
1375 bool emit_debug_code() const { return emit_debug_code_; }
1376
1371 private: 1377 private:
1372 byte* addr_at(int pos) { return buffer_ + pos; } 1378 byte* addr_at(int pos) { return buffer_ + pos; }
1373 byte byte_at(int pos) { return buffer_[pos]; } 1379 byte byte_at(int pos) { return buffer_[pos]; }
1374 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 1380 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
1375 uint32_t long_at(int pos) { 1381 uint32_t long_at(int pos) {
1376 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 1382 return *reinterpret_cast<uint32_t*>(addr_at(pos));
1377 } 1383 }
1378 void long_at_put(int pos, uint32_t x) { 1384 void long_at_put(int pos, uint32_t x) {
1379 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 1385 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
1380 } 1386 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 1570
1565 // code generation 1571 // code generation
1566 byte* pc_; // the program counter; moves forward 1572 byte* pc_; // the program counter; moves forward
1567 RelocInfoWriter reloc_info_writer; 1573 RelocInfoWriter reloc_info_writer;
1568 1574
1569 List< Handle<Code> > code_targets_; 1575 List< Handle<Code> > code_targets_;
1570 // push-pop elimination 1576 // push-pop elimination
1571 byte* last_pc_; 1577 byte* last_pc_;
1572 1578
1573 PositionsRecorder positions_recorder_; 1579 PositionsRecorder positions_recorder_;
1580
1581 bool emit_debug_code_;
1582
1574 friend class PositionsRecorder; 1583 friend class PositionsRecorder;
1575 }; 1584 };
1576 1585
1577 1586
1578 // Helper class that ensures that there is enough space for generating 1587 // Helper class that ensures that there is enough space for generating
1579 // instructions and relocation information. The constructor makes 1588 // instructions and relocation information. The constructor makes
1580 // sure that there is enough space and (in debug mode) the destructor 1589 // sure that there is enough space and (in debug mode) the destructor
1581 // checks that we did not generate too much. 1590 // checks that we did not generate too much.
1582 class EnsureSpace BASE_EMBEDDED { 1591 class EnsureSpace BASE_EMBEDDED {
1583 public: 1592 public:
(...skipping 14 matching lines...) Expand all
1598 private: 1607 private:
1599 Assembler* assembler_; 1608 Assembler* assembler_;
1600 #ifdef DEBUG 1609 #ifdef DEBUG
1601 int space_before_; 1610 int space_before_;
1602 #endif 1611 #endif
1603 }; 1612 };
1604 1613
1605 } } // namespace v8::internal 1614 } } // namespace v8::internal
1606 1615
1607 #endif // V8_X64_ASSEMBLER_X64_H_ 1616 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/version.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698