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

Unified Diff: src/x64/register-allocator-x64-inl.h

Issue 126043: Implement more of x64 register allocator. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/register-allocator-x64-inl.h
===================================================================
--- src/x64/register-allocator-x64-inl.h (revision 2148)
+++ src/x64/register-allocator-x64-inl.h (working copy)
@@ -37,31 +37,50 @@
// RegisterAllocator implementation.
bool RegisterAllocator::IsReserved(Register reg) {
- return reg.is(rsp) || reg.is(rbp) || reg.is(rsi) || reg.is(r10);
+ return reg.is(rsp) || reg.is(rbp) || reg.is(rsi) ||
+ reg.is(kScratchRegister);
}
// The register allocator uses small integers to represent the
// non-reserved assembler registers.
-
int RegisterAllocator::ToNumber(Register reg) {
ASSERT(reg.is_valid() && !IsReserved(reg));
- return reg.code();
+ static const int numbers[] = {
+ 0, // rax
+ 2, // rcx
+ 3, // rdx
+ 1, // rbx
+ -1, // rsp
+ -1, // rbp
+ -1, // rsi
+ 4, // rdi
+ 5, // r8
+ 6, // r9
+ -1, // r10
+ 7, // r11
+ 11, // r12
+ 10, // r13
+ 8, // r14
+ 9 // r15
+ };
+ return numbers[reg.code()];
}
Register RegisterAllocator::ToRegister(int num) {
ASSERT(num >= 0 && num < kNumRegisters);
- Register result = {num};
- return result;
+ static Register registers[] =
+ { rax, rbx, rcx, rdx, rdi, r8, r9, r11, r14, r15, r13, r12 };
+ return registers[num];
}
void RegisterAllocator::Initialize() {
- // TODO(X64): Implement.
+ Reset();
+ // The non-reserved rdi register is live on JS function entry.
+ Use(rdi); // JS function.
}
-
-
} } // namespace v8::internal
#endif // V8_X64_REGISTER_ALLOCATOR_X64_INL_H_
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698