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

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

Issue 25118002: Eliminates more large immediates from x64 code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void call(Register reg); 349 void call(Register reg);
350 void call(const Address& address); 350 void call(const Address& address);
351 void call(Label* label); 351 void call(Label* label);
352 void call(const ExternalLabel* label); 352 void call(const ExternalLabel* label);
353 353
354 static const intptr_t kCallExternalLabelSize = 10; 354 static const intptr_t kCallExternalLabelSize = 10;
355 355
356 void pushq(Register reg); 356 void pushq(Register reg);
357 void pushq(const Address& address); 357 void pushq(const Address& address);
358 void pushq(const Immediate& imm); 358 void pushq(const Immediate& imm);
359 void PushImmediate(const Immediate& imm, Register pp);
359 360
360 void popq(Register reg); 361 void popq(Register reg);
361 void popq(const Address& address); 362 void popq(const Address& address);
362 363
363 void setcc(Condition condition, ByteRegister dst); 364 void setcc(Condition condition, ByteRegister dst);
364 365
365 void movl(Register dst, Register src); 366 void movl(Register dst, Register src);
366 void movl(Register dst, const Immediate& imm); 367 void movl(Register dst, const Immediate& imm);
367 void movl(Register dst, const Address& src); 368 void movl(Register dst, const Address& src);
368 void movl(const Address& dst, Register src); 369 void movl(const Address& dst, Register src);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 void cmpl(Register reg0, Register reg1); 483 void cmpl(Register reg0, Register reg1);
483 void cmpl(Register reg, const Address& address); 484 void cmpl(Register reg, const Address& address);
484 void cmpl(const Address& address, const Immediate& imm); 485 void cmpl(const Address& address, const Immediate& imm);
485 486
486 void cmpq(Register reg, const Immediate& imm); 487 void cmpq(Register reg, const Immediate& imm);
487 void cmpq(const Address& address, Register reg); 488 void cmpq(const Address& address, Register reg);
488 void cmpq(const Address& address, const Immediate& imm); 489 void cmpq(const Address& address, const Immediate& imm);
489 void cmpq(Register reg0, Register reg1); 490 void cmpq(Register reg0, Register reg1);
490 void cmpq(Register reg, const Address& address); 491 void cmpq(Register reg, const Address& address);
491 492
493 void CompareImmediate(Register reg, const Immediate& imm, Register pp);
494 void CompareImmediate(const Address& address, const Immediate& imm,
495 Register pp);
496
492 void testl(Register reg1, Register reg2); 497 void testl(Register reg1, Register reg2);
493 void testl(Register reg, const Immediate& imm); 498 void testl(Register reg, const Immediate& imm);
494 499
495 void testq(Register reg1, Register reg2); 500 void testq(Register reg1, Register reg2);
496 void testq(Register reg, const Immediate& imm); 501 void testq(Register reg, const Immediate& imm);
497 502
498 void andl(Register dst, Register src); 503 void andl(Register dst, Register src);
499 void andl(Register dst, const Immediate& imm); 504 void andl(Register dst, const Immediate& imm);
500 505
501 void orl(Register dst, Register src); 506 void orl(Register dst, Register src);
502 void orl(Register dst, const Immediate& imm); 507 void orl(Register dst, const Immediate& imm);
503 508
504 void xorl(Register dst, Register src); 509 void xorl(Register dst, Register src);
505 510
506 void andq(Register dst, Register src); 511 void andq(Register dst, Register src);
507 void andq(Register dst, const Address& address); 512 void andq(Register dst, const Address& address);
508 void andq(Register dst, const Immediate& imm); 513 void andq(Register dst, const Immediate& imm);
514 void AndImmediate(Register dst, const Immediate& imm, Register pp);
509 515
510 void orq(Register dst, Register src); 516 void orq(Register dst, Register src);
511 void orq(Register dst, const Address& address); 517 void orq(Register dst, const Address& address);
512 void orq(Register dst, const Immediate& imm); 518 void orq(Register dst, const Immediate& imm);
519 void OrImmediate(Register dst, const Immediate& imm, Register pp);
513 520
514 void xorq(Register dst, Register src); 521 void xorq(Register dst, Register src);
515 void xorq(Register dst, const Address& address); 522 void xorq(Register dst, const Address& address);
516 void xorq(const Address& dst, Register src); 523 void xorq(const Address& dst, Register src);
517 void xorq(Register dst, const Immediate& imm); 524 void xorq(Register dst, const Immediate& imm);
525 void XorImmediate(Register dst, const Immediate& imm, Register pp);
518 526
519 void addl(Register dst, Register src); 527 void addl(Register dst, Register src);
520 void addl(const Address& address, const Immediate& imm); 528 void addl(const Address& address, const Immediate& imm);
521 529
522 void addq(Register dst, Register src); 530 void addq(Register dst, Register src);
523 void addq(Register reg, const Immediate& imm); 531 void addq(Register reg, const Immediate& imm);
524 void addq(Register reg, const Address& address); 532 void addq(Register reg, const Address& address);
525 void addq(const Address& address, const Immediate& imm); 533 void addq(const Address& address, const Immediate& imm);
526 void addq(const Address& address, Register reg); 534 void addq(const Address& address, Register reg);
527 535
528 void adcl(Register dst, Register src); 536 void adcl(Register dst, Register src);
529 537
530 void subl(Register dst, Register src); 538 void subl(Register dst, Register src);
531 539
532 void cdq(); 540 void cdq();
533 void cqo(); 541 void cqo();
534 542
535 void idivl(Register reg); 543 void idivl(Register reg);
536 void idivq(Register reg); 544 void idivq(Register reg);
537 545
538 void imull(Register dst, Register src); 546 void imull(Register dst, Register src);
539 void imull(Register reg, const Immediate& imm); 547 void imull(Register reg, const Immediate& imm);
540 548
541 void imulq(Register dst, Register src); 549 void imulq(Register dst, Register src);
542 void imulq(Register dst, const Address& address); 550 void imulq(Register dst, const Address& address);
543 void imulq(Register dst, const Immediate& imm); 551 void imulq(Register dst, const Immediate& imm);
552 void MulImmediate(Register reg, const Immediate& imm, Register pp);
544 553
545 void subq(Register dst, Register src); 554 void subq(Register dst, Register src);
546 void subq(Register reg, const Immediate& imm); 555 void subq(Register reg, const Immediate& imm);
547 void subq(Register reg, const Address& address); 556 void subq(Register reg, const Address& address);
557 void subq(const Address& address, Register reg);
558 void subq(const Address& address, const Immediate& imm);
548 559
549 void shll(Register reg, const Immediate& imm); 560 void shll(Register reg, const Immediate& imm);
550 void shll(Register operand, Register shifter); 561 void shll(Register operand, Register shifter);
551 void shrl(Register reg, const Immediate& imm); 562 void shrl(Register reg, const Immediate& imm);
552 void shrl(Register operand, Register shifter); 563 void shrl(Register operand, Register shifter);
553 void sarl(Register reg, const Immediate& imm); 564 void sarl(Register reg, const Immediate& imm);
554 void sarl(Register operand, Register shifter); 565 void sarl(Register operand, Register shifter);
555 566
556 void shlq(Register reg, const Immediate& imm); 567 void shlq(Register reg, const Immediate& imm);
557 void shlq(Register operand, Register shifter); 568 void shlq(Register operand, Register shifter);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 /* 661 /*
651 * Macros for High-level operations and implemented on all architectures. 662 * Macros for High-level operations and implemented on all architectures.
652 */ 663 */
653 664
654 void CompareRegisters(Register a, Register b); 665 void CompareRegisters(Register a, Register b);
655 666
656 // Issues a move instruction if 'to' is not the same as 'from'. 667 // Issues a move instruction if 'to' is not the same as 'from'.
657 void MoveRegister(Register to, Register from); 668 void MoveRegister(Register to, Register from);
658 void PopRegister(Register r); 669 void PopRegister(Register r);
659 670
660 void AddImmediate(Register reg, const Immediate& imm); 671 void AddImmediate(Register reg, const Immediate& imm, Register pp);
672 void AddImmediate(const Address& address, const Immediate& imm, Register pp);
661 673
662 void Drop(intptr_t stack_elements); 674 void Drop(intptr_t stack_elements);
663 675
664 enum Patchability { 676 enum Patchability {
665 kPatchable, 677 kPatchable,
666 kNotPatchable, 678 kNotPatchable,
667 }; 679 };
668 680
681 void LoadImmediate(Register reg, const Immediate& imm, Register pp);
682 void LoadImmediate(const Address& dst, const Immediate& imm, Register pp);
669 void LoadObject(Register dst, const Object& obj, Register pp); 683 void LoadObject(Register dst, const Object& obj, Register pp);
670 void JmpPatchable(const ExternalLabel* label, Register pp); 684 void JmpPatchable(const ExternalLabel* label, Register pp);
671 void Jmp(const ExternalLabel* label, Register pp); 685 void Jmp(const ExternalLabel* label, Register pp);
672 void J(Condition condition, const ExternalLabel* label, Register pp); 686 void J(Condition condition, const ExternalLabel* label, Register pp);
673 void CallPatchable(const ExternalLabel* label); 687 void CallPatchable(const ExternalLabel* label);
674 void Call(const ExternalLabel* label, Register pp); 688 void Call(const ExternalLabel* label, Register pp);
675 void StoreObject(const Address& dst, const Object& obj); 689 void StoreObject(const Address& dst, const Object& obj, Register pp);
676 void PushObject(const Object& object); 690 void PushObject(const Object& object, Register pp);
677 void CompareObject(Register reg, const Object& object); 691 void CompareObject(Register reg, const Object& object, Register pp);
678 void LoadDoubleConstant(XmmRegister dst, double value); 692 void LoadDoubleConstant(XmmRegister dst, double value);
679 693
680 // Destroys value. 694 // Destroys value.
681 void StoreIntoObject(Register object, // Object we are storing into. 695 void StoreIntoObject(Register object, // Object we are storing into.
682 const Address& dest, // Where we are storing into. 696 const Address& dest, // Where we are storing into.
683 Register value, // Value we are storing. 697 Register value, // Value we are storing.
684 bool can_value_be_smi = true); 698 bool can_value_be_smi = true);
685 699
686 void StoreIntoObjectNoBarrier(Register object, 700 void StoreIntoObjectNoBarrier(Register object,
687 const Address& dest, 701 const Address& dest,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 // pushq rbp (size is 1 byte) 819 // pushq rbp (size is 1 byte)
806 // movq rbp, rsp (size is 3 bytes) 820 // movq rbp, rsp (size is 3 bytes)
807 // call L (size is 5 bytes) 821 // call L (size is 5 bytes)
808 // L: 822 // L:
809 static const intptr_t kEntryPointToPcMarkerOffset = 9; 823 static const intptr_t kEntryPointToPcMarkerOffset = 9;
810 824
811 // Inlined allocation of an instance of class 'cls', code has no runtime 825 // Inlined allocation of an instance of class 'cls', code has no runtime
812 // calls. Jump to 'failure' if the instance cannot be allocated here. 826 // calls. Jump to 'failure' if the instance cannot be allocated here.
813 // Allocated instance is returned in 'instance_reg'. 827 // Allocated instance is returned in 'instance_reg'.
814 // Only the tags field of the object is initialized. 828 // Only the tags field of the object is initialized.
829 // Loads large immediates from the object pool with pool pointer in PP if it
830 // is not kNoRegister
815 void TryAllocate(const Class& cls, 831 void TryAllocate(const Class& cls,
816 Label* failure, 832 Label* failure,
817 bool near_jump, 833 bool near_jump,
818 Register instance_reg); 834 Register instance_reg,
835 Register pp);
819 836
820 // Debugging and bringup support. 837 // Debugging and bringup support.
821 void Stop(const char* message); 838 void Stop(const char* message);
822 void Unimplemented(const char* message); 839 void Unimplemented(const char* message);
823 void Untested(const char* message); 840 void Untested(const char* message);
824 void Unreachable(const char* message); 841 void Unreachable(const char* message);
825 842
826 static void InitializeMemoryWithBreakpoints(uword data, int length); 843 static void InitializeMemoryWithBreakpoints(uword data, int length);
827 844
828 static const char* RegisterName(Register reg); 845 static const char* RegisterName(Register reg);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 const String& comment_; 911 const String& comment_;
895 912
896 DISALLOW_COPY_AND_ASSIGN(CodeComment); 913 DISALLOW_COPY_AND_ASSIGN(CodeComment);
897 }; 914 };
898 915
899 GrowableArray<CodeComment*> comments_; 916 GrowableArray<CodeComment*> comments_;
900 917
901 intptr_t FindObject(const Object& obj, Patchability patchable); 918 intptr_t FindObject(const Object& obj, Patchability patchable);
902 intptr_t FindExternalLabel(const ExternalLabel* label, 919 intptr_t FindExternalLabel(const ExternalLabel* label,
903 Patchability patchable); 920 Patchability patchable);
921 intptr_t FindImmediate(int64_t imm);
904 void LoadExternalLabel(Register dst, 922 void LoadExternalLabel(Register dst,
905 const ExternalLabel* label, 923 const ExternalLabel* label,
906 Patchability patchable, 924 Patchability patchable,
907 Register pp); 925 Register pp);
908 bool CanLoadFromObjectPool(const Object& object); 926 bool CanLoadFromObjectPool(const Object& object);
909 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset); 927 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset);
910 928
911 inline void EmitUint8(uint8_t value); 929 inline void EmitUint8(uint8_t value);
912 inline void EmitInt32(int32_t value); 930 inline void EmitInt32(int32_t value);
913 inline void EmitInt64(int64_t value); 931 inline void EmitInt64(int64_t value);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 } 1041 }
1024 1042
1025 1043
1026 inline void Assembler::EmitOperandSizeOverride() { 1044 inline void Assembler::EmitOperandSizeOverride() {
1027 EmitUint8(0x66); 1045 EmitUint8(0x66);
1028 } 1046 }
1029 1047
1030 } // namespace dart 1048 } // namespace dart
1031 1049
1032 #endif // VM_ASSEMBLER_X64_H_ 1050 #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