OLD | NEW |
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 | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 // TODO(rmcilroy): This should ideally be a ZoneList, however that would mean | 665 // TODO(rmcilroy): This should ideally be a ZoneList, however that would mean |
666 // RelocInfo would need to subclass ZoneObject which it currently doesn't. | 666 // RelocInfo would need to subclass ZoneObject which it currently doesn't. |
667 std::vector<RelocInfo> entries_; | 667 std::vector<RelocInfo> entries_; |
668 std::vector<int> merged_indexes_; | 668 std::vector<int> merged_indexes_; |
669 int count_of_64bit_; | 669 int count_of_64bit_; |
670 int count_of_code_ptr_; | 670 int count_of_code_ptr_; |
671 int count_of_heap_ptr_; | 671 int count_of_heap_ptr_; |
672 int count_of_32bit_; | 672 int count_of_32bit_; |
673 }; | 673 }; |
674 | 674 |
675 | |
676 extern const Instr kMovLrPc; | |
677 extern const Instr kLdrPCMask; | |
678 extern const Instr kLdrPCPattern; | |
679 extern const Instr kLdrPpMask; | |
680 extern const Instr kLdrPpPattern; | |
681 extern const Instr kBlxRegMask; | |
682 extern const Instr kBlxRegPattern; | |
683 extern const Instr kBlxIp; | |
684 | |
685 extern const Instr kMovMvnMask; | |
686 extern const Instr kMovMvnPattern; | |
687 extern const Instr kMovMvnFlip; | |
688 | |
689 extern const Instr kMovLeaveCCMask; | |
690 extern const Instr kMovLeaveCCPattern; | |
691 extern const Instr kMovwMask; | |
692 extern const Instr kMovwPattern; | |
693 extern const Instr kMovwLeaveCCFlip; | |
694 | |
695 extern const Instr kCmpCmnMask; | |
696 extern const Instr kCmpCmnPattern; | |
697 extern const Instr kCmpCmnFlip; | |
698 extern const Instr kAddSubFlip; | |
699 extern const Instr kAndBicFlip; | |
700 | |
701 struct VmovIndex { | 675 struct VmovIndex { |
702 unsigned char index; | 676 unsigned char index; |
703 }; | 677 }; |
704 const VmovIndex VmovIndexLo = { 0 }; | 678 const VmovIndex VmovIndexLo = { 0 }; |
705 const VmovIndex VmovIndexHi = { 1 }; | 679 const VmovIndex VmovIndexHi = { 1 }; |
706 | 680 |
707 class Assembler : public AssemblerBase { | 681 class Assembler : public AssemblerBase { |
708 public: | 682 public: |
709 // Create an assembler. Instructions and relocation information are emitted | 683 // Create an assembler. Instructions and relocation information are emitted |
710 // into a buffer, with the instructions starting from the beginning and the | 684 // into a buffer, with the instructions starting from the beginning and the |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 | 718 |
745 void bind(Label* L); // binds an unbound label L to the current code position | 719 void bind(Label* L); // binds an unbound label L to the current code position |
746 | 720 |
747 // Returns the branch offset to the given label from the current code position | 721 // Returns the branch offset to the given label from the current code position |
748 // Links the label to the current position if it is still unbound | 722 // Links the label to the current position if it is still unbound |
749 // Manages the jump elimination optimization if the second parameter is true. | 723 // Manages the jump elimination optimization if the second parameter is true. |
750 int branch_offset(Label* L, bool jump_elimination_allowed); | 724 int branch_offset(Label* L, bool jump_elimination_allowed); |
751 | 725 |
752 // Return the address in the constant pool of the code target address used by | 726 // Return the address in the constant pool of the code target address used by |
753 // the branch/call instruction at pc, or the object in a mov. | 727 // the branch/call instruction at pc, or the object in a mov. |
754 INLINE(static Address target_pointer_address_at(Address pc)); | 728 INLINE(static Address constant_pool_entry_address( |
755 | |
756 // Return the address in the constant pool of the code target address used by | |
757 // the branch/call instruction at pc, or the object in a mov. | |
758 INLINE(static Address target_constant_pool_address_at( | |
759 Address pc, ConstantPoolArray* constant_pool)); | 729 Address pc, ConstantPoolArray* constant_pool)); |
760 | 730 |
761 // Read/Modify the code target address in the branch/call instruction at pc. | 731 // Read/Modify the code target address in the branch/call instruction at pc. |
762 INLINE(static Address target_address_at(Address pc, | 732 INLINE(static Address target_address_at(Address pc, |
763 ConstantPoolArray* constant_pool)); | 733 ConstantPoolArray* constant_pool)); |
764 INLINE(static void set_target_address_at(Address pc, | 734 INLINE(static void set_target_address_at(Address pc, |
765 ConstantPoolArray* constant_pool, | 735 ConstantPoolArray* constant_pool, |
766 Address target, | 736 Address target, |
767 ICacheFlushMode icache_flush_mode = | 737 ICacheFlushMode icache_flush_mode = |
768 FLUSH_ICACHE_IF_NEEDED)); | 738 FLUSH_ICACHE_IF_NEEDED)); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 } | 1353 } |
1384 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } | 1354 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } |
1385 static void instr_at_put(byte* pc, Instr instr) { | 1355 static void instr_at_put(byte* pc, Instr instr) { |
1386 *reinterpret_cast<Instr*>(pc) = instr; | 1356 *reinterpret_cast<Instr*>(pc) = instr; |
1387 } | 1357 } |
1388 static Condition GetCondition(Instr instr); | 1358 static Condition GetCondition(Instr instr); |
1389 static bool IsBranch(Instr instr); | 1359 static bool IsBranch(Instr instr); |
1390 static int GetBranchOffset(Instr instr); | 1360 static int GetBranchOffset(Instr instr); |
1391 static bool IsLdrRegisterImmediate(Instr instr); | 1361 static bool IsLdrRegisterImmediate(Instr instr); |
1392 static bool IsVldrDRegisterImmediate(Instr instr); | 1362 static bool IsVldrDRegisterImmediate(Instr instr); |
| 1363 static Instr GetConsantPoolLoadPattern(); |
1393 static bool IsLdrPpImmediateOffset(Instr instr); | 1364 static bool IsLdrPpImmediateOffset(Instr instr); |
1394 static bool IsVldrDPpImmediateOffset(Instr instr); | 1365 static bool IsVldrDPpImmediateOffset(Instr instr); |
1395 static int GetLdrRegisterImmediateOffset(Instr instr); | 1366 static int GetLdrRegisterImmediateOffset(Instr instr); |
1396 static int GetVldrDRegisterImmediateOffset(Instr instr); | 1367 static int GetVldrDRegisterImmediateOffset(Instr instr); |
1397 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); | 1368 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); |
1398 static Instr SetVldrDRegisterImmediateOffset(Instr instr, int offset); | 1369 static Instr SetVldrDRegisterImmediateOffset(Instr instr, int offset); |
1399 static bool IsStrRegisterImmediate(Instr instr); | 1370 static bool IsStrRegisterImmediate(Instr instr); |
1400 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); | 1371 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); |
1401 static bool IsAddRegisterImmediate(Instr instr); | 1372 static bool IsAddRegisterImmediate(Instr instr); |
1402 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); | 1373 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); |
1403 static Register GetRd(Instr instr); | 1374 static Register GetRd(Instr instr); |
1404 static Register GetRn(Instr instr); | 1375 static Register GetRn(Instr instr); |
1405 static Register GetRm(Instr instr); | 1376 static Register GetRm(Instr instr); |
1406 static bool IsPush(Instr instr); | 1377 static bool IsPush(Instr instr); |
1407 static bool IsPop(Instr instr); | 1378 static bool IsPop(Instr instr); |
1408 static bool IsStrRegFpOffset(Instr instr); | 1379 static bool IsStrRegFpOffset(Instr instr); |
1409 static bool IsLdrRegFpOffset(Instr instr); | 1380 static bool IsLdrRegFpOffset(Instr instr); |
1410 static bool IsStrRegFpNegOffset(Instr instr); | 1381 static bool IsStrRegFpNegOffset(Instr instr); |
1411 static bool IsLdrRegFpNegOffset(Instr instr); | 1382 static bool IsLdrRegFpNegOffset(Instr instr); |
1412 static bool IsLdrPcImmediateOffset(Instr instr); | 1383 static bool IsLdrPcImmediateOffset(Instr instr); |
1413 static bool IsVldrDPcImmediateOffset(Instr instr); | 1384 static bool IsVldrDPcImmediateOffset(Instr instr); |
| 1385 static bool IsBlxReg(Instr instr); |
| 1386 static bool IsBlxIp(Instr instr); |
1414 static bool IsTstImmediate(Instr instr); | 1387 static bool IsTstImmediate(Instr instr); |
1415 static bool IsCmpRegister(Instr instr); | 1388 static bool IsCmpRegister(Instr instr); |
1416 static bool IsCmpImmediate(Instr instr); | 1389 static bool IsCmpImmediate(Instr instr); |
1417 static Register GetCmpImmediateRegister(Instr instr); | 1390 static Register GetCmpImmediateRegister(Instr instr); |
1418 static int GetCmpImmediateRawImmediate(Instr instr); | 1391 static int GetCmpImmediateRawImmediate(Instr instr); |
1419 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); | 1392 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); |
1420 static bool IsMovT(Instr instr); | 1393 static bool IsMovT(Instr instr); |
1421 static bool IsMovW(Instr instr); | 1394 static bool IsMovW(Instr instr); |
1422 | 1395 |
1423 // Constants in pools are accessed via pc relative addressing, which can | 1396 // Constants in pools are accessed via pc relative addressing, which can |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 public: | 1602 public: |
1630 explicit EnsureSpace(Assembler* assembler) { | 1603 explicit EnsureSpace(Assembler* assembler) { |
1631 assembler->CheckBuffer(); | 1604 assembler->CheckBuffer(); |
1632 } | 1605 } |
1633 }; | 1606 }; |
1634 | 1607 |
1635 | 1608 |
1636 } } // namespace v8::internal | 1609 } } // namespace v8::internal |
1637 | 1610 |
1638 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1611 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |