| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 // Here we are patching the address in the constant pool, not the actual call | 656 // Here we are patching the address in the constant pool, not the actual call |
| 657 // instruction. The address in the constant pool is the same size as a | 657 // instruction. The address in the constant pool is the same size as a |
| 658 // pointer. | 658 // pointer. |
| 659 static const int kSpecialTargetSize = kPointerSize; | 659 static const int kSpecialTargetSize = kPointerSize; |
| 660 | 660 |
| 661 // Size of an instruction. | 661 // Size of an instruction. |
| 662 static const int kInstrSize = sizeof(Instr); | 662 static const int kInstrSize = sizeof(Instr); |
| 663 | 663 |
| 664 // Distance between start of patched return sequence and the emitted address | 664 // Distance between start of patched return sequence and the emitted address |
| 665 // to jump to. | 665 // to jump to. |
| 666 #ifdef USE_BLX | |
| 667 // Patched return sequence is: | 666 // Patched return sequence is: |
| 668 // ldr ip, [pc, #0] @ emited address and start | 667 // ldr ip, [pc, #0] @ emited address and start |
| 669 // blx ip | 668 // blx ip |
| 670 static const int kPatchReturnSequenceAddressOffset = 0 * kInstrSize; | 669 static const int kPatchReturnSequenceAddressOffset = 0 * kInstrSize; |
| 671 #else | |
| 672 // Patched return sequence is: | |
| 673 // mov lr, pc @ start of sequence | |
| 674 // ldr pc, [pc, #-4] @ emited address | |
| 675 static const int kPatchReturnSequenceAddressOffset = kInstrSize; | |
| 676 #endif | |
| 677 | 670 |
| 678 // Distance between start of patched debug break slot and the emitted address | 671 // Distance between start of patched debug break slot and the emitted address |
| 679 // to jump to. | 672 // to jump to. |
| 680 #ifdef USE_BLX | |
| 681 // Patched debug break slot code is: | 673 // Patched debug break slot code is: |
| 682 // ldr ip, [pc, #0] @ emited address and start | 674 // ldr ip, [pc, #0] @ emited address and start |
| 683 // blx ip | 675 // blx ip |
| 684 static const int kPatchDebugBreakSlotAddressOffset = 0 * kInstrSize; | 676 static const int kPatchDebugBreakSlotAddressOffset = 0 * kInstrSize; |
| 685 #else | |
| 686 // Patched debug break slot code is: | |
| 687 // mov lr, pc @ start of sequence | |
| 688 // ldr pc, [pc, #-4] @ emited address | |
| 689 static const int kPatchDebugBreakSlotAddressOffset = kInstrSize; | |
| 690 #endif | |
| 691 | 677 |
| 692 #ifdef USE_BLX | |
| 693 static const int kPatchDebugBreakSlotReturnOffset = 2 * kInstrSize; | 678 static const int kPatchDebugBreakSlotReturnOffset = 2 * kInstrSize; |
| 694 #else | |
| 695 static const int kPatchDebugBreakSlotReturnOffset = kInstrSize; | |
| 696 #endif | |
| 697 | 679 |
| 698 // Difference between address of current opcode and value read from pc | 680 // Difference between address of current opcode and value read from pc |
| 699 // register. | 681 // register. |
| 700 static const int kPcLoadDelta = 8; | 682 static const int kPcLoadDelta = 8; |
| 701 | 683 |
| 702 static const int kJSReturnSequenceInstructions = 4; | 684 static const int kJSReturnSequenceInstructions = 4; |
| 703 static const int kDebugBreakSlotInstructions = 3; | 685 static const int kDebugBreakSlotInstructions = 3; |
| 704 static const int kDebugBreakSlotLength = | 686 static const int kDebugBreakSlotLength = |
| 705 kDebugBreakSlotInstructions * kInstrSize; | 687 kDebugBreakSlotInstructions * kInstrSize; |
| 706 | 688 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 | 1105 |
| 1124 void pop() { | 1106 void pop() { |
| 1125 add(sp, sp, Operand(kPointerSize)); | 1107 add(sp, sp, Operand(kPointerSize)); |
| 1126 } | 1108 } |
| 1127 | 1109 |
| 1128 // Jump unconditionally to given label. | 1110 // Jump unconditionally to given label. |
| 1129 void jmp(Label* L) { b(L, al); } | 1111 void jmp(Label* L) { b(L, al); } |
| 1130 | 1112 |
| 1131 static bool use_immediate_embedded_pointer_loads( | 1113 static bool use_immediate_embedded_pointer_loads( |
| 1132 const Assembler* assembler) { | 1114 const Assembler* assembler) { |
| 1133 #ifdef USE_BLX | |
| 1134 return CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && | 1115 return CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && |
| 1135 (assembler == NULL || !assembler->predictable_code_size()); | 1116 (assembler == NULL || !assembler->predictable_code_size()); |
| 1136 #else | |
| 1137 // If not using BLX, all loads from the constant pool cannot be immediate, | |
| 1138 // because the ldr pc, [pc + #xxxx] used for calls must be a single | |
| 1139 // instruction and cannot be easily distinguished out of context from | |
| 1140 // other loads that could use movw/movt. | |
| 1141 return false; | |
| 1142 #endif | |
| 1143 } | 1117 } |
| 1144 | 1118 |
| 1145 // Check the code size generated from label to here. | 1119 // Check the code size generated from label to here. |
| 1146 int SizeOfCodeGeneratedSince(Label* label) { | 1120 int SizeOfCodeGeneratedSince(Label* label) { |
| 1147 return pc_offset() - label->pos(); | 1121 return pc_offset() - label->pos(); |
| 1148 } | 1122 } |
| 1149 | 1123 |
| 1150 // Check the number of instructions generated from label to here. | 1124 // Check the number of instructions generated from label to here. |
| 1151 int InstructionsGeneratedSince(Label* label) { | 1125 int InstructionsGeneratedSince(Label* label) { |
| 1152 return SizeOfCodeGeneratedSince(label) / kInstrSize; | 1126 return SizeOfCodeGeneratedSince(label) / kInstrSize; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 public: | 1414 public: |
| 1441 explicit EnsureSpace(Assembler* assembler) { | 1415 explicit EnsureSpace(Assembler* assembler) { |
| 1442 assembler->CheckBuffer(); | 1416 assembler->CheckBuffer(); |
| 1443 } | 1417 } |
| 1444 }; | 1418 }; |
| 1445 | 1419 |
| 1446 | 1420 |
| 1447 } } // namespace v8::internal | 1421 } } // namespace v8::internal |
| 1448 | 1422 |
| 1449 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1423 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |