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

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

Issue 12177012: Small improvement in x64 assembler (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 10 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 | « no previous file | src/x64/macro-assembler-x64.cc » ('j') | src/x64/macro-assembler-x64.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/x64/macro-assembler-x64.cc » ('j') | src/x64/macro-assembler-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698