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 emitp(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 emitp(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)) { |
(...skipping 56 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 emitp(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 emitp(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 |