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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // such that we use an enum in optimized mode, and the struct in debug | 67 // such that we use an enum in optimized mode, and the struct in debug |
68 // mode. This way we get the compile-time error checking in debug mode | 68 // mode. This way we get the compile-time error checking in debug mode |
69 // and best performance in optimized code. | 69 // and best performance in optimized code. |
70 // | 70 // |
71 | 71 |
72 struct Register { | 72 struct Register { |
73 // The non-allocatable registers are: | 73 // The non-allocatable registers are: |
74 // rsp - stack pointer | 74 // rsp - stack pointer |
75 // rbp - frame pointer | 75 // rbp - frame pointer |
76 // r10 - fixed scratch register | 76 // r10 - fixed scratch register |
77 // r12 - smi constant register | |
78 // r13 - root register | 77 // r13 - root register |
79 static const int kMaxNumAllocatableRegisters = 11; | 78 static const int kMaxNumAllocatableRegisters = 12; |
80 static int NumAllocatableRegisters() { | 79 static int NumAllocatableRegisters() { |
81 return kMaxNumAllocatableRegisters; | 80 return kMaxNumAllocatableRegisters; |
82 } | 81 } |
83 static const int kNumRegisters = 16; | 82 static const int kNumRegisters = 16; |
84 | 83 |
85 static int ToAllocationIndex(Register reg) { | 84 static int ToAllocationIndex(Register reg) { |
86 return kAllocationIndexByRegisterCode[reg.code()]; | 85 return kAllocationIndexByRegisterCode[reg.code()]; |
87 } | 86 } |
88 | 87 |
89 static Register FromAllocationIndex(int index) { | 88 static Register FromAllocationIndex(int index) { |
90 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); | 89 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); |
91 Register result = { kRegisterCodeByAllocationIndex[index] }; | 90 Register result = { kRegisterCodeByAllocationIndex[index] }; |
92 return result; | 91 return result; |
93 } | 92 } |
94 | 93 |
95 static const char* AllocationIndexToString(int index) { | 94 static const char* AllocationIndexToString(int index) { |
96 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); | 95 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); |
97 const char* const names[] = { | 96 const char* const names[] = { |
98 "rax", | 97 "rax", |
99 "rbx", | 98 "rbx", |
100 "rdx", | 99 "rdx", |
101 "rcx", | 100 "rcx", |
102 "rsi", | 101 "rsi", |
103 "rdi", | 102 "rdi", |
104 "r8", | 103 "r8", |
105 "r9", | 104 "r9", |
106 "r11", | 105 "r11", |
| 106 "r12", |
107 "r14", | 107 "r14", |
108 "r15" | 108 "r15" |
109 }; | 109 }; |
110 return names[index]; | 110 return names[index]; |
111 } | 111 } |
112 | 112 |
113 static Register from_code(int code) { | 113 static Register from_code(int code) { |
114 Register r = { code }; | 114 Register r = { code }; |
115 return r; | 115 return r; |
116 } | 116 } |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1853 private: | 1853 private: |
1854 Assembler* assembler_; | 1854 Assembler* assembler_; |
1855 #ifdef DEBUG | 1855 #ifdef DEBUG |
1856 int space_before_; | 1856 int space_before_; |
1857 #endif | 1857 #endif |
1858 }; | 1858 }; |
1859 | 1859 |
1860 } } // namespace v8::internal | 1860 } } // namespace v8::internal |
1861 | 1861 |
1862 #endif // V8_X64_ASSEMBLER_X64_H_ | 1862 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |