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

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

Issue 2072963003: Simplify AssemblerPositionsRecorder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
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 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1286
1287 1287
1288 //------- Branch and jump instructions -------- 1288 //------- Branch and jump instructions --------
1289 1289
1290 void Assembler::b(int16_t offset) { 1290 void Assembler::b(int16_t offset) {
1291 beq(zero_reg, zero_reg, offset); 1291 beq(zero_reg, zero_reg, offset);
1292 } 1292 }
1293 1293
1294 1294
1295 void Assembler::bal(int16_t offset) { 1295 void Assembler::bal(int16_t offset) {
1296 positions_recorder()->WriteRecordedPositions();
1297 bgezal(zero_reg, offset); 1296 bgezal(zero_reg, offset);
1298 } 1297 }
1299 1298
1300 1299
1301 void Assembler::bc(int32_t offset) { 1300 void Assembler::bc(int32_t offset) {
1302 DCHECK(IsMipsArchVariant(kMips32r6)); 1301 DCHECK(IsMipsArchVariant(kMips32r6));
1303 GenInstrImmediate(BC, offset, CompactBranchType::COMPACT_BRANCH); 1302 GenInstrImmediate(BC, offset, CompactBranchType::COMPACT_BRANCH);
1304 } 1303 }
1305 1304
1306 1305
1307 void Assembler::balc(int32_t offset) { 1306 void Assembler::balc(int32_t offset) {
1308 DCHECK(IsMipsArchVariant(kMips32r6)); 1307 DCHECK(IsMipsArchVariant(kMips32r6));
1309 positions_recorder()->WriteRecordedPositions();
1310 GenInstrImmediate(BALC, offset, CompactBranchType::COMPACT_BRANCH); 1308 GenInstrImmediate(BALC, offset, CompactBranchType::COMPACT_BRANCH);
1311 } 1309 }
1312 1310
1313 1311
1314 void Assembler::beq(Register rs, Register rt, int16_t offset) { 1312 void Assembler::beq(Register rs, Register rt, int16_t offset) {
1315 BlockTrampolinePoolScope block_trampoline_pool(this); 1313 BlockTrampolinePoolScope block_trampoline_pool(this);
1316 GenInstrImmediate(BEQ, rs, rt, offset); 1314 GenInstrImmediate(BEQ, rs, rt, offset);
1317 BlockTrampolinePoolFor(1); // For associated delay slot. 1315 BlockTrampolinePoolFor(1); // For associated delay slot.
1318 } 1316 }
1319 1317
(...skipping 26 matching lines...) Expand all
1346 DCHECK(!(rs.is(zero_reg))); 1344 DCHECK(!(rs.is(zero_reg)));
1347 DCHECK(!(rt.is(zero_reg))); 1345 DCHECK(!(rt.is(zero_reg)));
1348 DCHECK(rs.code() != rt.code()); 1346 DCHECK(rs.code() != rt.code());
1349 GenInstrImmediate(BLEZL, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); 1347 GenInstrImmediate(BLEZL, rs, rt, offset, CompactBranchType::COMPACT_BRANCH);
1350 } 1348 }
1351 1349
1352 1350
1353 void Assembler::bgezal(Register rs, int16_t offset) { 1351 void Assembler::bgezal(Register rs, int16_t offset) {
1354 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); 1352 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg));
1355 BlockTrampolinePoolScope block_trampoline_pool(this); 1353 BlockTrampolinePoolScope block_trampoline_pool(this);
1356 positions_recorder()->WriteRecordedPositions();
1357 GenInstrImmediate(REGIMM, rs, BGEZAL, offset); 1354 GenInstrImmediate(REGIMM, rs, BGEZAL, offset);
1358 BlockTrampolinePoolFor(1); // For associated delay slot. 1355 BlockTrampolinePoolFor(1); // For associated delay slot.
1359 } 1356 }
1360 1357
1361 1358
1362 void Assembler::bgtz(Register rs, int16_t offset) { 1359 void Assembler::bgtz(Register rs, int16_t offset) {
1363 BlockTrampolinePoolScope block_trampoline_pool(this); 1360 BlockTrampolinePoolScope block_trampoline_pool(this);
1364 GenInstrImmediate(BGTZ, rs, zero_reg, offset); 1361 GenInstrImmediate(BGTZ, rs, zero_reg, offset);
1365 BlockTrampolinePoolFor(1); // For associated delay slot. 1362 BlockTrampolinePoolFor(1); // For associated delay slot.
1366 } 1363 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 void Assembler::bltz(Register rs, int16_t offset) { 1414 void Assembler::bltz(Register rs, int16_t offset) {
1418 BlockTrampolinePoolScope block_trampoline_pool(this); 1415 BlockTrampolinePoolScope block_trampoline_pool(this);
1419 GenInstrImmediate(REGIMM, rs, BLTZ, offset); 1416 GenInstrImmediate(REGIMM, rs, BLTZ, offset);
1420 BlockTrampolinePoolFor(1); // For associated delay slot. 1417 BlockTrampolinePoolFor(1); // For associated delay slot.
1421 } 1418 }
1422 1419
1423 1420
1424 void Assembler::bltzal(Register rs, int16_t offset) { 1421 void Assembler::bltzal(Register rs, int16_t offset) {
1425 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); 1422 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg));
1426 BlockTrampolinePoolScope block_trampoline_pool(this); 1423 BlockTrampolinePoolScope block_trampoline_pool(this);
1427 positions_recorder()->WriteRecordedPositions();
1428 GenInstrImmediate(REGIMM, rs, BLTZAL, offset); 1424 GenInstrImmediate(REGIMM, rs, BLTZAL, offset);
1429 BlockTrampolinePoolFor(1); // For associated delay slot. 1425 BlockTrampolinePoolFor(1); // For associated delay slot.
1430 } 1426 }
1431 1427
1432 1428
1433 void Assembler::bne(Register rs, Register rt, int16_t offset) { 1429 void Assembler::bne(Register rs, Register rt, int16_t offset) {
1434 BlockTrampolinePoolScope block_trampoline_pool(this); 1430 BlockTrampolinePoolScope block_trampoline_pool(this);
1435 GenInstrImmediate(BNE, rs, rt, offset); 1431 GenInstrImmediate(BNE, rs, rt, offset);
1436 BlockTrampolinePoolFor(1); // For associated delay slot. 1432 BlockTrampolinePoolFor(1); // For associated delay slot.
1437 } 1433 }
(...skipping 15 matching lines...) Expand all
1453 GenInstrImmediate(DADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); 1449 GenInstrImmediate(DADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH);
1454 } else { 1450 } else {
1455 GenInstrImmediate(DADDI, rt, rs, offset, CompactBranchType::COMPACT_BRANCH); 1451 GenInstrImmediate(DADDI, rt, rs, offset, CompactBranchType::COMPACT_BRANCH);
1456 } 1452 }
1457 } 1453 }
1458 1454
1459 1455
1460 void Assembler::blezalc(Register rt, int16_t offset) { 1456 void Assembler::blezalc(Register rt, int16_t offset) {
1461 DCHECK(IsMipsArchVariant(kMips32r6)); 1457 DCHECK(IsMipsArchVariant(kMips32r6));
1462 DCHECK(!(rt.is(zero_reg))); 1458 DCHECK(!(rt.is(zero_reg)));
1463 positions_recorder()->WriteRecordedPositions();
1464 GenInstrImmediate(BLEZ, zero_reg, rt, offset, 1459 GenInstrImmediate(BLEZ, zero_reg, rt, offset,
1465 CompactBranchType::COMPACT_BRANCH); 1460 CompactBranchType::COMPACT_BRANCH);
1466 } 1461 }
1467 1462
1468 1463
1469 void Assembler::bgezalc(Register rt, int16_t offset) { 1464 void Assembler::bgezalc(Register rt, int16_t offset) {
1470 DCHECK(IsMipsArchVariant(kMips32r6)); 1465 DCHECK(IsMipsArchVariant(kMips32r6));
1471 DCHECK(!(rt.is(zero_reg))); 1466 DCHECK(!(rt.is(zero_reg)));
1472 positions_recorder()->WriteRecordedPositions();
1473 GenInstrImmediate(BLEZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH); 1467 GenInstrImmediate(BLEZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH);
1474 } 1468 }
1475 1469
1476 1470
1477 void Assembler::bgezall(Register rs, int16_t offset) { 1471 void Assembler::bgezall(Register rs, int16_t offset) {
1478 DCHECK(!IsMipsArchVariant(kMips32r6)); 1472 DCHECK(!IsMipsArchVariant(kMips32r6));
1479 DCHECK(!(rs.is(zero_reg))); 1473 DCHECK(!(rs.is(zero_reg)));
1480 BlockTrampolinePoolScope block_trampoline_pool(this); 1474 BlockTrampolinePoolScope block_trampoline_pool(this);
1481 positions_recorder()->WriteRecordedPositions();
1482 GenInstrImmediate(REGIMM, rs, BGEZALL, offset); 1475 GenInstrImmediate(REGIMM, rs, BGEZALL, offset);
1483 BlockTrampolinePoolFor(1); // For associated delay slot. 1476 BlockTrampolinePoolFor(1); // For associated delay slot.
1484 } 1477 }
1485 1478
1486 1479
1487 void Assembler::bltzalc(Register rt, int16_t offset) { 1480 void Assembler::bltzalc(Register rt, int16_t offset) {
1488 DCHECK(IsMipsArchVariant(kMips32r6)); 1481 DCHECK(IsMipsArchVariant(kMips32r6));
1489 DCHECK(!(rt.is(zero_reg))); 1482 DCHECK(!(rt.is(zero_reg)));
1490 positions_recorder()->WriteRecordedPositions();
1491 GenInstrImmediate(BGTZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH); 1483 GenInstrImmediate(BGTZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH);
1492 } 1484 }
1493 1485
1494 1486
1495 void Assembler::bgtzalc(Register rt, int16_t offset) { 1487 void Assembler::bgtzalc(Register rt, int16_t offset) {
1496 DCHECK(IsMipsArchVariant(kMips32r6)); 1488 DCHECK(IsMipsArchVariant(kMips32r6));
1497 DCHECK(!(rt.is(zero_reg))); 1489 DCHECK(!(rt.is(zero_reg)));
1498 positions_recorder()->WriteRecordedPositions();
1499 GenInstrImmediate(BGTZ, zero_reg, rt, offset, 1490 GenInstrImmediate(BGTZ, zero_reg, rt, offset,
1500 CompactBranchType::COMPACT_BRANCH); 1491 CompactBranchType::COMPACT_BRANCH);
1501 } 1492 }
1502 1493
1503 1494
1504 void Assembler::beqzalc(Register rt, int16_t offset) { 1495 void Assembler::beqzalc(Register rt, int16_t offset) {
1505 DCHECK(IsMipsArchVariant(kMips32r6)); 1496 DCHECK(IsMipsArchVariant(kMips32r6));
1506 DCHECK(!(rt.is(zero_reg))); 1497 DCHECK(!(rt.is(zero_reg)));
1507 positions_recorder()->WriteRecordedPositions();
1508 GenInstrImmediate(ADDI, zero_reg, rt, offset, 1498 GenInstrImmediate(ADDI, zero_reg, rt, offset,
1509 CompactBranchType::COMPACT_BRANCH); 1499 CompactBranchType::COMPACT_BRANCH);
1510 } 1500 }
1511 1501
1512 1502
1513 void Assembler::bnezalc(Register rt, int16_t offset) { 1503 void Assembler::bnezalc(Register rt, int16_t offset) {
1514 DCHECK(IsMipsArchVariant(kMips32r6)); 1504 DCHECK(IsMipsArchVariant(kMips32r6));
1515 DCHECK(!(rt.is(zero_reg))); 1505 DCHECK(!(rt.is(zero_reg)));
1516 positions_recorder()->WriteRecordedPositions();
1517 GenInstrImmediate(DADDI, zero_reg, rt, offset, 1506 GenInstrImmediate(DADDI, zero_reg, rt, offset,
1518 CompactBranchType::COMPACT_BRANCH); 1507 CompactBranchType::COMPACT_BRANCH);
1519 } 1508 }
1520 1509
1521 1510
1522 void Assembler::beqc(Register rs, Register rt, int16_t offset) { 1511 void Assembler::beqc(Register rs, Register rt, int16_t offset) {
1523 DCHECK(IsMipsArchVariant(kMips32r6)); 1512 DCHECK(IsMipsArchVariant(kMips32r6));
1524 DCHECK(rs.code() != rt.code() && rs.code() != 0 && rt.code() != 0); 1513 DCHECK(rs.code() != rt.code() && rs.code() != 0 && rt.code() != 0);
1525 if (rs.code() < rt.code()) { 1514 if (rs.code() < rt.code()) {
1526 GenInstrImmediate(ADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); 1515 GenInstrImmediate(ADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 #endif 1554 #endif
1566 BlockTrampolinePoolScope block_trampoline_pool(this); 1555 BlockTrampolinePoolScope block_trampoline_pool(this);
1567 GenInstrJump(J, (target >> 2) & kImm26Mask); 1556 GenInstrJump(J, (target >> 2) & kImm26Mask);
1568 BlockTrampolinePoolFor(1); // For associated delay slot. 1557 BlockTrampolinePoolFor(1); // For associated delay slot.
1569 } 1558 }
1570 1559
1571 1560
1572 void Assembler::jr(Register rs) { 1561 void Assembler::jr(Register rs) {
1573 if (!IsMipsArchVariant(kMips32r6)) { 1562 if (!IsMipsArchVariant(kMips32r6)) {
1574 BlockTrampolinePoolScope block_trampoline_pool(this); 1563 BlockTrampolinePoolScope block_trampoline_pool(this);
1575 if (rs.is(ra)) {
1576 positions_recorder()->WriteRecordedPositions();
1577 }
1578 GenInstrRegister(SPECIAL, rs, zero_reg, zero_reg, 0, JR); 1564 GenInstrRegister(SPECIAL, rs, zero_reg, zero_reg, 0, JR);
1579 BlockTrampolinePoolFor(1); // For associated delay slot. 1565 BlockTrampolinePoolFor(1); // For associated delay slot.
1580 } else { 1566 } else {
1581 jalr(rs, zero_reg); 1567 jalr(rs, zero_reg);
1582 } 1568 }
1583 } 1569 }
1584 1570
1585 1571
1586 void Assembler::jal(int32_t target) { 1572 void Assembler::jal(int32_t target) {
1587 #ifdef DEBUG 1573 #ifdef DEBUG
1588 // Get pc of delay slot. 1574 // Get pc of delay slot.
1589 uint32_t ipc = reinterpret_cast<uint32_t>(pc_ + 1 * kInstrSize); 1575 uint32_t ipc = reinterpret_cast<uint32_t>(pc_ + 1 * kInstrSize);
1590 bool in_range = ((ipc ^ static_cast<uint32_t>(target)) >> 1576 bool in_range = ((ipc ^ static_cast<uint32_t>(target)) >>
1591 (kImm26Bits + kImmFieldShift)) == 0; 1577 (kImm26Bits + kImmFieldShift)) == 0;
1592 DCHECK(in_range && ((target & 3) == 0)); 1578 DCHECK(in_range && ((target & 3) == 0));
1593 #endif 1579 #endif
1594 BlockTrampolinePoolScope block_trampoline_pool(this); 1580 BlockTrampolinePoolScope block_trampoline_pool(this);
1595 positions_recorder()->WriteRecordedPositions();
1596 GenInstrJump(JAL, (target >> 2) & kImm26Mask); 1581 GenInstrJump(JAL, (target >> 2) & kImm26Mask);
1597 BlockTrampolinePoolFor(1); // For associated delay slot. 1582 BlockTrampolinePoolFor(1); // For associated delay slot.
1598 } 1583 }
1599 1584
1600 1585
1601 void Assembler::jalr(Register rs, Register rd) { 1586 void Assembler::jalr(Register rs, Register rd) {
1602 DCHECK(rs.code() != rd.code()); 1587 DCHECK(rs.code() != rd.code());
1603 BlockTrampolinePoolScope block_trampoline_pool(this); 1588 BlockTrampolinePoolScope block_trampoline_pool(this);
1604 positions_recorder()->WriteRecordedPositions();
1605 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 0, JALR); 1589 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 0, JALR);
1606 BlockTrampolinePoolFor(1); // For associated delay slot. 1590 BlockTrampolinePoolFor(1); // For associated delay slot.
1607 } 1591 }
1608 1592
1609 1593
1610 void Assembler::jic(Register rt, int16_t offset) { 1594 void Assembler::jic(Register rt, int16_t offset) {
1611 DCHECK(IsMipsArchVariant(kMips32r6)); 1595 DCHECK(IsMipsArchVariant(kMips32r6));
1612 GenInstrImmediate(POP66, zero_reg, rt, offset); 1596 GenInstrImmediate(POP66, zero_reg, rt, offset);
1613 } 1597 }
1614 1598
1615 1599
1616 void Assembler::jialc(Register rt, int16_t offset) { 1600 void Assembler::jialc(Register rt, int16_t offset) {
1617 DCHECK(IsMipsArchVariant(kMips32r6)); 1601 DCHECK(IsMipsArchVariant(kMips32r6));
1618 positions_recorder()->WriteRecordedPositions();
1619 GenInstrImmediate(POP76, zero_reg, rt, offset); 1602 GenInstrImmediate(POP76, zero_reg, rt, offset);
1620 } 1603 }
1621 1604
1622 1605
1623 // -------Data-processing-instructions--------- 1606 // -------Data-processing-instructions---------
1624 1607
1625 // Arithmetic. 1608 // Arithmetic.
1626 1609
1627 void Assembler::addu(Register rd, Register rs, Register rt) { 1610 void Assembler::addu(Register rd, Register rs, Register rt) {
1628 GenInstrRegister(SPECIAL, rs, rt, rd, 0, ADDU); 1611 GenInstrRegister(SPECIAL, rs, rt, rd, 0, ADDU);
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 3204
3222 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3205 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3223 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); 3206 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t));
3224 } 3207 }
3225 } 3208 }
3226 3209
3227 } // namespace internal 3210 } // namespace internal
3228 } // namespace v8 3211 } // namespace v8
3229 3212
3230 #endif // V8_TARGET_ARCH_MIPS 3213 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698