| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // to a few constants). If this is a problem, we could change the code | 84 // to a few constants). If this is a problem, we could change the code |
| 85 // such that we use an enum in optimized mode, and the struct in debug | 85 // such that we use an enum in optimized mode, and the struct in debug |
| 86 // mode. This way we get the compile-time error checking in debug mode | 86 // mode. This way we get the compile-time error checking in debug mode |
| 87 // and best performance in optimized code. | 87 // and best performance in optimized code. |
| 88 // | 88 // |
| 89 | 89 |
| 90 struct Register { | 90 struct Register { |
| 91 // The non-allocatable registers are: | 91 // The non-allocatable registers are: |
| 92 // rsp - stack pointer | 92 // rsp - stack pointer |
| 93 // rbp - frame pointer | 93 // rbp - frame pointer |
| 94 // rsi - context register | |
| 95 // r10 - fixed scratch register | 94 // r10 - fixed scratch register |
| 96 // r12 - smi constant register | 95 // r12 - smi constant register |
| 97 // r13 - root register | 96 // r13 - root register |
| 98 static const int kNumRegisters = 16; | 97 static const int kNumRegisters = 16; |
| 99 static const int kNumAllocatableRegisters = 10; | 98 static const int kNumAllocatableRegisters = 11; |
| 100 | 99 |
| 101 static int ToAllocationIndex(Register reg) { | 100 static int ToAllocationIndex(Register reg) { |
| 102 return kAllocationIndexByRegisterCode[reg.code()]; | 101 return kAllocationIndexByRegisterCode[reg.code()]; |
| 103 } | 102 } |
| 104 | 103 |
| 105 static Register FromAllocationIndex(int index) { | 104 static Register FromAllocationIndex(int index) { |
| 106 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 105 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 107 Register result = { kRegisterCodeByAllocationIndex[index] }; | 106 Register result = { kRegisterCodeByAllocationIndex[index] }; |
| 108 return result; | 107 return result; |
| 109 } | 108 } |
| 110 | 109 |
| 111 static const char* AllocationIndexToString(int index) { | 110 static const char* AllocationIndexToString(int index) { |
| 112 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 111 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 113 const char* const names[] = { | 112 const char* const names[] = { |
| 114 "rax", | 113 "rax", |
| 115 "rbx", | 114 "rbx", |
| 116 "rdx", | 115 "rdx", |
| 117 "rcx", | 116 "rcx", |
| 117 "rsi", |
| 118 "rdi", | 118 "rdi", |
| 119 "r8", | 119 "r8", |
| 120 "r9", | 120 "r9", |
| 121 "r11", | 121 "r11", |
| 122 "r14", | 122 "r14", |
| 123 "r15" | 123 "r15" |
| 124 }; | 124 }; |
| 125 return names[index]; | 125 return names[index]; |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 private: | 1627 private: |
| 1628 Assembler* assembler_; | 1628 Assembler* assembler_; |
| 1629 #ifdef DEBUG | 1629 #ifdef DEBUG |
| 1630 int space_before_; | 1630 int space_before_; |
| 1631 #endif | 1631 #endif |
| 1632 }; | 1632 }; |
| 1633 | 1633 |
| 1634 } } // namespace v8::internal | 1634 } } // namespace v8::internal |
| 1635 | 1635 |
| 1636 #endif // V8_X64_ASSEMBLER_X64_H_ | 1636 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |