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 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 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 | 1259 |
1260 | 1260 |
1261 //------- Branch and jump instructions -------- | 1261 //------- Branch and jump instructions -------- |
1262 | 1262 |
1263 void Assembler::b(int16_t offset) { | 1263 void Assembler::b(int16_t offset) { |
1264 beq(zero_reg, zero_reg, offset); | 1264 beq(zero_reg, zero_reg, offset); |
1265 } | 1265 } |
1266 | 1266 |
1267 | 1267 |
1268 void Assembler::bal(int16_t offset) { | 1268 void Assembler::bal(int16_t offset) { |
1269 positions_recorder()->WriteRecordedPositions(); | |
1270 bgezal(zero_reg, offset); | 1269 bgezal(zero_reg, offset); |
1271 } | 1270 } |
1272 | 1271 |
1273 | 1272 |
1274 void Assembler::bc(int32_t offset) { | 1273 void Assembler::bc(int32_t offset) { |
1275 DCHECK(IsMipsArchVariant(kMips32r6)); | 1274 DCHECK(IsMipsArchVariant(kMips32r6)); |
1276 GenInstrImmediate(BC, offset, CompactBranchType::COMPACT_BRANCH); | 1275 GenInstrImmediate(BC, offset, CompactBranchType::COMPACT_BRANCH); |
1277 } | 1276 } |
1278 | 1277 |
1279 | 1278 |
1280 void Assembler::balc(int32_t offset) { | 1279 void Assembler::balc(int32_t offset) { |
1281 DCHECK(IsMipsArchVariant(kMips32r6)); | 1280 DCHECK(IsMipsArchVariant(kMips32r6)); |
1282 positions_recorder()->WriteRecordedPositions(); | |
1283 GenInstrImmediate(BALC, offset, CompactBranchType::COMPACT_BRANCH); | 1281 GenInstrImmediate(BALC, offset, CompactBranchType::COMPACT_BRANCH); |
1284 } | 1282 } |
1285 | 1283 |
1286 | 1284 |
1287 void Assembler::beq(Register rs, Register rt, int16_t offset) { | 1285 void Assembler::beq(Register rs, Register rt, int16_t offset) { |
1288 BlockTrampolinePoolScope block_trampoline_pool(this); | 1286 BlockTrampolinePoolScope block_trampoline_pool(this); |
1289 GenInstrImmediate(BEQ, rs, rt, offset); | 1287 GenInstrImmediate(BEQ, rs, rt, offset); |
1290 BlockTrampolinePoolFor(1); // For associated delay slot. | 1288 BlockTrampolinePoolFor(1); // For associated delay slot. |
1291 } | 1289 } |
1292 | 1290 |
(...skipping 26 matching lines...) Expand all Loading... |
1319 DCHECK(!(rs.is(zero_reg))); | 1317 DCHECK(!(rs.is(zero_reg))); |
1320 DCHECK(!(rt.is(zero_reg))); | 1318 DCHECK(!(rt.is(zero_reg))); |
1321 DCHECK(rs.code() != rt.code()); | 1319 DCHECK(rs.code() != rt.code()); |
1322 GenInstrImmediate(BLEZL, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); | 1320 GenInstrImmediate(BLEZL, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); |
1323 } | 1321 } |
1324 | 1322 |
1325 | 1323 |
1326 void Assembler::bgezal(Register rs, int16_t offset) { | 1324 void Assembler::bgezal(Register rs, int16_t offset) { |
1327 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); | 1325 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); |
1328 BlockTrampolinePoolScope block_trampoline_pool(this); | 1326 BlockTrampolinePoolScope block_trampoline_pool(this); |
1329 positions_recorder()->WriteRecordedPositions(); | |
1330 GenInstrImmediate(REGIMM, rs, BGEZAL, offset); | 1327 GenInstrImmediate(REGIMM, rs, BGEZAL, offset); |
1331 BlockTrampolinePoolFor(1); // For associated delay slot. | 1328 BlockTrampolinePoolFor(1); // For associated delay slot. |
1332 } | 1329 } |
1333 | 1330 |
1334 | 1331 |
1335 void Assembler::bgtz(Register rs, int16_t offset) { | 1332 void Assembler::bgtz(Register rs, int16_t offset) { |
1336 BlockTrampolinePoolScope block_trampoline_pool(this); | 1333 BlockTrampolinePoolScope block_trampoline_pool(this); |
1337 GenInstrImmediate(BGTZ, rs, zero_reg, offset); | 1334 GenInstrImmediate(BGTZ, rs, zero_reg, offset); |
1338 BlockTrampolinePoolFor(1); // For associated delay slot. | 1335 BlockTrampolinePoolFor(1); // For associated delay slot. |
1339 } | 1336 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 void Assembler::bltz(Register rs, int16_t offset) { | 1387 void Assembler::bltz(Register rs, int16_t offset) { |
1391 BlockTrampolinePoolScope block_trampoline_pool(this); | 1388 BlockTrampolinePoolScope block_trampoline_pool(this); |
1392 GenInstrImmediate(REGIMM, rs, BLTZ, offset); | 1389 GenInstrImmediate(REGIMM, rs, BLTZ, offset); |
1393 BlockTrampolinePoolFor(1); // For associated delay slot. | 1390 BlockTrampolinePoolFor(1); // For associated delay slot. |
1394 } | 1391 } |
1395 | 1392 |
1396 | 1393 |
1397 void Assembler::bltzal(Register rs, int16_t offset) { | 1394 void Assembler::bltzal(Register rs, int16_t offset) { |
1398 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); | 1395 DCHECK(!IsMipsArchVariant(kMips32r6) || rs.is(zero_reg)); |
1399 BlockTrampolinePoolScope block_trampoline_pool(this); | 1396 BlockTrampolinePoolScope block_trampoline_pool(this); |
1400 positions_recorder()->WriteRecordedPositions(); | |
1401 GenInstrImmediate(REGIMM, rs, BLTZAL, offset); | 1397 GenInstrImmediate(REGIMM, rs, BLTZAL, offset); |
1402 BlockTrampolinePoolFor(1); // For associated delay slot. | 1398 BlockTrampolinePoolFor(1); // For associated delay slot. |
1403 } | 1399 } |
1404 | 1400 |
1405 | 1401 |
1406 void Assembler::bne(Register rs, Register rt, int16_t offset) { | 1402 void Assembler::bne(Register rs, Register rt, int16_t offset) { |
1407 BlockTrampolinePoolScope block_trampoline_pool(this); | 1403 BlockTrampolinePoolScope block_trampoline_pool(this); |
1408 GenInstrImmediate(BNE, rs, rt, offset); | 1404 GenInstrImmediate(BNE, rs, rt, offset); |
1409 BlockTrampolinePoolFor(1); // For associated delay slot. | 1405 BlockTrampolinePoolFor(1); // For associated delay slot. |
1410 } | 1406 } |
(...skipping 15 matching lines...) Expand all Loading... |
1426 GenInstrImmediate(DADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); | 1422 GenInstrImmediate(DADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); |
1427 } else { | 1423 } else { |
1428 GenInstrImmediate(DADDI, rt, rs, offset, CompactBranchType::COMPACT_BRANCH); | 1424 GenInstrImmediate(DADDI, rt, rs, offset, CompactBranchType::COMPACT_BRANCH); |
1429 } | 1425 } |
1430 } | 1426 } |
1431 | 1427 |
1432 | 1428 |
1433 void Assembler::blezalc(Register rt, int16_t offset) { | 1429 void Assembler::blezalc(Register rt, int16_t offset) { |
1434 DCHECK(IsMipsArchVariant(kMips32r6)); | 1430 DCHECK(IsMipsArchVariant(kMips32r6)); |
1435 DCHECK(!(rt.is(zero_reg))); | 1431 DCHECK(!(rt.is(zero_reg))); |
1436 positions_recorder()->WriteRecordedPositions(); | |
1437 GenInstrImmediate(BLEZ, zero_reg, rt, offset, | 1432 GenInstrImmediate(BLEZ, zero_reg, rt, offset, |
1438 CompactBranchType::COMPACT_BRANCH); | 1433 CompactBranchType::COMPACT_BRANCH); |
1439 } | 1434 } |
1440 | 1435 |
1441 | 1436 |
1442 void Assembler::bgezalc(Register rt, int16_t offset) { | 1437 void Assembler::bgezalc(Register rt, int16_t offset) { |
1443 DCHECK(IsMipsArchVariant(kMips32r6)); | 1438 DCHECK(IsMipsArchVariant(kMips32r6)); |
1444 DCHECK(!(rt.is(zero_reg))); | 1439 DCHECK(!(rt.is(zero_reg))); |
1445 positions_recorder()->WriteRecordedPositions(); | |
1446 GenInstrImmediate(BLEZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH); | 1440 GenInstrImmediate(BLEZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH); |
1447 } | 1441 } |
1448 | 1442 |
1449 | 1443 |
1450 void Assembler::bgezall(Register rs, int16_t offset) { | 1444 void Assembler::bgezall(Register rs, int16_t offset) { |
1451 DCHECK(!IsMipsArchVariant(kMips32r6)); | 1445 DCHECK(!IsMipsArchVariant(kMips32r6)); |
1452 DCHECK(!(rs.is(zero_reg))); | 1446 DCHECK(!(rs.is(zero_reg))); |
1453 BlockTrampolinePoolScope block_trampoline_pool(this); | 1447 BlockTrampolinePoolScope block_trampoline_pool(this); |
1454 positions_recorder()->WriteRecordedPositions(); | |
1455 GenInstrImmediate(REGIMM, rs, BGEZALL, offset); | 1448 GenInstrImmediate(REGIMM, rs, BGEZALL, offset); |
1456 BlockTrampolinePoolFor(1); // For associated delay slot. | 1449 BlockTrampolinePoolFor(1); // For associated delay slot. |
1457 } | 1450 } |
1458 | 1451 |
1459 | 1452 |
1460 void Assembler::bltzalc(Register rt, int16_t offset) { | 1453 void Assembler::bltzalc(Register rt, int16_t offset) { |
1461 DCHECK(IsMipsArchVariant(kMips32r6)); | 1454 DCHECK(IsMipsArchVariant(kMips32r6)); |
1462 DCHECK(!(rt.is(zero_reg))); | 1455 DCHECK(!(rt.is(zero_reg))); |
1463 positions_recorder()->WriteRecordedPositions(); | |
1464 GenInstrImmediate(BGTZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH); | 1456 GenInstrImmediate(BGTZ, rt, rt, offset, CompactBranchType::COMPACT_BRANCH); |
1465 } | 1457 } |
1466 | 1458 |
1467 | 1459 |
1468 void Assembler::bgtzalc(Register rt, int16_t offset) { | 1460 void Assembler::bgtzalc(Register rt, int16_t offset) { |
1469 DCHECK(IsMipsArchVariant(kMips32r6)); | 1461 DCHECK(IsMipsArchVariant(kMips32r6)); |
1470 DCHECK(!(rt.is(zero_reg))); | 1462 DCHECK(!(rt.is(zero_reg))); |
1471 positions_recorder()->WriteRecordedPositions(); | |
1472 GenInstrImmediate(BGTZ, zero_reg, rt, offset, | 1463 GenInstrImmediate(BGTZ, zero_reg, rt, offset, |
1473 CompactBranchType::COMPACT_BRANCH); | 1464 CompactBranchType::COMPACT_BRANCH); |
1474 } | 1465 } |
1475 | 1466 |
1476 | 1467 |
1477 void Assembler::beqzalc(Register rt, int16_t offset) { | 1468 void Assembler::beqzalc(Register rt, int16_t offset) { |
1478 DCHECK(IsMipsArchVariant(kMips32r6)); | 1469 DCHECK(IsMipsArchVariant(kMips32r6)); |
1479 DCHECK(!(rt.is(zero_reg))); | 1470 DCHECK(!(rt.is(zero_reg))); |
1480 positions_recorder()->WriteRecordedPositions(); | |
1481 GenInstrImmediate(ADDI, zero_reg, rt, offset, | 1471 GenInstrImmediate(ADDI, zero_reg, rt, offset, |
1482 CompactBranchType::COMPACT_BRANCH); | 1472 CompactBranchType::COMPACT_BRANCH); |
1483 } | 1473 } |
1484 | 1474 |
1485 | 1475 |
1486 void Assembler::bnezalc(Register rt, int16_t offset) { | 1476 void Assembler::bnezalc(Register rt, int16_t offset) { |
1487 DCHECK(IsMipsArchVariant(kMips32r6)); | 1477 DCHECK(IsMipsArchVariant(kMips32r6)); |
1488 DCHECK(!(rt.is(zero_reg))); | 1478 DCHECK(!(rt.is(zero_reg))); |
1489 positions_recorder()->WriteRecordedPositions(); | |
1490 GenInstrImmediate(DADDI, zero_reg, rt, offset, | 1479 GenInstrImmediate(DADDI, zero_reg, rt, offset, |
1491 CompactBranchType::COMPACT_BRANCH); | 1480 CompactBranchType::COMPACT_BRANCH); |
1492 } | 1481 } |
1493 | 1482 |
1494 | 1483 |
1495 void Assembler::beqc(Register rs, Register rt, int16_t offset) { | 1484 void Assembler::beqc(Register rs, Register rt, int16_t offset) { |
1496 DCHECK(IsMipsArchVariant(kMips32r6)); | 1485 DCHECK(IsMipsArchVariant(kMips32r6)); |
1497 DCHECK(rs.code() != rt.code() && rs.code() != 0 && rt.code() != 0); | 1486 DCHECK(rs.code() != rt.code() && rs.code() != 0 && rt.code() != 0); |
1498 if (rs.code() < rt.code()) { | 1487 if (rs.code() < rt.code()) { |
1499 GenInstrImmediate(ADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); | 1488 GenInstrImmediate(ADDI, rs, rt, offset, CompactBranchType::COMPACT_BRANCH); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 #endif | 1527 #endif |
1539 BlockTrampolinePoolScope block_trampoline_pool(this); | 1528 BlockTrampolinePoolScope block_trampoline_pool(this); |
1540 GenInstrJump(J, (target >> 2) & kImm26Mask); | 1529 GenInstrJump(J, (target >> 2) & kImm26Mask); |
1541 BlockTrampolinePoolFor(1); // For associated delay slot. | 1530 BlockTrampolinePoolFor(1); // For associated delay slot. |
1542 } | 1531 } |
1543 | 1532 |
1544 | 1533 |
1545 void Assembler::jr(Register rs) { | 1534 void Assembler::jr(Register rs) { |
1546 if (!IsMipsArchVariant(kMips32r6)) { | 1535 if (!IsMipsArchVariant(kMips32r6)) { |
1547 BlockTrampolinePoolScope block_trampoline_pool(this); | 1536 BlockTrampolinePoolScope block_trampoline_pool(this); |
1548 if (rs.is(ra)) { | |
1549 positions_recorder()->WriteRecordedPositions(); | |
1550 } | |
1551 GenInstrRegister(SPECIAL, rs, zero_reg, zero_reg, 0, JR); | 1537 GenInstrRegister(SPECIAL, rs, zero_reg, zero_reg, 0, JR); |
1552 BlockTrampolinePoolFor(1); // For associated delay slot. | 1538 BlockTrampolinePoolFor(1); // For associated delay slot. |
1553 } else { | 1539 } else { |
1554 jalr(rs, zero_reg); | 1540 jalr(rs, zero_reg); |
1555 } | 1541 } |
1556 } | 1542 } |
1557 | 1543 |
1558 | 1544 |
1559 void Assembler::jal(int32_t target) { | 1545 void Assembler::jal(int32_t target) { |
1560 #ifdef DEBUG | 1546 #ifdef DEBUG |
1561 // Get pc of delay slot. | 1547 // Get pc of delay slot. |
1562 uint32_t ipc = reinterpret_cast<uint32_t>(pc_ + 1 * kInstrSize); | 1548 uint32_t ipc = reinterpret_cast<uint32_t>(pc_ + 1 * kInstrSize); |
1563 bool in_range = ((ipc ^ static_cast<uint32_t>(target)) >> | 1549 bool in_range = ((ipc ^ static_cast<uint32_t>(target)) >> |
1564 (kImm26Bits + kImmFieldShift)) == 0; | 1550 (kImm26Bits + kImmFieldShift)) == 0; |
1565 DCHECK(in_range && ((target & 3) == 0)); | 1551 DCHECK(in_range && ((target & 3) == 0)); |
1566 #endif | 1552 #endif |
1567 BlockTrampolinePoolScope block_trampoline_pool(this); | 1553 BlockTrampolinePoolScope block_trampoline_pool(this); |
1568 positions_recorder()->WriteRecordedPositions(); | |
1569 GenInstrJump(JAL, (target >> 2) & kImm26Mask); | 1554 GenInstrJump(JAL, (target >> 2) & kImm26Mask); |
1570 BlockTrampolinePoolFor(1); // For associated delay slot. | 1555 BlockTrampolinePoolFor(1); // For associated delay slot. |
1571 } | 1556 } |
1572 | 1557 |
1573 | 1558 |
1574 void Assembler::jalr(Register rs, Register rd) { | 1559 void Assembler::jalr(Register rs, Register rd) { |
1575 DCHECK(rs.code() != rd.code()); | 1560 DCHECK(rs.code() != rd.code()); |
1576 BlockTrampolinePoolScope block_trampoline_pool(this); | 1561 BlockTrampolinePoolScope block_trampoline_pool(this); |
1577 positions_recorder()->WriteRecordedPositions(); | |
1578 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 0, JALR); | 1562 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 0, JALR); |
1579 BlockTrampolinePoolFor(1); // For associated delay slot. | 1563 BlockTrampolinePoolFor(1); // For associated delay slot. |
1580 } | 1564 } |
1581 | 1565 |
1582 | 1566 |
1583 void Assembler::jic(Register rt, int16_t offset) { | 1567 void Assembler::jic(Register rt, int16_t offset) { |
1584 DCHECK(IsMipsArchVariant(kMips32r6)); | 1568 DCHECK(IsMipsArchVariant(kMips32r6)); |
1585 GenInstrImmediate(POP66, zero_reg, rt, offset); | 1569 GenInstrImmediate(POP66, zero_reg, rt, offset); |
1586 } | 1570 } |
1587 | 1571 |
1588 | 1572 |
1589 void Assembler::jialc(Register rt, int16_t offset) { | 1573 void Assembler::jialc(Register rt, int16_t offset) { |
1590 DCHECK(IsMipsArchVariant(kMips32r6)); | 1574 DCHECK(IsMipsArchVariant(kMips32r6)); |
1591 positions_recorder()->WriteRecordedPositions(); | |
1592 GenInstrImmediate(POP76, zero_reg, rt, offset); | 1575 GenInstrImmediate(POP76, zero_reg, rt, offset); |
1593 } | 1576 } |
1594 | 1577 |
1595 | 1578 |
1596 // -------Data-processing-instructions--------- | 1579 // -------Data-processing-instructions--------- |
1597 | 1580 |
1598 // Arithmetic. | 1581 // Arithmetic. |
1599 | 1582 |
1600 void Assembler::addu(Register rd, Register rs, Register rt) { | 1583 void Assembler::addu(Register rd, Register rs, Register rt) { |
1601 GenInstrRegister(SPECIAL, rs, rt, rd, 0, ADDU); | 1584 GenInstrRegister(SPECIAL, rs, rt, rd, 0, ADDU); |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3194 | 3177 |
3195 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 3178 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
3196 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); | 3179 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); |
3197 } | 3180 } |
3198 } | 3181 } |
3199 | 3182 |
3200 } // namespace internal | 3183 } // namespace internal |
3201 } // namespace v8 | 3184 } // namespace v8 |
3202 | 3185 |
3203 #endif // V8_TARGET_ARCH_MIPS | 3186 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |