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

Unified Diff: src/x64/assembler-x64.cc

Issue 39543003: Refactor loading a pointer and loading an integer64 into a register instructions for X64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make movq(Register, int64_t) an assembler instruction for 64-bit integer only" Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/assembler-x64.cc
diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc
index 9fe7b8392e7a3a55b188b8d2769ae3363b6172de..61f75596415860df653df2a3014696334f0fd962 100644
--- a/src/x64/assembler-x64.cc
+++ b/src/x64/assembler-x64.cc
@@ -1456,31 +1456,25 @@ void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) {
// This method must not be used with heap object references. The stored
// address is not GC safe. Use the handle version instead.
ASSERT(rmode > RelocInfo::LAST_GCED_ENUM);
- EnsureSpace ensure_space(this);
- emit_rex_64(dst);
- emit(0xB8 | dst.low_bits());
- emitp(value, rmode);
-}
-
-
-void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) {
- // Non-relocatable values might not need a 64-bit representation.
- ASSERT(RelocInfo::IsNone(rmode));
- if (is_uint32(value)) {
- movl(dst, Immediate(static_cast<int32_t>(value)));
- } else if (is_int32(value)) {
- movq(dst, Immediate(static_cast<int32_t>(value)));
+ if (RelocInfo::IsNone(rmode)) {
+ movq(dst, reinterpret_cast<int64_t>(value));
} else {
- // Value cannot be represented by 32 bits, so do a full 64 bit immediate
- // value.
EnsureSpace ensure_space(this);
emit_rex_64(dst);
emit(0xB8 | dst.low_bits());
- emitq(value);
+ emitp(value, rmode);
}
}
+void Assembler::movq(Register dst, int64_t value) {
haitao.feng 2013/10/25 06:19:11 Use MacroAssembler::Set instruction if the value c
+ EnsureSpace ensure_space(this);
+ emit_rex_64(dst);
+ emit(0xB8 | dst.low_bits());
+ emitq(value);
+}
+
+
void Assembler::movq(Register dst, ExternalReference ref) {
Address value = reinterpret_cast<Address>(ref.address());
movq(dst, value, RelocInfo::EXTERNAL_REFERENCE);
@@ -1521,21 +1515,13 @@ void Assembler::movl(const Operand& dst, Label* src) {
void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) {
AllowDeferredHandleDereference using_raw_address;
- // If there is no relocation info, emit the value of the handle efficiently
- // (possibly using less that 8 bytes for the value).
- if (RelocInfo::IsNone(mode)) {
- // There is no possible reason to store a heap pointer without relocation
- // info, so it must be a smi.
- ASSERT(value->IsSmi());
- movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE64);
- } else {
- EnsureSpace ensure_space(this);
- ASSERT(value->IsHeapObject());
- ASSERT(!isolate()->heap()->InNewSpace(*value));
- emit_rex_64(dst);
- emit(0xB8 | dst.low_bits());
- emitp(value.location(), mode);
- }
+ ASSERT(!RelocInfo::IsNone(mode));
haitao.feng 2013/10/25 06:19:11 Currently SMI cases are all handled before calling
+ EnsureSpace ensure_space(this);
+ ASSERT(value->IsHeapObject());
+ ASSERT(!isolate()->heap()->InNewSpace(*value));
+ emit_rex_64(dst);
+ emit(0xB8 | dst.low_bits());
+ emitp(value.location(), mode);
}
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698