Avoid more static variables in inline functions.

Review URL: http://codereview.chromium.org/149799

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2494 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kasperl@chromium.org 2009-07-17 08:22:07 +00:00
parent 260cacfde7
commit 38f5a84701
3 changed files with 12 additions and 12 deletions

View File

@ -60,7 +60,7 @@ bool RegisterAllocator::IsReserved(Register reg) {
int RegisterAllocator::ToNumber(Register reg) {
ASSERT(reg.is_valid() && !IsReserved(reg));
static int numbers[] = {
const int kNumbers[] = {
0, // r0
1, // r1
2, // r2
@ -78,15 +78,15 @@ int RegisterAllocator::ToNumber(Register reg) {
11, // lr
-1 // pc
};
return numbers[reg.code()];
return kNumbers[reg.code()];
}
Register RegisterAllocator::ToRegister(int num) {
ASSERT(num >= 0 && num < kNumRegisters);
static Register registers[] =
const Register kRegisters[] =
{ r0, r1, r2, r3, r4, r5, r6, r7, r9, r10, ip, lr };
return registers[num];
return kRegisters[num];
}

View File

@ -49,7 +49,7 @@ bool RegisterAllocator::IsReserved(Register reg) {
int RegisterAllocator::ToNumber(Register reg) {
ASSERT(reg.is_valid() && !IsReserved(reg));
static int numbers[] = {
const int kNumbers[] = {
0, // eax
2, // ecx
3, // edx
@ -59,14 +59,14 @@ int RegisterAllocator::ToNumber(Register reg) {
-1, // esi
4 // edi
};
return numbers[reg.code()];
return kNumbers[reg.code()];
}
Register RegisterAllocator::ToRegister(int num) {
ASSERT(num >= 0 && num < kNumRegisters);
const Register registers[] = { eax, ebx, ecx, edx, edi };
return registers[num];
const Register kRegisters[] = { eax, ebx, ecx, edx, edi };
return kRegisters[num];
}

View File

@ -46,7 +46,7 @@ bool RegisterAllocator::IsReserved(Register reg) {
// non-reserved assembler registers.
int RegisterAllocator::ToNumber(Register reg) {
ASSERT(reg.is_valid() && !IsReserved(reg));
static const int numbers[] = {
const int kNumbers[] = {
0, // rax
2, // rcx
3, // rdx
@ -64,15 +64,15 @@ int RegisterAllocator::ToNumber(Register reg) {
8, // r14
9 // r15
};
return numbers[reg.code()];
return kNumbers[reg.code()];
}
Register RegisterAllocator::ToRegister(int num) {
ASSERT(num >= 0 && num < kNumRegisters);
static Register registers[] =
const Register kRegisters[] =
{ rax, rbx, rcx, rdx, rdi, r8, r9, r11, r14, r15, r13, r12 };
return registers[num];
return kRegisters[num];
}