| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 emit_optional_rex_32(dst, src); | 1370 emit_optional_rex_32(dst, src); |
| 1371 emit(0x8D); | 1371 emit(0x8D); |
| 1372 emit_operand(dst, src); | 1372 emit_operand(dst, src); |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 | 1375 |
| 1376 void Assembler::load_rax(void* value, RelocInfo::Mode mode) { | 1376 void Assembler::load_rax(void* value, RelocInfo::Mode mode) { |
| 1377 EnsureSpace ensure_space(this); | 1377 EnsureSpace ensure_space(this); |
| 1378 emit(0x48); // REX.W | 1378 emit(0x48); // REX.W |
| 1379 emit(0xA1); | 1379 emit(0xA1); |
| 1380 emitq(reinterpret_cast<uintptr_t>(value), mode); | 1380 emit(reinterpret_cast<uintptr_t>(value), mode); |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 | 1383 |
| 1384 void Assembler::load_rax(ExternalReference ref) { | 1384 void Assembler::load_rax(ExternalReference ref) { |
| 1385 load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); | 1385 load_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 | 1388 |
| 1389 void Assembler::leave() { | 1389 void Assembler::leave() { |
| 1390 EnsureSpace ensure_space(this); | 1390 EnsureSpace ensure_space(this); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 } | 1522 } |
| 1523 | 1523 |
| 1524 | 1524 |
| 1525 void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { | 1525 void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { |
| 1526 // This method must not be used with heap object references. The stored | 1526 // This method must not be used with heap object references. The stored |
| 1527 // address is not GC safe. Use the handle version instead. | 1527 // address is not GC safe. Use the handle version instead. |
| 1528 ASSERT(rmode > RelocInfo::LAST_GCED_ENUM); | 1528 ASSERT(rmode > RelocInfo::LAST_GCED_ENUM); |
| 1529 EnsureSpace ensure_space(this); | 1529 EnsureSpace ensure_space(this); |
| 1530 emit_rex_64(dst); | 1530 emit_rex_64(dst); |
| 1531 emit(0xB8 | dst.low_bits()); | 1531 emit(0xB8 | dst.low_bits()); |
| 1532 emitq(reinterpret_cast<uintptr_t>(value), rmode); | 1532 emit(reinterpret_cast<uintptr_t>(value), rmode); |
| 1533 } | 1533 } |
| 1534 | 1534 |
| 1535 | 1535 |
| 1536 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { | 1536 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { |
| 1537 // Non-relocatable values might not need a 64-bit representation. | 1537 // Non-relocatable values might not need a 64-bit representation. |
| 1538 if (RelocInfo::IsNone(rmode)) { | 1538 if (RelocInfo::IsNone(rmode)) { |
| 1539 if (is_uint32(value)) { | 1539 if (is_uint32(value)) { |
| 1540 movl(dst, Immediate(static_cast<int32_t>(value))); | 1540 movl(dst, Immediate(static_cast<int32_t>(value))); |
| 1541 return; | 1541 return; |
| 1542 } else if (is_int32(value)) { | 1542 } else if (is_int32(value)) { |
| 1543 movq(dst, Immediate(static_cast<int32_t>(value))); | 1543 movq(dst, Immediate(static_cast<int32_t>(value))); |
| 1544 return; | 1544 return; |
| 1545 } | 1545 } |
| 1546 // Value cannot be represented by 32 bits, so do a full 64 bit immediate | 1546 // Value cannot be represented by 32 bits, so do a full 64 bit immediate |
| 1547 // value. | 1547 // value. |
| 1548 } | 1548 } |
| 1549 EnsureSpace ensure_space(this); | 1549 EnsureSpace ensure_space(this); |
| 1550 emit_rex_64(dst); | 1550 emit_rex_64(dst); |
| 1551 emit(0xB8 | dst.low_bits()); | 1551 emit(0xB8 | dst.low_bits()); |
| 1552 emitq(value, rmode); | 1552 emit(value, rmode); |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 | 1555 |
| 1556 void Assembler::movq(Register dst, ExternalReference ref) { | 1556 void Assembler::movq(Register dst, ExternalReference ref) { |
| 1557 int64_t value = reinterpret_cast<int64_t>(ref.address()); | 1557 int64_t value = reinterpret_cast<int64_t>(ref.address()); |
| 1558 movq(dst, value, RelocInfo::EXTERNAL_REFERENCE); | 1558 movq(dst, value, RelocInfo::EXTERNAL_REFERENCE); |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 | 1561 |
| 1562 void Assembler::movq(const Operand& dst, Immediate value) { | 1562 void Assembler::movq(const Operand& dst, Immediate value) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 // There is no possible reason to store a heap pointer without relocation | 1599 // There is no possible reason to store a heap pointer without relocation |
| 1600 // info, so it must be a smi. | 1600 // info, so it must be a smi. |
| 1601 ASSERT(value->IsSmi()); | 1601 ASSERT(value->IsSmi()); |
| 1602 movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE64); | 1602 movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE64); |
| 1603 } else { | 1603 } else { |
| 1604 EnsureSpace ensure_space(this); | 1604 EnsureSpace ensure_space(this); |
| 1605 ASSERT(value->IsHeapObject()); | 1605 ASSERT(value->IsHeapObject()); |
| 1606 ASSERT(!HEAP->InNewSpace(*value)); | 1606 ASSERT(!HEAP->InNewSpace(*value)); |
| 1607 emit_rex_64(dst); | 1607 emit_rex_64(dst); |
| 1608 emit(0xB8 | dst.low_bits()); | 1608 emit(0xB8 | dst.low_bits()); |
| 1609 emitq(reinterpret_cast<uintptr_t>(value.location()), mode); | 1609 emit(reinterpret_cast<uintptr_t>(value.location()), mode); |
| 1610 } | 1610 } |
| 1611 } | 1611 } |
| 1612 | 1612 |
| 1613 | 1613 |
| 1614 void Assembler::movsxbq(Register dst, const Operand& src) { | 1614 void Assembler::movsxbq(Register dst, const Operand& src) { |
| 1615 EnsureSpace ensure_space(this); | 1615 EnsureSpace ensure_space(this); |
| 1616 emit_rex_64(dst, src); | 1616 emit_rex_64(dst, src); |
| 1617 emit(0x0F); | 1617 emit(0x0F); |
| 1618 emit(0xBE); | 1618 emit(0xBE); |
| 1619 emit_operand(dst, src); | 1619 emit_operand(dst, src); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 emit(0x87); | 1991 emit(0x87); |
| 1992 emit_modrm(src, dst); | 1992 emit_modrm(src, dst); |
| 1993 } | 1993 } |
| 1994 } | 1994 } |
| 1995 | 1995 |
| 1996 | 1996 |
| 1997 void Assembler::store_rax(void* dst, RelocInfo::Mode mode) { | 1997 void Assembler::store_rax(void* dst, RelocInfo::Mode mode) { |
| 1998 EnsureSpace ensure_space(this); | 1998 EnsureSpace ensure_space(this); |
| 1999 emit(0x48); // REX.W | 1999 emit(0x48); // REX.W |
| 2000 emit(0xA3); | 2000 emit(0xA3); |
| 2001 emitq(reinterpret_cast<uintptr_t>(dst), mode); | 2001 emit(reinterpret_cast<uintptr_t>(dst), mode); |
| 2002 } | 2002 } |
| 2003 | 2003 |
| 2004 | 2004 |
| 2005 void Assembler::store_rax(ExternalReference ref) { | 2005 void Assembler::store_rax(ExternalReference ref) { |
| 2006 store_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); | 2006 store_rax(ref.address(), RelocInfo::EXTERNAL_REFERENCE); |
| 2007 } | 2007 } |
| 2008 | 2008 |
| 2009 | 2009 |
| 2010 void Assembler::testb(Register dst, Register src) { | 2010 void Assembler::testb(Register dst, Register src) { |
| 2011 EnsureSpace ensure_space(this); | 2011 EnsureSpace ensure_space(this); |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3113 bool RelocInfo::IsCodedSpecially() { | 3113 bool RelocInfo::IsCodedSpecially() { |
| 3114 // The deserializer needs to know whether a pointer is specially coded. Being | 3114 // The deserializer needs to know whether a pointer is specially coded. Being |
| 3115 // specially coded on x64 means that it is a relative 32 bit address, as used | 3115 // specially coded on x64 means that it is a relative 32 bit address, as used |
| 3116 // by branch instructions. | 3116 // by branch instructions. |
| 3117 return (1 << rmode_) & kApplyMask; | 3117 return (1 << rmode_) & kApplyMask; |
| 3118 } | 3118 } |
| 3119 | 3119 |
| 3120 } } // namespace v8::internal | 3120 } } // namespace v8::internal |
| 3121 | 3121 |
| 3122 #endif // V8_TARGET_ARCH_X64 | 3122 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |