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

Side by Side Diff: runtime/vm/assembler_x64.h

Issue 22825023: Uses an object pool on x64 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | « no previous file | runtime/vm/assembler_x64.cc » ('j') | runtime/vm/assembler_x64.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_ASSEMBLER_X64_H_ 5 #ifndef VM_ASSEMBLER_X64_H_
6 #define VM_ASSEMBLER_X64_H_ 6 #define VM_ASSEMBLER_X64_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_x64.h directly; use assembler.h instead. 9 #error Do not include assembler_x64.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 static const bool kFarJump = false; 335 static const bool kFarJump = false;
336 336
337 /* 337 /*
338 * Emit Machine Instructions. 338 * Emit Machine Instructions.
339 */ 339 */
340 void call(Register reg); 340 void call(Register reg);
341 void call(const Address& address); 341 void call(const Address& address);
342 void call(Label* label); 342 void call(Label* label);
343 void call(const ExternalLabel* label); 343 void call(const ExternalLabel* label);
344 344
345 static const intptr_t kCallExternalLabelSize = 13; 345 static const intptr_t kCallExternalLabelSize = 10;
346 346
347 void pushq(Register reg); 347 void pushq(Register reg);
348 void pushq(const Address& address); 348 void pushq(const Address& address);
349 void pushq(const Immediate& imm); 349 void pushq(const Immediate& imm);
350 350
351 void popq(Register reg); 351 void popq(Register reg);
352 void popq(const Address& address); 352 void popq(const Address& address);
353 353
354 void setcc(Condition condition, ByteRegister dst); 354 void setcc(Condition condition, ByteRegister dst);
355 355
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 void CompareRegisters(Register a, Register b); 645 void CompareRegisters(Register a, Register b);
646 646
647 // Issues a move instruction if 'to' is not the same as 'from'. 647 // Issues a move instruction if 'to' is not the same as 'from'.
648 void MoveRegister(Register to, Register from); 648 void MoveRegister(Register to, Register from);
649 void PopRegister(Register r); 649 void PopRegister(Register r);
650 650
651 void AddImmediate(Register reg, const Immediate& imm); 651 void AddImmediate(Register reg, const Immediate& imm);
652 652
653 void Drop(intptr_t stack_elements); 653 void Drop(intptr_t stack_elements);
654 654
655 int32_t AddObject(const Object& obj);
656 int32_t AddExternalLabel(const ExternalLabel* label);
657 void LoadWordFromPoolOffset(Register dst, int32_t offset);
658 void LoadExternalLabel(const ExternalLabel* label);
655 void LoadObject(Register dst, const Object& object); 659 void LoadObject(Register dst, const Object& object);
660 void CallPatchable(const ExternalLabel* label);
656 void StoreObject(const Address& dst, const Object& obj); 661 void StoreObject(const Address& dst, const Object& obj);
657 void PushObject(const Object& object); 662 void PushObject(const Object& object);
658 void CompareObject(Register reg, const Object& object); 663 void CompareObject(Register reg, const Object& object);
659 void LoadDoubleConstant(XmmRegister dst, double value); 664 void LoadDoubleConstant(XmmRegister dst, double value);
660 665
661 // Destroys value. 666 // Destroys value.
662 void StoreIntoObject(Register object, // Object we are storing into. 667 void StoreIntoObject(Register object, // Object we are storing into.
663 const Address& dest, // Where we are storing into. 668 const Address& dest, // Where we are storing into.
664 Register value, // Value we are storing. 669 Register value, // Value we are storing.
665 bool can_value_be_smi = true); 670 bool can_value_be_smi = true);
666 671
667 void StoreIntoObjectNoBarrier(Register object, 672 void StoreIntoObjectNoBarrier(Register object,
668 const Address& dest, 673 const Address& dest,
669 Register value); 674 Register value);
670 675
671 void DoubleNegate(XmmRegister d); 676 void DoubleNegate(XmmRegister d);
672 void FloatNegate(XmmRegister f); 677 void FloatNegate(XmmRegister f);
673 678
674 void DoubleAbs(XmmRegister reg); 679 void DoubleAbs(XmmRegister reg);
675 680
676 void LockCmpxchgl(const Address& address, Register reg) { 681 void LockCmpxchgl(const Address& address, Register reg) {
677 lock(); 682 lock();
678 cmpxchgl(address, reg); 683 cmpxchgl(address, reg);
679 } 684 }
680 685
681 void EnterFrame(intptr_t frame_space); 686 void EnterFrame(intptr_t frame_space);
682 void LeaveFrame(); 687 void LeaveFrame(bool restore_pp = false);
683 void ReserveAlignedFrameSpace(intptr_t frame_space); 688 void ReserveAlignedFrameSpace(intptr_t frame_space);
684 689
685 // Create a frame for calling into runtime that preserves all volatile 690 // Create a frame for calling into runtime that preserves all volatile
686 // registers. Frame's RSP is guaranteed to be correctly aligned and 691 // registers. Frame's RSP is guaranteed to be correctly aligned and
687 // frame_space bytes are reserved under it. 692 // frame_space bytes are reserved under it.
688 void EnterCallRuntimeFrame(intptr_t frame_space); 693 void EnterCallRuntimeFrame(intptr_t frame_space);
689 void LeaveCallRuntimeFrame(); 694 void LeaveCallRuntimeFrame();
690 695
691 696
692 void CallRuntime(const RuntimeEntry& entry); 697 void CallRuntime(const RuntimeEntry& entry);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 int prologue_offset() const { return prologue_offset_; } 729 int prologue_offset() const { return prologue_offset_; }
725 const ZoneGrowableArray<int>& GetPointerOffsets() const { 730 const ZoneGrowableArray<int>& GetPointerOffsets() const {
726 return buffer_.pointer_offsets(); 731 return buffer_.pointer_offsets();
727 } 732 }
728 const GrowableObjectArray& object_pool() const { return object_pool_; } 733 const GrowableObjectArray& object_pool() const { return object_pool_; }
729 734
730 void FinalizeInstructions(const MemoryRegion& region) { 735 void FinalizeInstructions(const MemoryRegion& region) {
731 buffer_.FinalizeInstructions(region); 736 buffer_.FinalizeInstructions(region);
732 } 737 }
733 738
739 void LoadPoolPointer();
734 // Set up a Dart frame on entry with a frame pointer and PC information to 740 // Set up a Dart frame on entry with a frame pointer and PC information to
735 // enable easy access to the RawInstruction object of code corresponding 741 // enable easy access to the RawInstruction object of code corresponding
736 // to this frame. 742 // to this frame.
737 // The dart frame layout is as follows: 743 // The dart frame layout is as follows:
738 // .... 744 // ....
739 // ret PC 745 // ret PC
740 // saved RBP <=== RBP 746 // saved RBP <=== RBP
741 // pc (used to derive the RawInstruction Object of the dart code) 747 // pc (used to derive the RawInstruction Object of the dart code)
748 // saved PP
742 // locals space <=== RSP 749 // locals space <=== RSP
743 // ..... 750 // .....
744 // This code sets this up with the sequence: 751 // This code sets this up with the sequence:
745 // pushq rbp 752 // pushq rbp
746 // movq rbp, rsp 753 // movq rbp, rsp
747 // call L 754 // call L
748 // L: <code to adjust saved pc if there is any intrinsification code> 755 // L: <code to adjust saved pc if there is any intrinsification code>
756 // ...
757 // pushq r15
749 // ..... 758 // .....
750 void EnterDartFrame(intptr_t frame_size); 759 void EnterDartFrame(intptr_t frame_size);
751 760
752 // Set up a Dart frame for a function compiled for on-stack replacement. 761 // Set up a Dart frame for a function compiled for on-stack replacement.
753 // The frame layout is a normal Dart frame, but the frame is partially set 762 // The frame layout is a normal Dart frame, but the frame is partially set
754 // up on entry (it is the frame of the unoptimized code). 763 // up on entry (it is the frame of the unoptimized code).
755 void EnterOsrFrame(intptr_t extra_size); 764 void EnterOsrFrame(intptr_t extra_size);
756 765
757 // Set up a stub frame so that the stack traversal code can easily identify 766 // Set up a stub frame so that the stack traversal code can easily identify
758 // a stub frame. 767 // a stub frame.
759 // The stub frame layout is as follows: 768 // The stub frame layout is as follows:
760 // .... 769 // ....
761 // ret PC 770 // ret PC
762 // saved RBP 771 // saved RBP
763 // pc (used to derive the RawInstruction Object of the stub) 772 // pc (used to derive the RawInstruction Object of the stub)
764 // ..... 773 // .....
765 // This code sets this up with the sequence: 774 // This code sets this up with the sequence:
766 // pushq rbp 775 // pushq rbp
767 // movq rbp, rsp 776 // movq rbp, rsp
768 // pushq immediate(0) 777 // pushq immediate(0)
769 // ..... 778 // .....
770 void EnterStubFrame(); 779 void EnterStubFrame(bool save_pp = false);
771 780
772 // Instruction pattern from entrypoint is used in dart frame prologs 781 // Instruction pattern from entrypoint is used in dart frame prologues
773 // to set up the frame and save a PC which can be used to figure out the 782 // to set up the frame and save a PC which can be used to figure out the
774 // RawInstruction object corresponding to the code running in the frame. 783 // RawInstruction object corresponding to the code running in the frame.
775 // entrypoint: 784 // entrypoint:
776 // pushq rbp (size is 1 byte) 785 // pushq rbp (size is 1 byte)
777 // movq rbp, rsp (size is 3 bytes) 786 // movq rbp, rsp (size is 3 bytes)
778 // call L (size is 5 bytes) 787 // call L (size is 5 bytes)
779 // L: 788 // L:
780 static const intptr_t kEntryPointToPcMarkerOffset = 9; 789 static const intptr_t kEntryPointToPcMarkerOffset = 9;
781 790
782 // Inlined allocation of an instance of class 'cls', code has no runtime 791 // Inlined allocation of an instance of class 'cls', code has no runtime
(...skipping 12 matching lines...) Expand all
795 void Unreachable(const char* message); 804 void Unreachable(const char* message);
796 805
797 static void InitializeMemoryWithBreakpoints(uword data, int length); 806 static void InitializeMemoryWithBreakpoints(uword data, int length);
798 807
799 static const char* RegisterName(Register reg); 808 static const char* RegisterName(Register reg);
800 809
801 static const char* FpuRegisterName(FpuRegister reg); 810 static const char* FpuRegisterName(FpuRegister reg);
802 811
803 private: 812 private:
804 AssemblerBuffer buffer_; 813 AssemblerBuffer buffer_;
805 GrowableObjectArray& object_pool_; // Object pool is not used on x64. 814 GrowableObjectArray& object_pool_; // Objects and patchable jump targets.
806 int prologue_offset_; 815 int prologue_offset_;
807 816
808 class CodeComment : public ZoneAllocated { 817 class CodeComment : public ZoneAllocated {
809 public: 818 public:
810 CodeComment(intptr_t pc_offset, const String& comment) 819 CodeComment(intptr_t pc_offset, const String& comment)
811 : pc_offset_(pc_offset), comment_(comment) { } 820 : pc_offset_(pc_offset), comment_(comment) { }
812 821
813 intptr_t pc_offset() const { return pc_offset_; } 822 intptr_t pc_offset() const { return pc_offset_; }
814 const String& comment() const { return comment_; } 823 const String& comment() const { return comment_; }
815 824
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 946 }
938 947
939 948
940 inline void Assembler::EmitOperandSizeOverride() { 949 inline void Assembler::EmitOperandSizeOverride() {
941 EmitUint8(0x66); 950 EmitUint8(0x66);
942 } 951 }
943 952
944 } // namespace dart 953 } // namespace dart
945 954
946 #endif // VM_ASSEMBLER_X64_H_ 955 #endif // VM_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler_x64.cc » ('j') | runtime/vm/assembler_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698