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

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

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

Powered by Google App Engine
This is Rietveld 408576698