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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 emit_disp(L, Displacement::OTHER); | 1418 emit_disp(L, Displacement::OTHER); |
1419 } | 1419 } |
1420 } | 1420 } |
1421 | 1421 |
1422 | 1422 |
1423 void Assembler::call(byte* entry, RelocInfo::Mode rmode) { | 1423 void Assembler::call(byte* entry, RelocInfo::Mode rmode) { |
1424 positions_recorder()->WriteRecordedPositions(); | 1424 positions_recorder()->WriteRecordedPositions(); |
1425 EnsureSpace ensure_space(this); | 1425 EnsureSpace ensure_space(this); |
1426 ASSERT(!RelocInfo::IsCodeTarget(rmode)); | 1426 ASSERT(!RelocInfo::IsCodeTarget(rmode)); |
1427 EMIT(0xE8); | 1427 EMIT(0xE8); |
1428 emit(entry - (pc_ + sizeof(int32_t)), rmode); | 1428 if (RelocInfo::IsRuntimeEntry(rmode)) { |
| 1429 emit(reinterpret_cast<uint32_t>(entry), rmode); |
| 1430 } else { |
| 1431 emit(entry - (pc_ + sizeof(int32_t)), rmode); |
| 1432 } |
1429 } | 1433 } |
1430 | 1434 |
1431 | 1435 |
1432 int Assembler::CallSize(const Operand& adr) { | 1436 int Assembler::CallSize(const Operand& adr) { |
1433 // Call size is 1 (opcode) + adr.len_ (operand). | 1437 // Call size is 1 (opcode) + adr.len_ (operand). |
1434 return 1 + adr.len_; | 1438 return 1 + adr.len_; |
1435 } | 1439 } |
1436 | 1440 |
1437 | 1441 |
1438 void Assembler::call(const Operand& adr) { | 1442 void Assembler::call(const Operand& adr) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 EMIT(0xE9); | 1487 EMIT(0xE9); |
1484 emit_disp(L, Displacement::UNCONDITIONAL_JUMP); | 1488 emit_disp(L, Displacement::UNCONDITIONAL_JUMP); |
1485 } | 1489 } |
1486 } | 1490 } |
1487 | 1491 |
1488 | 1492 |
1489 void Assembler::jmp(byte* entry, RelocInfo::Mode rmode) { | 1493 void Assembler::jmp(byte* entry, RelocInfo::Mode rmode) { |
1490 EnsureSpace ensure_space(this); | 1494 EnsureSpace ensure_space(this); |
1491 ASSERT(!RelocInfo::IsCodeTarget(rmode)); | 1495 ASSERT(!RelocInfo::IsCodeTarget(rmode)); |
1492 EMIT(0xE9); | 1496 EMIT(0xE9); |
1493 emit(entry - (pc_ + sizeof(int32_t)), rmode); | 1497 if (RelocInfo::IsRuntimeEntry(rmode)) { |
| 1498 emit(reinterpret_cast<uint32_t>(entry), rmode); |
| 1499 } else { |
| 1500 emit(entry - (pc_ + sizeof(int32_t)), rmode); |
| 1501 } |
1494 } | 1502 } |
1495 | 1503 |
1496 | 1504 |
1497 void Assembler::jmp(const Operand& adr) { | 1505 void Assembler::jmp(const Operand& adr) { |
1498 EnsureSpace ensure_space(this); | 1506 EnsureSpace ensure_space(this); |
1499 EMIT(0xFF); | 1507 EMIT(0xFF); |
1500 emit_operand(esp, adr); | 1508 emit_operand(esp, adr); |
1501 } | 1509 } |
1502 | 1510 |
1503 | 1511 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 } | 1548 } |
1541 } | 1549 } |
1542 | 1550 |
1543 | 1551 |
1544 void Assembler::j(Condition cc, byte* entry, RelocInfo::Mode rmode) { | 1552 void Assembler::j(Condition cc, byte* entry, RelocInfo::Mode rmode) { |
1545 EnsureSpace ensure_space(this); | 1553 EnsureSpace ensure_space(this); |
1546 ASSERT((0 <= cc) && (static_cast<int>(cc) < 16)); | 1554 ASSERT((0 <= cc) && (static_cast<int>(cc) < 16)); |
1547 // 0000 1111 1000 tttn #32-bit disp. | 1555 // 0000 1111 1000 tttn #32-bit disp. |
1548 EMIT(0x0F); | 1556 EMIT(0x0F); |
1549 EMIT(0x80 | cc); | 1557 EMIT(0x80 | cc); |
1550 emit(entry - (pc_ + sizeof(int32_t)), rmode); | 1558 if (RelocInfo::IsRuntimeEntry(rmode)) { |
| 1559 emit(reinterpret_cast<uint32_t>(entry), rmode); |
| 1560 } else { |
| 1561 emit(entry - (pc_ + sizeof(int32_t)), rmode); |
| 1562 } |
1551 } | 1563 } |
1552 | 1564 |
1553 | 1565 |
1554 void Assembler::j(Condition cc, Handle<Code> code) { | 1566 void Assembler::j(Condition cc, Handle<Code> code) { |
1555 EnsureSpace ensure_space(this); | 1567 EnsureSpace ensure_space(this); |
1556 // 0000 1111 1000 tttn #32-bit disp | 1568 // 0000 1111 1000 tttn #32-bit disp |
1557 EMIT(0x0F); | 1569 EMIT(0x0F); |
1558 EMIT(0x80 | cc); | 1570 EMIT(0x80 | cc); |
1559 emit(reinterpret_cast<intptr_t>(code.location()), RelocInfo::CODE_TARGET); | 1571 emit(reinterpret_cast<intptr_t>(code.location()), RelocInfo::CODE_TARGET); |
1560 } | 1572 } |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 } | 2569 } |
2558 buffer_ = desc.buffer; | 2570 buffer_ = desc.buffer; |
2559 buffer_size_ = desc.buffer_size; | 2571 buffer_size_ = desc.buffer_size; |
2560 pc_ += pc_delta; | 2572 pc_ += pc_delta; |
2561 reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta, | 2573 reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta, |
2562 reloc_info_writer.last_pc() + pc_delta); | 2574 reloc_info_writer.last_pc() + pc_delta); |
2563 | 2575 |
2564 // Relocate runtime entries. | 2576 // Relocate runtime entries. |
2565 for (RelocIterator it(desc); !it.done(); it.next()) { | 2577 for (RelocIterator it(desc); !it.done(); it.next()) { |
2566 RelocInfo::Mode rmode = it.rinfo()->rmode(); | 2578 RelocInfo::Mode rmode = it.rinfo()->rmode(); |
2567 if (rmode == RelocInfo::RUNTIME_ENTRY) { | 2579 if (rmode == RelocInfo::INTERNAL_REFERENCE) { |
2568 int32_t* p = reinterpret_cast<int32_t*>(it.rinfo()->pc()); | |
2569 *p -= pc_delta; // relocate entry | |
2570 } else if (rmode == RelocInfo::INTERNAL_REFERENCE) { | |
2571 int32_t* p = reinterpret_cast<int32_t*>(it.rinfo()->pc()); | 2580 int32_t* p = reinterpret_cast<int32_t*>(it.rinfo()->pc()); |
2572 if (*p != 0) { // 0 means uninitialized. | 2581 if (*p != 0) { // 0 means uninitialized. |
2573 *p += pc_delta; | 2582 *p += pc_delta; |
2574 } | 2583 } |
2575 } | 2584 } |
2576 } | 2585 } |
2577 | 2586 |
2578 ASSERT(!overflow()); | 2587 ASSERT(!overflow()); |
2579 } | 2588 } |
2580 | 2589 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 fprintf(coverage_log, "%s\n", file_line); | 2695 fprintf(coverage_log, "%s\n", file_line); |
2687 fflush(coverage_log); | 2696 fflush(coverage_log); |
2688 } | 2697 } |
2689 } | 2698 } |
2690 | 2699 |
2691 #endif | 2700 #endif |
2692 | 2701 |
2693 } } // namespace v8::internal | 2702 } } // namespace v8::internal |
2694 | 2703 |
2695 #endif // V8_TARGET_ARCH_IA32 | 2704 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |