OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 emit(0x0F); | 1132 emit(0x0F); |
1133 emit(0x80 | cc); | 1133 emit(0x80 | cc); |
1134 emit_code_target(target, rmode); | 1134 emit_code_target(target, rmode); |
1135 } | 1135 } |
1136 | 1136 |
1137 | 1137 |
1138 void Assembler::jmp(Label* L) { | 1138 void Assembler::jmp(Label* L) { |
1139 EnsureSpace ensure_space(this); | 1139 EnsureSpace ensure_space(this); |
1140 last_pc_ = pc_; | 1140 last_pc_ = pc_; |
1141 if (L->is_bound()) { | 1141 if (L->is_bound()) { |
| 1142 const int short_size = sizeof(int8_t); |
| 1143 const int long_size = sizeof(int32_t); |
1142 int offs = L->pos() - pc_offset() - 1; | 1144 int offs = L->pos() - pc_offset() - 1; |
1143 ASSERT(offs <= 0); | 1145 ASSERT(offs <= 0); |
1144 if (is_int8(offs - sizeof(int8_t))) { | 1146 if (is_int8(offs - short_size)) { |
1145 // 1110 1011 #8-bit disp. | 1147 // 1110 1011 #8-bit disp. |
1146 emit(0xEB); | 1148 emit(0xEB); |
1147 emit((offs - sizeof(int8_t)) & 0xFF); | 1149 emit((offs - short_size) & 0xFF); |
1148 } else { | 1150 } else { |
1149 // 1110 1001 #32-bit disp. | 1151 // 1110 1001 #32-bit disp. |
1150 emit(0xE9); | 1152 emit(0xE9); |
1151 emitl(offs - sizeof(int32_t)); | 1153 emitl(offs - long_size); |
1152 } | 1154 } |
1153 } else if (L->is_linked()) { | 1155 } else if (L->is_linked()) { |
1154 // 1110 1001 #32-bit disp. | 1156 // 1110 1001 #32-bit disp. |
1155 emit(0xE9); | 1157 emit(0xE9); |
1156 emitl(L->pos()); | 1158 emitl(L->pos()); |
1157 L->link_to(pc_offset() - sizeof(int32_t)); | 1159 L->link_to(pc_offset() - long_size); |
1158 } else { | 1160 } else { |
1159 // 1110 1001 #32-bit disp. | 1161 // 1110 1001 #32-bit disp. |
1160 ASSERT(L->is_unused()); | 1162 ASSERT(L->is_unused()); |
1161 emit(0xE9); | 1163 emit(0xE9); |
1162 int32_t current = pc_offset(); | 1164 int32_t current = pc_offset(); |
1163 emitl(current); | 1165 emitl(current); |
1164 L->link_to(current); | 1166 L->link_to(current); |
1165 } | 1167 } |
1166 } | 1168 } |
1167 | 1169 |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 written_position_ = current_position_; | 2650 written_position_ = current_position_; |
2649 } | 2651 } |
2650 } | 2652 } |
2651 | 2653 |
2652 | 2654 |
2653 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | | 2655 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | |
2654 1 << RelocInfo::INTERNAL_REFERENCE | | 2656 1 << RelocInfo::INTERNAL_REFERENCE | |
2655 1 << RelocInfo::JS_RETURN; | 2657 1 << RelocInfo::JS_RETURN; |
2656 | 2658 |
2657 } } // namespace v8::internal | 2659 } } // namespace v8::internal |
OLD | NEW |