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

Side by Side Diff: src/arm/assembler-arm.cc

Issue 2454001: Fix an occasional crash in Assembler::ldr() for arm. (Closed) Base URL: git://github.com/v8/v8.git
Patch Set: fix long line Created 10 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 WriteRecordedPositions(); 1206 WriteRecordedPositions();
1207 } 1207 }
1208 addrmod2(cond | B26 | L, dst, src); 1208 addrmod2(cond | B26 | L, dst, src);
1209 1209
1210 // Eliminate pattern: push(ry), pop(rx) 1210 // Eliminate pattern: push(ry), pop(rx)
1211 // str(ry, MemOperand(sp, 4, NegPreIndex), al) 1211 // str(ry, MemOperand(sp, 4, NegPreIndex), al)
1212 // ldr(rx, MemOperand(sp, 4, PostIndex), al) 1212 // ldr(rx, MemOperand(sp, 4, PostIndex), al)
1213 // Both instructions can be eliminated if ry = rx. 1213 // Both instructions can be eliminated if ry = rx.
1214 // If ry != rx, a register copy from ry to rx is inserted 1214 // If ry != rx, a register copy from ry to rx is inserted
1215 // after eliminating the push and the pop instructions. 1215 // after eliminating the push and the pop instructions.
1216 Instr push_instr = instr_at(pc_ - 2 * kInstrSize); 1216 if (can_peephole_optimize(2)) {
1217 Instr pop_instr = instr_at(pc_ - 1 * kInstrSize); 1217 Instr push_instr = instr_at(pc_ - 2 * kInstrSize);
1218 Instr pop_instr = instr_at(pc_ - 1 * kInstrSize);
1218 1219
1219 if (can_peephole_optimize(2) && 1220 if (IsPush(push_instr) && IsPop(pop_instr)) {
1220 IsPush(push_instr) && 1221 if ((pop_instr & kRdMask) != (push_instr & kRdMask)) {
1221 IsPop(pop_instr)) { 1222 // For consecutive push and pop on different registers,
1222 if ((pop_instr & kRdMask) != (push_instr & kRdMask)) { 1223 // we delete both the push & pop and insert a register move.
1223 // For consecutive push and pop on different registers, 1224 // push ry, pop rx --> mov rx, ry
1224 // we delete both the push & pop and insert a register move. 1225 Register reg_pushed, reg_popped;
1225 // push ry, pop rx --> mov rx, ry 1226 reg_pushed = GetRd(push_instr);
1226 Register reg_pushed, reg_popped; 1227 reg_popped = GetRd(pop_instr);
1227 reg_pushed = GetRd(push_instr); 1228 pc_ -= 2 * kInstrSize;
1228 reg_popped = GetRd(pop_instr); 1229 // Insert a mov instruction, which is better than a pair of push & pop
1229 pc_ -= 2 * kInstrSize; 1230 mov(reg_popped, reg_pushed);
1230 // Insert a mov instruction, which is better than a pair of push & pop 1231 if (FLAG_print_peephole_optimization) {
1231 mov(reg_popped, reg_pushed); 1232 PrintF("%x push/pop (diff reg) replaced by a reg move\n",
1232 if (FLAG_print_peephole_optimization) { 1233 pc_offset());
1233 PrintF("%x push/pop (diff reg) replaced by a reg move\n", pc_offset()); 1234 }
1234 } 1235 } else {
1235 } else { 1236 // For consecutive push and pop on the same register,
1236 // For consecutive push and pop on the same register, 1237 // both the push and the pop can be deleted.
1237 // both the push and the pop can be deleted. 1238 pc_ -= 2 * kInstrSize;
1238 pc_ -= 2 * kInstrSize; 1239 if (FLAG_print_peephole_optimization) {
1239 if (FLAG_print_peephole_optimization) { 1240 PrintF("%x push/pop (same reg) eliminated\n", pc_offset());
1240 PrintF("%x push/pop (same reg) eliminated\n", pc_offset()); 1241 }
1241 } 1242 }
1242 } 1243 }
1243 } 1244 }
1244 1245
1245 if (can_peephole_optimize(2)) { 1246 if (can_peephole_optimize(2)) {
1246 Instr str_instr = instr_at(pc_ - 2 * kInstrSize); 1247 Instr str_instr = instr_at(pc_ - 2 * kInstrSize);
1247 Instr ldr_instr = instr_at(pc_ - 1 * kInstrSize); 1248 Instr ldr_instr = instr_at(pc_ - 1 * kInstrSize);
1248 1249
1249 if ((IsStrRegFpOffset(str_instr) && 1250 if ((IsStrRegFpOffset(str_instr) &&
1250 IsLdrRegFpOffset(ldr_instr)) || 1251 IsLdrRegFpOffset(ldr_instr)) ||
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 2270
2270 // Since a constant pool was just emitted, move the check offset forward by 2271 // Since a constant pool was just emitted, move the check offset forward by
2271 // the standard interval. 2272 // the standard interval.
2272 next_buffer_check_ = pc_offset() + kCheckConstInterval; 2273 next_buffer_check_ = pc_offset() + kCheckConstInterval;
2273 } 2274 }
2274 2275
2275 2276
2276 } } // namespace v8::internal 2277 } } // namespace v8::internal
2277 2278
2278 #endif // V8_TARGET_ARCH_ARM 2279 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698