Chromium Code Reviews| 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 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1449 emit_rex_64(src, dst); | 1449 emit_rex_64(src, dst); |
| 1450 emit(0x89); | 1450 emit(0x89); |
| 1451 emit_operand(src, dst); | 1451 emit_operand(src, dst); |
| 1452 } | 1452 } |
| 1453 | 1453 |
| 1454 | 1454 |
| 1455 void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { | 1455 void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { |
| 1456 // This method must not be used with heap object references. The stored | 1456 // This method must not be used with heap object references. The stored |
| 1457 // address is not GC safe. Use the handle version instead. | 1457 // address is not GC safe. Use the handle version instead. |
| 1458 ASSERT(rmode > RelocInfo::LAST_GCED_ENUM); | 1458 ASSERT(rmode > RelocInfo::LAST_GCED_ENUM); |
| 1459 EnsureSpace ensure_space(this); | 1459 if (RelocInfo::IsNone(rmode)) { |
| 1460 emit_rex_64(dst); | 1460 movq(dst, reinterpret_cast<int64_t>(value)); |
| 1461 emit(0xB8 | dst.low_bits()); | 1461 } else { |
| 1462 emitp(value, rmode); | 1462 EnsureSpace ensure_space(this); |
| 1463 emit_rex_64(dst); | |
| 1464 emit(0xB8 | dst.low_bits()); | |
| 1465 emitp(value, rmode); | |
| 1466 } | |
| 1463 } | 1467 } |
| 1464 | 1468 |
| 1465 | 1469 |
| 1466 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { | 1470 void Assembler::movq(Register dst, int64_t value) { |
| 1467 // Non-relocatable values might not need a 64-bit representation. | 1471 // Non-relocatable values might not need a 64-bit representation. |
| 1468 ASSERT(RelocInfo::IsNone(rmode)); | |
| 1469 if (is_uint32(value)) { | 1472 if (is_uint32(value)) { |
| 1470 movl(dst, Immediate(static_cast<int32_t>(value))); | 1473 movl(dst, Immediate(static_cast<int32_t>(value))); |
| 1471 } else if (is_int32(value)) { | 1474 } else if (is_int32(value)) { |
| 1472 movq(dst, Immediate(static_cast<int32_t>(value))); | 1475 movq(dst, Immediate(static_cast<int32_t>(value))); |
| 1473 } else { | 1476 } else { |
| 1474 // Value cannot be represented by 32 bits, so do a full 64 bit immediate | 1477 // Value cannot be represented by 32 bits, so do a full 64 bit immediate |
| 1475 // value. | 1478 // value. |
| 1476 EnsureSpace ensure_space(this); | 1479 EnsureSpace ensure_space(this); |
| 1477 emit_rex_64(dst); | 1480 emit_rex_64(dst); |
| 1478 emit(0xB8 | dst.low_bits()); | 1481 emit(0xB8 | dst.low_bits()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1520 | 1523 |
| 1521 | 1524 |
| 1522 void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) { | 1525 void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) { |
| 1523 AllowDeferredHandleDereference using_raw_address; | 1526 AllowDeferredHandleDereference using_raw_address; |
| 1524 // If there is no relocation info, emit the value of the handle efficiently | 1527 // If there is no relocation info, emit the value of the handle efficiently |
| 1525 // (possibly using less that 8 bytes for the value). | 1528 // (possibly using less that 8 bytes for the value). |
| 1526 if (RelocInfo::IsNone(mode)) { | 1529 if (RelocInfo::IsNone(mode)) { |
| 1527 // There is no possible reason to store a heap pointer without relocation | 1530 // There is no possible reason to store a heap pointer without relocation |
| 1528 // info, so it must be a smi. | 1531 // info, so it must be a smi. |
| 1529 ASSERT(value->IsSmi()); | 1532 ASSERT(value->IsSmi()); |
| 1530 movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE64); | 1533 movq(dst, Smi::cast(*value), RelocInfo::NONE64); |
|
haitao.feng
2013/10/24 07:32:48
In the macro assembler, we have Move(Register, Smi
| |
| 1531 } else { | 1534 } else { |
| 1532 EnsureSpace ensure_space(this); | 1535 EnsureSpace ensure_space(this); |
| 1533 ASSERT(value->IsHeapObject()); | 1536 ASSERT(value->IsHeapObject()); |
| 1534 ASSERT(!isolate()->heap()->InNewSpace(*value)); | 1537 ASSERT(!isolate()->heap()->InNewSpace(*value)); |
| 1535 emit_rex_64(dst); | 1538 emit_rex_64(dst); |
| 1536 emit(0xB8 | dst.low_bits()); | 1539 emit(0xB8 | dst.low_bits()); |
| 1537 emitp(value.location(), mode); | 1540 emitp(value.location(), mode); |
| 1538 } | 1541 } |
| 1539 } | 1542 } |
| 1540 | 1543 |
| (...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3078 bool RelocInfo::IsCodedSpecially() { | 3081 bool RelocInfo::IsCodedSpecially() { |
| 3079 // The deserializer needs to know whether a pointer is specially coded. Being | 3082 // The deserializer needs to know whether a pointer is specially coded. Being |
| 3080 // specially coded on x64 means that it is a relative 32 bit address, as used | 3083 // specially coded on x64 means that it is a relative 32 bit address, as used |
| 3081 // by branch instructions. | 3084 // by branch instructions. |
| 3082 return (1 << rmode_) & kApplyMask; | 3085 return (1 << rmode_) & kApplyMask; |
| 3083 } | 3086 } |
| 3084 | 3087 |
| 3085 } } // namespace v8::internal | 3088 } } // namespace v8::internal |
| 3086 | 3089 |
| 3087 #endif // V8_TARGET_ARCH_X64 | 3090 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |