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

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

Issue 1343373003: Revert "VM: New calling convention for generated code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « runtime/vm/assembler_mips_test.cc ('k') | runtime/vm/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) 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 static const bool kFarJump = false; 359 static const bool kFarJump = false;
360 360
361 /* 361 /*
362 * Emit Machine Instructions. 362 * Emit Machine Instructions.
363 */ 363 */
364 void call(Register reg); 364 void call(Register reg);
365 void call(const Address& address); 365 void call(const Address& address);
366 void call(Label* label); 366 void call(Label* label);
367 void call(const ExternalLabel* label); 367 void call(const ExternalLabel* label);
368 368
369 static const intptr_t kCallExternalLabelSize = 15; 369 static const intptr_t kCallExternalLabelSize = 7;
370 370
371 void pushq(Register reg); 371 void pushq(Register reg);
372 void pushq(const Address& address); 372 void pushq(const Address& address);
373 void pushq(const Immediate& imm); 373 void pushq(const Immediate& imm);
374 void PushImmediate(const Immediate& imm); 374 void PushImmediate(const Immediate& imm);
375 375
376 void popq(Register reg); 376 void popq(Register reg);
377 void popq(const Address& address); 377 void popq(const Address& address);
378 378
379 void setcc(Condition condition, ByteRegister dst); 379 void setcc(Condition condition, ByteRegister dst);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 void LoadExternalLabel(Register dst, 763 void LoadExternalLabel(Register dst,
764 const ExternalLabel* label, 764 const ExternalLabel* label,
765 Patchability patchable); 765 Patchability patchable);
766 void LoadNativeEntry(Register dst, 766 void LoadNativeEntry(Register dst,
767 const ExternalLabel* label, 767 const ExternalLabel* label,
768 Patchability patchable); 768 Patchability patchable);
769 void LoadFunctionFromCalleePool(Register dst, 769 void LoadFunctionFromCalleePool(Register dst,
770 const Function& function, 770 const Function& function,
771 Register new_pp); 771 Register new_pp);
772 void JmpPatchable(const StubEntry& stub_entry, Register pp); 772 void JmpPatchable(const StubEntry& stub_entry, Register pp);
773 void Jmp(const StubEntry& stub_entry, Register pp = PP); 773 void Jmp(const StubEntry& stub_entry, Register pp);
774 void J(Condition condition, const StubEntry& stub_entry, Register pp); 774 void J(Condition condition, const StubEntry& stub_entry, Register pp);
775 void CallPatchable(const StubEntry& stub_entry); 775 void CallPatchable(const StubEntry& stub_entry);
776 void Call(const StubEntry& stub_entry); 776 void Call(const StubEntry& stub_entry);
777 // Unaware of write barrier (use StoreInto* methods for storing to objects). 777 // Unaware of write barrier (use StoreInto* methods for storing to objects).
778 // TODO(koda): Add StackAddress/HeapAddress types to prevent misuse. 778 // TODO(koda): Add StackAddress/HeapAddress types to prevent misuse.
779 void StoreObject(const Address& dst, const Object& obj); 779 void StoreObject(const Address& dst, const Object& obj);
780 void PushObject(const Object& object); 780 void PushObject(const Object& object);
781 void CompareObject(Register reg, const Object& object); 781 void CompareObject(Register reg, const Object& object);
782 782
783 // When storing into a heap object field, knowledge of the previous content 783 // When storing into a heap object field, knowledge of the previous content
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 void DoubleAbs(XmmRegister reg); 825 void DoubleAbs(XmmRegister reg);
826 826
827 void LockCmpxchgq(const Address& address, Register reg) { 827 void LockCmpxchgq(const Address& address, Register reg) {
828 lock(); 828 lock();
829 cmpxchgq(address, reg); 829 cmpxchgq(address, reg);
830 } 830 }
831 831
832 void PushRegisters(intptr_t cpu_register_set, intptr_t xmm_register_set); 832 void PushRegisters(intptr_t cpu_register_set, intptr_t xmm_register_set);
833 void PopRegisters(intptr_t cpu_register_set, intptr_t xmm_register_set); 833 void PopRegisters(intptr_t cpu_register_set, intptr_t xmm_register_set);
834 834
835 void CheckCodePointer();
836
837 void EnterFrame(intptr_t frame_space); 835 void EnterFrame(intptr_t frame_space);
838 void LeaveFrame(); 836 void LeaveFrame();
839 void ReserveAlignedFrameSpace(intptr_t frame_space); 837 void ReserveAlignedFrameSpace(intptr_t frame_space);
840 838
841 // Create a frame for calling into runtime that preserves all volatile 839 // Create a frame for calling into runtime that preserves all volatile
842 // registers. Frame's RSP is guaranteed to be correctly aligned and 840 // registers. Frame's RSP is guaranteed to be correctly aligned and
843 // frame_space bytes are reserved under it. 841 // frame_space bytes are reserved under it.
844 void EnterCallRuntimeFrame(intptr_t frame_space); 842 void EnterCallRuntimeFrame(intptr_t frame_space);
845 void LeaveCallRuntimeFrame(); 843 void LeaveCallRuntimeFrame();
846 844
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 ObjectPoolWrapper& object_pool_wrapper() { return object_pool_wrapper_; } 915 ObjectPoolWrapper& object_pool_wrapper() { return object_pool_wrapper_; }
918 916
919 RawObjectPool* MakeObjectPool() { 917 RawObjectPool* MakeObjectPool() {
920 return object_pool_wrapper_.MakeObjectPool(); 918 return object_pool_wrapper_.MakeObjectPool();
921 } 919 }
922 920
923 void FinalizeInstructions(const MemoryRegion& region) { 921 void FinalizeInstructions(const MemoryRegion& region) {
924 buffer_.FinalizeInstructions(region); 922 buffer_.FinalizeInstructions(region);
925 } 923 }
926 924
927 void RestoreCodePointer();
928 void LoadPoolPointer(Register pp = PP); 925 void LoadPoolPointer(Register pp = PP);
929 926
930 // Set up a Dart frame on entry with a frame pointer and PC information to 927 // Set up a Dart frame on entry with a frame pointer and PC information to
931 // enable easy access to the RawInstruction object of code corresponding 928 // enable easy access to the RawInstruction object of code corresponding
932 // to this frame. 929 // to this frame.
933 // The dart frame layout is as follows: 930 // The dart frame layout is as follows:
934 // .... 931 // ....
935 // locals space <=== RSP 932 // locals space <=== RSP
936 // saved PP 933 // saved PP
937 // pc (used to derive the RawInstruction Object of the dart code) 934 // pc (used to derive the RawInstruction Object of the dart code)
938 // saved RBP <=== RBP 935 // saved RBP <=== RBP
939 // ret PC 936 // ret PC
940 // ..... 937 // .....
941 // This code sets this up with the sequence: 938 // This code sets this up with the sequence:
942 // pushq rbp 939 // pushq rbp
943 // movq rbp, rsp 940 // movq rbp, rsp
944 // call L 941 // call L
945 // L: <code to adjust saved pc if there is any intrinsification code> 942 // L: <code to adjust saved pc if there is any intrinsification code>
946 // ... 943 // ...
947 // pushq r15 944 // pushq r15
948 // ..... 945 // .....
949 void EnterDartFrame(intptr_t frame_size, Register new_pp); 946 void EnterDartFrame(intptr_t frame_size,
950 void LeaveDartFrame(RestorePP restore_pp = kRestoreCallerPP); 947 Register new_pp,
948 Register pc_marker_override);
949 void LeaveDartFrame();
951 950
952 // Set up a Dart frame for a function compiled for on-stack replacement. 951 // Set up a Dart frame for a function compiled for on-stack replacement.
953 // The frame layout is a normal Dart frame, but the frame is partially set 952 // The frame layout is a normal Dart frame, but the frame is partially set
954 // up on entry (it is the frame of the unoptimized code). 953 // up on entry (it is the frame of the unoptimized code).
955 void EnterOsrFrame(intptr_t extra_size); 954 void EnterOsrFrame(intptr_t extra_size,
955 Register new_pp, Register pc_marker_override);
956 956
957 // Set up a stub frame so that the stack traversal code can easily identify 957 // Set up a stub frame so that the stack traversal code can easily identify
958 // a stub frame. 958 // a stub frame.
959 // The stub frame layout is as follows: 959 // The stub frame layout is as follows:
960 // .... <=== RSP 960 // .... <=== RSP
961 // pc (used to derive the RawInstruction Object of the stub) 961 // pc (used to derive the RawInstruction Object of the stub)
962 // saved RBP <=== RBP 962 // saved RBP <=== RBP
963 // ret PC 963 // ret PC
964 // ..... 964 // .....
965 // This code sets this up with the sequence: 965 // This code sets this up with the sequence:
966 // pushq rbp 966 // pushq rbp
967 // movq rbp, rsp 967 // movq rbp, rsp
968 // pushq immediate(0) 968 // pushq immediate(0)
969 // ..... 969 // .....
970 void EnterStubFrame(); 970 void EnterStubFrame();
971 void LeaveStubFrame(); 971 void LeaveStubFrame();
972 972
973 // Instruction pattern from entrypoint is used in dart frame prologues
974 // to set up the frame and save a PC which can be used to figure out the
975 // RawInstruction object corresponding to the code running in the frame.
976 // entrypoint:
977 // pushq rbp (size is 1 byte)
978 // movq rbp, rsp (size is 3 bytes)
979 // call L (size is 5 bytes)
980 // L:
981 static const intptr_t kEntryPointToPcMarkerOffset = 0;
982 static intptr_t EntryPointToPcMarkerOffset() {
983 return kEntryPointToPcMarkerOffset;
984 }
985
973 void UpdateAllocationStats(intptr_t cid, 986 void UpdateAllocationStats(intptr_t cid,
974 Heap::Space space, 987 Heap::Space space,
975 bool inline_isolate = true); 988 bool inline_isolate = true);
976 989
977 void UpdateAllocationStatsWithSize(intptr_t cid, 990 void UpdateAllocationStatsWithSize(intptr_t cid,
978 Register size_reg, 991 Register size_reg,
979 Heap::Space space, 992 Heap::Space space,
980 bool inline_isolate = true); 993 bool inline_isolate = true);
981 void UpdateAllocationStatsWithSize(intptr_t cid, 994 void UpdateAllocationStatsWithSize(intptr_t cid,
982 intptr_t instance_size, 995 intptr_t instance_size,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1210 }
1198 1211
1199 1212
1200 inline void Assembler::EmitOperandSizeOverride() { 1213 inline void Assembler::EmitOperandSizeOverride() {
1201 EmitUint8(0x66); 1214 EmitUint8(0x66);
1202 } 1215 }
1203 1216
1204 } // namespace dart 1217 } // namespace dart
1205 1218
1206 #endif // VM_ASSEMBLER_X64_H_ 1219 #endif // VM_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips_test.cc ('k') | runtime/vm/assembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698