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: src/assembler.h

Issue 986553005: Contribution of PowerPC port (continuation of 422063005) - serialize.cc cleanup (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // Everything after runtime_entry (inclusive) is not GC'ed. 372 // Everything after runtime_entry (inclusive) is not GC'ed.
373 RUNTIME_ENTRY, 373 RUNTIME_ENTRY,
374 JS_RETURN, // Marks start of the ExitJSFrame code. 374 JS_RETURN, // Marks start of the ExitJSFrame code.
375 COMMENT, 375 COMMENT,
376 POSITION, // See comment for kNoPosition above. 376 POSITION, // See comment for kNoPosition above.
377 STATEMENT_POSITION, // See comment for kNoPosition above. 377 STATEMENT_POSITION, // See comment for kNoPosition above.
378 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot. 378 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot.
379 EXTERNAL_REFERENCE, // The address of an external C++ function. 379 EXTERNAL_REFERENCE, // The address of an external C++ function.
380 INTERNAL_REFERENCE, // An address inside the same function. 380 INTERNAL_REFERENCE, // An address inside the same function.
381 381
382 // Marks constant and veneer pools. Only used on ARM and ARM64. 382 // ARCH1/ARCH2 use is architecture dependent.
383 // They use a custom noncompact encoding. 383 // They use a custom noncompact encoding.
384 CONST_POOL, 384 ARCH1,
385 VENEER_POOL, 385 ARCH2,
386 386
387 DEOPT_REASON, // Deoptimization reason index. 387 DEOPT_REASON, // Deoptimization reason index.
388 388
389 // add more as needed 389 // add more as needed
390 // Pseudo-types 390 // Pseudo-types
391 NUMBER_OF_MODES, // There are at most 15 modes with noncompact encoding. 391 NUMBER_OF_MODES, // There are at most 15 modes with noncompact encoding.
392 NONE32, // never recorded 32-bit value 392 NONE32, // never recorded 32-bit value
393 NONE64, // never recorded 64-bit value 393 NONE64, // never recorded 64-bit value
394 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by 394 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by
395 // code aging. 395 // code aging.
396 396
397 // Encoded internal reference, used only on MIPS and MIPS64. 397 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
398 // Re-uses previous ARM-only encoding, to fit in RealRelocMode space. 398 // Marks constant and veneer pools. Only used on ARM and ARM64.
399 INTERNAL_REFERENCE_ENCODED = CONST_POOL, 399 CONST_POOL = ARCH1,
Yang 2015/03/09 08:03:56 I strongly object using same enum values for entir
400 VENEER_POOL = ARCH2,
401 #elif V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
402 // Encoded internal reference, used only on PPC, MIPS and MIPS64.
403 INTERNAL_REFERENCE_ENCODED = ARCH1,
404 #endif
400 405
401 FIRST_REAL_RELOC_MODE = CODE_TARGET, 406 FIRST_REAL_RELOC_MODE = CODE_TARGET,
402 LAST_REAL_RELOC_MODE = VENEER_POOL, 407 LAST_REAL_RELOC_MODE = ARCH2,
403 FIRST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, 408 FIRST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE,
404 LAST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, 409 LAST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE,
405 LAST_CODE_ENUM = DEBUG_BREAK, 410 LAST_CODE_ENUM = DEBUG_BREAK,
406 LAST_GCED_ENUM = CELL, 411 LAST_GCED_ENUM = CELL,
407 // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding. 412 // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding.
408 LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID, 413 LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID,
409 LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE 414 LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE
410 }; 415 };
411 416
412 RelocInfo() {} 417 RelocInfo() {}
(...skipping 30 matching lines...) Expand all
443 static inline bool IsGCRelocMode(Mode mode) { 448 static inline bool IsGCRelocMode(Mode mode) {
444 return mode <= LAST_GCED_ENUM; 449 return mode <= LAST_GCED_ENUM;
445 } 450 }
446 static inline bool IsJSReturn(Mode mode) { 451 static inline bool IsJSReturn(Mode mode) {
447 return mode == JS_RETURN; 452 return mode == JS_RETURN;
448 } 453 }
449 static inline bool IsComment(Mode mode) { 454 static inline bool IsComment(Mode mode) {
450 return mode == COMMENT; 455 return mode == COMMENT;
451 } 456 }
452 static inline bool IsConstPool(Mode mode) { 457 static inline bool IsConstPool(Mode mode) {
458 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
453 return mode == CONST_POOL; 459 return mode == CONST_POOL;
460 #else
461 return false;
462 #endif
454 } 463 }
455 static inline bool IsVeneerPool(Mode mode) { 464 static inline bool IsVeneerPool(Mode mode) {
465 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
456 return mode == VENEER_POOL; 466 return mode == VENEER_POOL;
467 #else
468 return false;
469 #endif
457 } 470 }
458 static inline bool IsDeoptReason(Mode mode) { 471 static inline bool IsDeoptReason(Mode mode) {
459 return mode == DEOPT_REASON; 472 return mode == DEOPT_REASON;
460 } 473 }
461 static inline bool IsPosition(Mode mode) { 474 static inline bool IsPosition(Mode mode) {
462 return mode == POSITION || mode == STATEMENT_POSITION; 475 return mode == POSITION || mode == STATEMENT_POSITION;
463 } 476 }
464 static inline bool IsStatementPosition(Mode mode) { 477 static inline bool IsStatementPosition(Mode mode) {
465 return mode == STATEMENT_POSITION; 478 return mode == STATEMENT_POSITION;
466 } 479 }
467 static inline bool IsExternalReference(Mode mode) { 480 static inline bool IsExternalReference(Mode mode) {
468 return mode == EXTERNAL_REFERENCE; 481 return mode == EXTERNAL_REFERENCE;
469 } 482 }
470 static inline bool IsInternalReference(Mode mode) { 483 static inline bool IsInternalReference(Mode mode) {
471 return mode == INTERNAL_REFERENCE; 484 return mode == INTERNAL_REFERENCE;
472 } 485 }
473 static inline bool IsInternalReferenceEncoded(Mode mode) { 486 static inline bool IsInternalReferenceEncoded(Mode mode) {
487 #if V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
474 return mode == INTERNAL_REFERENCE_ENCODED; 488 return mode == INTERNAL_REFERENCE_ENCODED;
489 #else
490 return false;
491 #endif
475 } 492 }
476 static inline bool IsDebugBreakSlot(Mode mode) { 493 static inline bool IsDebugBreakSlot(Mode mode) {
477 return mode == DEBUG_BREAK_SLOT; 494 return mode == DEBUG_BREAK_SLOT;
478 } 495 }
479 static inline bool IsDebuggerStatement(Mode mode) { 496 static inline bool IsDebuggerStatement(Mode mode) {
480 return mode == DEBUG_BREAK; 497 return mode == DEBUG_BREAK;
481 } 498 }
482 static inline bool IsNone(Mode mode) { 499 static inline bool IsNone(Mode mode) {
483 return mode == NONE32 || mode == NONE64; 500 return mode == NONE32 || mode == NONE64;
484 } 501 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // should return the end of the instructions to be patched, allowing the 593 // should return the end of the instructions to be patched, allowing the
577 // deserializer to deserialize the instructions as raw bytes and put them in 594 // deserializer to deserialize the instructions as raw bytes and put them in
578 // place, ready to be patched with the target. 595 // place, ready to be patched with the target.
579 INLINE(int target_address_size()); 596 INLINE(int target_address_size());
580 597
581 // Read the reference in the instruction this relocation 598 // Read the reference in the instruction this relocation
582 // applies to; can only be called if rmode_ is EXTERNAL_REFERENCE. 599 // applies to; can only be called if rmode_ is EXTERNAL_REFERENCE.
583 INLINE(Address target_external_reference()); 600 INLINE(Address target_external_reference());
584 601
585 // Read/modify the reference in the instruction this relocation 602 // Read/modify the reference in the instruction this relocation
586 // applies to; can only be called if rmode_ is INTERNAL_REFERENCE. 603 // applies to; can only be called if rmode_ is in kInternalReferenceMask.
587 INLINE(Address target_internal_reference()); 604 INLINE(Address target_internal_reference());
588 INLINE(void set_target_internal_reference(Address target)); 605 INLINE(void set_target_internal_reference(
606 Address target,
607 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
589 608
590 // Read/modify the address of a call instruction. This is used to relocate 609 // Read/modify the address of a call instruction. This is used to relocate
591 // the break points where straight-line code is patched with a call 610 // the break points where straight-line code is patched with a call
592 // instruction. 611 // instruction.
593 INLINE(Address call_address()); 612 INLINE(Address call_address());
594 INLINE(void set_call_address(Address target)); 613 INLINE(void set_call_address(Address target));
595 INLINE(Object* call_object()); 614 INLINE(Object* call_object());
596 INLINE(void set_call_object(Object* target)); 615 INLINE(void set_call_object(Object* target));
597 INLINE(Object** call_object_address()); 616 INLINE(Object** call_object_address());
598 617
(...skipping 28 matching lines...) Expand all
627 #endif // ENABLE_DISASSEMBLER 646 #endif // ENABLE_DISASSEMBLER
628 #ifdef VERIFY_HEAP 647 #ifdef VERIFY_HEAP
629 void Verify(Isolate* isolate); 648 void Verify(Isolate* isolate);
630 #endif 649 #endif
631 650
632 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; 651 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1;
633 static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; 652 static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION;
634 static const int kDataMask = 653 static const int kDataMask =
635 (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); 654 (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT);
636 static const int kApplyMask; // Modes affected by apply. Depends on arch. 655 static const int kApplyMask; // Modes affected by apply. Depends on arch.
656 static const int kInternalReferenceMask;
637 657
638 private: 658 private:
639 // On ARM, note that pc_ is the address of the constant pool entry 659 // On ARM, note that pc_ is the address of the constant pool entry
640 // to be relocated and not the address of the instruction 660 // to be relocated and not the address of the instruction
641 // referencing the constant pool entry (except when rmode_ == 661 // referencing the constant pool entry (except when rmode_ ==
642 // comment). 662 // comment).
643 byte* pc_; 663 byte* pc_;
644 Mode rmode_; 664 Mode rmode_;
645 union { 665 union {
646 intptr_t data_; 666 intptr_t data_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // On ia32 and arm this is 1 + 4 + 1 + 1 + 1 + 4 = 12. 718 // On ia32 and arm this is 1 + 4 + 1 + 1 + 1 + 4 = 12.
699 // On x64 this is 1 + 4 + 1 + 1 + 1 + 8 == 16; 719 // On x64 this is 1 + 4 + 1 + 1 + 1 + 8 == 16;
700 // Here we use the maximum of the two. 720 // Here we use the maximum of the two.
701 static const int kMaxSize = 16; 721 static const int kMaxSize = 16;
702 722
703 private: 723 private:
704 inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta); 724 inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta);
705 inline void WriteTaggedPC(uint32_t pc_delta, int tag); 725 inline void WriteTaggedPC(uint32_t pc_delta, int tag);
706 inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag); 726 inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag);
707 inline void WriteExtraTaggedIntData(int data_delta, int top_tag); 727 inline void WriteExtraTaggedIntData(int data_delta, int top_tag);
708 inline void WriteExtraTaggedPoolData(int data, int pool_type); 728 inline void WriteExtraTaggedArchData(int data, int pool_type);
709 inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag); 729 inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag);
710 inline void WriteTaggedData(intptr_t data_delta, int tag); 730 inline void WriteTaggedData(intptr_t data_delta, int tag);
711 inline void WriteExtraTag(int extra_tag, int top_tag); 731 inline void WriteExtraTag(int extra_tag, int top_tag);
712 inline void WritePosition(int pc_delta, int pos_delta, RelocInfo::Mode rmode); 732 inline void WritePosition(int pc_delta, int pos_delta, RelocInfo::Mode rmode);
713 733
714 void FlushPosition(); 734 void FlushPosition();
715 735
716 byte* pos_; 736 byte* pos_;
717 byte* last_pc_; 737 byte* last_pc_;
718 int last_id_; 738 int last_id_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 // Advance* moves the position before/after reading. 777 // Advance* moves the position before/after reading.
758 // *Read* reads from current byte(s) into rinfo_. 778 // *Read* reads from current byte(s) into rinfo_.
759 // *Get* just reads and returns info on current byte. 779 // *Get* just reads and returns info on current byte.
760 void Advance(int bytes = 1) { pos_ -= bytes; } 780 void Advance(int bytes = 1) { pos_ -= bytes; }
761 int AdvanceGetTag(); 781 int AdvanceGetTag();
762 int GetExtraTag(); 782 int GetExtraTag();
763 int GetTopTag(); 783 int GetTopTag();
764 void ReadTaggedPC(); 784 void ReadTaggedPC();
765 void AdvanceReadPC(); 785 void AdvanceReadPC();
766 void AdvanceReadId(); 786 void AdvanceReadId();
767 void AdvanceReadPoolData(); 787 void AdvanceReadArchData();
768 void AdvanceReadPosition(); 788 void AdvanceReadPosition();
769 void AdvanceReadData(); 789 void AdvanceReadData();
770 void AdvanceReadVariableLengthPCJump(); 790 void AdvanceReadVariableLengthPCJump();
771 int GetLocatableTypeTag(); 791 int GetLocatableTypeTag();
772 void ReadTaggedId(); 792 void ReadTaggedId();
773 void ReadTaggedPosition(); 793 void ReadTaggedPosition();
774 void ReadTaggedData(); 794 void ReadTaggedData();
775 795
776 // If the given mode is wanted, set it in rinfo_ and return true. 796 // If the given mode is wanted, set it in rinfo_ and return true.
777 // Else return false. Used for efficiently skipping unwanted modes. 797 // Else return false. Used for efficiently skipping unwanted modes.
(...skipping 28 matching lines...) Expand all
806 // all external references in the code so that they can be bound to the correct 826 // all external references in the code so that they can be bound to the correct
807 // addresses when deserializing a heap. 827 // addresses when deserializing a heap.
808 class ExternalReference BASE_EMBEDDED { 828 class ExternalReference BASE_EMBEDDED {
809 public: 829 public:
810 // Used in the simulator to support different native api calls. 830 // Used in the simulator to support different native api calls.
811 enum Type { 831 enum Type {
812 // Builtin call. 832 // Builtin call.
813 // Object* f(v8::internal::Arguments). 833 // Object* f(v8::internal::Arguments).
814 BUILTIN_CALL, // default 834 BUILTIN_CALL, // default
815 835
836
816 // Builtin that takes float arguments and returns an int. 837 // Builtin that takes float arguments and returns an int.
817 // int f(double, double). 838 // int f(double, double).
818 BUILTIN_COMPARE_CALL, 839 BUILTIN_COMPARE_CALL,
819 840
820 // Builtin call that returns floating point. 841 // Builtin call that returns floating point.
821 // double f(double, double). 842 // double f(double, double).
822 BUILTIN_FP_FP_CALL, 843 BUILTIN_FP_FP_CALL,
823 844
824 // Builtin call that returns floating point. 845 // Builtin call that returns floating point.
825 // double f(double). 846 // double f(double).
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 NullCallWrapper() { } 1189 NullCallWrapper() { }
1169 virtual ~NullCallWrapper() { } 1190 virtual ~NullCallWrapper() { }
1170 virtual void BeforeCall(int call_size) const { } 1191 virtual void BeforeCall(int call_size) const { }
1171 virtual void AfterCall() const { } 1192 virtual void AfterCall() const { }
1172 }; 1193 };
1173 1194
1174 1195
1175 } } // namespace v8::internal 1196 } } // namespace v8::internal
1176 1197
1177 #endif // V8_ASSEMBLER_H_ 1198 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm64/assembler-arm64-inl.h ('k') | src/assembler.cc » ('j') | src/debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698