 Chromium Code Reviews
 Chromium Code Reviews Issue 12177012:
  Small improvement in x64 assembler  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
    
  
    Issue 12177012:
  Small improvement in x64 assembler  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/| 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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1498 EnsureSpace ensure_space(this); | 1498 EnsureSpace ensure_space(this); | 
| 1499 emit_rex_64(dst); | 1499 emit_rex_64(dst); | 
| 1500 emit(0xB8 | dst.low_bits()); | 1500 emit(0xB8 | dst.low_bits()); | 
| 1501 emitq(reinterpret_cast<uintptr_t>(value), rmode); | 1501 emitq(reinterpret_cast<uintptr_t>(value), rmode); | 
| 1502 } | 1502 } | 
| 1503 | 1503 | 
| 1504 | 1504 | 
| 1505 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { | 1505 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { | 
| 1506 // Non-relocatable values might not need a 64-bit representation. | 1506 // Non-relocatable values might not need a 64-bit representation. | 
| 1507 if (RelocInfo::IsNone(rmode)) { | 1507 if (RelocInfo::IsNone(rmode)) { | 
| 1508 // Sadly, there is no zero or sign extending move for 8-bit immediates. | 1508 if (is_uint32(value)) { | 
| 1509 if (is_int32(value)) { | 1509 movl(dst, Immediate(static_cast<int32_t>(value))); | 
| 1510 return; | |
| 1511 } else if (is_int32(value)) { | |
| 
Yang
2013/02/06 10:28:59
What is the purpose of this change?
 
Zheng Liu
2013/02/06 11:34:08
Code might be smaller, as [mov r64, imm32] always
 
Yang
2013/02/06 11:39:18
But this change seems to be to the effect of chang
 | |
| 1510 movq(dst, Immediate(static_cast<int32_t>(value))); | 1512 movq(dst, Immediate(static_cast<int32_t>(value))); | 
| 1511 return; | 1513 return; | 
| 1512 } else if (is_uint32(value)) { | |
| 1513 movl(dst, Immediate(static_cast<int32_t>(value))); | |
| 1514 return; | |
| 1515 } | 1514 } | 
| 1516 // Value cannot be represented by 32 bits, so do a full 64 bit immediate | 1515 // Value cannot be represented by 32 bits, so do a full 64 bit immediate | 
| 1517 // value. | 1516 // value. | 
| 1518 } | 1517 } | 
| 1519 EnsureSpace ensure_space(this); | 1518 EnsureSpace ensure_space(this); | 
| 1520 emit_rex_64(dst); | 1519 emit_rex_64(dst); | 
| 1521 emit(0xB8 | dst.low_bits()); | 1520 emit(0xB8 | dst.low_bits()); | 
| 1522 emitq(value, rmode); | 1521 emitq(value, rmode); | 
| 1523 } | 1522 } | 
| 1524 | 1523 | 
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3056 bool RelocInfo::IsCodedSpecially() { | 3055 bool RelocInfo::IsCodedSpecially() { | 
| 3057 // The deserializer needs to know whether a pointer is specially coded. Being | 3056 // The deserializer needs to know whether a pointer is specially coded. Being | 
| 3058 // specially coded on x64 means that it is a relative 32 bit address, as used | 3057 // specially coded on x64 means that it is a relative 32 bit address, as used | 
| 3059 // by branch instructions. | 3058 // by branch instructions. | 
| 3060 return (1 << rmode_) & kApplyMask; | 3059 return (1 << rmode_) & kApplyMask; | 
| 3061 } | 3060 } | 
| 3062 | 3061 | 
| 3063 } } // namespace v8::internal | 3062 } } // namespace v8::internal | 
| 3064 | 3063 | 
| 3065 #endif // V8_TARGET_ARCH_X64 | 3064 #endif // V8_TARGET_ARCH_X64 | 
| OLD | NEW |