OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 ScaleFactor scale; | 67 ScaleFactor scale; |
68 }; | 68 }; |
69 | 69 |
70 // MacroAssembler implements a collection of frequently used macros. | 70 // MacroAssembler implements a collection of frequently used macros. |
71 class MacroAssembler: public Assembler { | 71 class MacroAssembler: public Assembler { |
72 public: | 72 public: |
73 MacroAssembler(void* buffer, int size); | 73 MacroAssembler(void* buffer, int size); |
74 | 74 |
75 void LoadRoot(Register destination, Heap::RootListIndex index); | 75 void LoadRoot(Register destination, Heap::RootListIndex index); |
76 void CompareRoot(Register with, Heap::RootListIndex index); | 76 void CompareRoot(Register with, Heap::RootListIndex index); |
77 void CompareRoot(Operand with, Heap::RootListIndex index); | 77 void CompareRoot(const Operand& with, Heap::RootListIndex index); |
78 void PushRoot(Heap::RootListIndex index); | 78 void PushRoot(Heap::RootListIndex index); |
79 void StoreRoot(Register source, Heap::RootListIndex index); | 79 void StoreRoot(Register source, Heap::RootListIndex index); |
80 | 80 |
81 // --------------------------------------------------------------------------- | 81 // --------------------------------------------------------------------------- |
82 // GC Support | 82 // GC Support |
83 | 83 |
84 // For page containing |object| mark region covering |addr| dirty. | 84 // For page containing |object| mark region covering |addr| dirty. |
85 // RecordWriteHelper only works if the object is not in new | 85 // RecordWriteHelper only works if the object is not in new |
86 // space. | 86 // space. |
87 void RecordWriteHelper(Register object, | 87 void RecordWriteHelper(Register object, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 // Control Flow | 590 // Control Flow |
591 void Jump(Address destination, RelocInfo::Mode rmode); | 591 void Jump(Address destination, RelocInfo::Mode rmode); |
592 void Jump(ExternalReference ext); | 592 void Jump(ExternalReference ext); |
593 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); | 593 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); |
594 | 594 |
595 void Call(Address destination, RelocInfo::Mode rmode); | 595 void Call(Address destination, RelocInfo::Mode rmode); |
596 void Call(ExternalReference ext); | 596 void Call(ExternalReference ext); |
597 void Call(Handle<Code> code_object, RelocInfo::Mode rmode); | 597 void Call(Handle<Code> code_object, RelocInfo::Mode rmode); |
598 | 598 |
| 599 // Emit call to the code we are currently generating. |
| 600 void CallSelf() { |
| 601 Handle<Code> self(reinterpret_cast<Code**>(CodeObject().location())); |
| 602 Call(self, RelocInfo::CODE_TARGET); |
| 603 } |
| 604 |
599 // Non-x64 instructions. | 605 // Non-x64 instructions. |
600 // Push/pop all general purpose registers. | 606 // Push/pop all general purpose registers. |
601 // Does not push rsp/rbp nor any of the assembler's special purpose registers | 607 // Does not push rsp/rbp nor any of the assembler's special purpose registers |
602 // (kScratchRegister, kSmiConstantRegister, kRootRegister). | 608 // (kScratchRegister, kSmiConstantRegister, kRootRegister). |
603 void Pushad(); | 609 void Pushad(); |
604 void Popad(); | 610 void Popad(); |
605 // Sets the stack as after performing Popad, without actually loading the | 611 // Sets the stack as after performing Popad, without actually loading the |
606 // registers. | 612 // registers. |
607 void Dropad(); | 613 void Dropad(); |
608 | 614 |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 Call(adaptor, RelocInfo::CODE_TARGET); | 1771 Call(adaptor, RelocInfo::CODE_TARGET); |
1766 jmp(done); | 1772 jmp(done); |
1767 } else { | 1773 } else { |
1768 Jump(adaptor, RelocInfo::CODE_TARGET); | 1774 Jump(adaptor, RelocInfo::CODE_TARGET); |
1769 } | 1775 } |
1770 bind(&invoke); | 1776 bind(&invoke); |
1771 } | 1777 } |
1772 } | 1778 } |
1773 | 1779 |
1774 | 1780 |
| 1781 // Ensures that code is padded to at least a given size. |
| 1782 class Padding BASE_EMBEDDED { |
| 1783 public: |
| 1784 Padding(Assembler* masm, int min_size) |
| 1785 : masm_(masm), min_end_offset_(masm->pc_offset() + min_size) { } |
| 1786 ~Padding() { |
| 1787 int offset = masm_->pc_offset(); |
| 1788 if (offset < min_end_offset_) { |
| 1789 masm_->Pad(min_end_offset_ - offset); |
| 1790 } |
| 1791 } |
| 1792 private: |
| 1793 Assembler* masm_; |
| 1794 int min_end_offset_; |
| 1795 }; |
| 1796 |
| 1797 |
1775 } } // namespace v8::internal | 1798 } } // namespace v8::internal |
1776 | 1799 |
1777 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1800 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |