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

Side by Side Diff: src/x87/assembler-x87.h

Issue 1287383003: Re-reland: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix MIPS tests again Created 5 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 unified diff | Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/test-gap-resolver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // 69 //
70 struct Register { 70 struct Register {
71 static const int kMaxNumAllocatableRegisters = 6; 71 static const int kMaxNumAllocatableRegisters = 6;
72 static int NumAllocatableRegisters() { 72 static int NumAllocatableRegisters() {
73 return kMaxNumAllocatableRegisters; 73 return kMaxNumAllocatableRegisters;
74 } 74 }
75 static const int kNumRegisters = 8; 75 static const int kNumRegisters = 8;
76 76
77 static inline const char* AllocationIndexToString(int index); 77 static inline const char* AllocationIndexToString(int index);
78 78
79 static inline int ToAllocationIndex(Register reg);
80
81 static inline Register FromAllocationIndex(int index);
82
83 static Register from_code(int code) { 79 static Register from_code(int code) {
84 DCHECK(code >= 0); 80 DCHECK(code >= 0);
85 DCHECK(code < kNumRegisters); 81 DCHECK(code < kNumRegisters);
86 Register r = { code }; 82 Register r = { code };
87 return r; 83 return r;
88 } 84 }
89 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } 85 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; }
90 bool is(Register reg) const { return code_ == reg.code_; } 86 bool is(Register reg) const { return code_ == reg.code_; }
91 // eax, ebx, ecx and edx are byte registers, the rest are not. 87 // eax, ebx, ecx and edx are byte registers, the rest are not.
92 bool is_byte_register() const { return code_ <= 3; } 88 bool is_byte_register() const { return code_ <= 3; }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 121
126 122
127 inline const char* Register::AllocationIndexToString(int index) { 123 inline const char* Register::AllocationIndexToString(int index) {
128 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); 124 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
129 // This is the mapping of allocation indices to registers. 125 // This is the mapping of allocation indices to registers.
130 const char* const kNames[] = { "eax", "ecx", "edx", "ebx", "esi", "edi" }; 126 const char* const kNames[] = { "eax", "ecx", "edx", "ebx", "esi", "edi" };
131 return kNames[index]; 127 return kNames[index];
132 } 128 }
133 129
134 130
135 inline int Register::ToAllocationIndex(Register reg) {
136 DCHECK(reg.is_valid() && !reg.is(esp) && !reg.is(ebp));
137 return (reg.code() >= 6) ? reg.code() - 2 : reg.code();
138 }
139
140
141 inline Register Register::FromAllocationIndex(int index) {
142 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
143 return (index >= 4) ? from_code(index + 2) : from_code(index);
144 }
145
146
147 struct X87Register { 131 struct X87Register {
148 static const int kMaxNumAllocatableRegisters = 6; 132 static const int kMaxNumAllocatableRegisters = 6;
149 static const int kMaxNumRegisters = 8; 133 static const int kMaxNumRegisters = 8;
150 static int NumAllocatableRegisters() { 134 static int NumAllocatableRegisters() {
151 return kMaxNumAllocatableRegisters; 135 return kMaxNumAllocatableRegisters;
152 } 136 }
153 137
154 138
155 // TODO(turbofan): Proper support for float32. 139 // TODO(turbofan): Proper support for float32.
156 static int NumAllocatableAliasedRegisters() { 140 static int NumAllocatableAliasedRegisters() {
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 Assembler* assembler_; 1078 Assembler* assembler_;
1095 #ifdef DEBUG 1079 #ifdef DEBUG
1096 int space_before_; 1080 int space_before_;
1097 #endif 1081 #endif
1098 }; 1082 };
1099 1083
1100 } // namespace internal 1084 } // namespace internal
1101 } // namespace v8 1085 } // namespace v8
1102 1086
1103 #endif // V8_X87_ASSEMBLER_X87_H_ 1087 #endif // V8_X87_ASSEMBLER_X87_H_
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/compiler/test-gap-resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698