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

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

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-uint32-analysis.cc ('k') | src/ia32/assembler-ia32.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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 static const int kNumRegisters = 8; 72 static const int kNumRegisters = 8;
73 73
74 static inline const char* AllocationIndexToString(int index); 74 static inline const char* AllocationIndexToString(int index);
75 75
76 static inline int ToAllocationIndex(Register reg); 76 static inline int ToAllocationIndex(Register reg);
77 77
78 static inline Register FromAllocationIndex(int index); 78 static inline Register FromAllocationIndex(int index);
79 79
80 static Register from_code(int code) { 80 static Register from_code(int code) {
81 ASSERT(code >= 0); 81 DCHECK(code >= 0);
82 ASSERT(code < kNumRegisters); 82 DCHECK(code < kNumRegisters);
83 Register r = { code }; 83 Register r = { code };
84 return r; 84 return r;
85 } 85 }
86 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } 86 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; }
87 bool is(Register reg) const { return code_ == reg.code_; } 87 bool is(Register reg) const { return code_ == reg.code_; }
88 // eax, ebx, ecx and edx are byte registers, the rest are not. 88 // eax, ebx, ecx and edx are byte registers, the rest are not.
89 bool is_byte_register() const { return code_ <= 3; } 89 bool is_byte_register() const { return code_ <= 3; }
90 int code() const { 90 int code() const {
91 ASSERT(is_valid()); 91 DCHECK(is_valid());
92 return code_; 92 return code_;
93 } 93 }
94 int bit() const { 94 int bit() const {
95 ASSERT(is_valid()); 95 DCHECK(is_valid());
96 return 1 << code_; 96 return 1 << code_;
97 } 97 }
98 98
99 // Unfortunately we can't make this private in a struct. 99 // Unfortunately we can't make this private in a struct.
100 int code_; 100 int code_;
101 }; 101 };
102 102
103 const int kRegister_eax_Code = 0; 103 const int kRegister_eax_Code = 0;
104 const int kRegister_ecx_Code = 1; 104 const int kRegister_ecx_Code = 1;
105 const int kRegister_edx_Code = 2; 105 const int kRegister_edx_Code = 2;
106 const int kRegister_ebx_Code = 3; 106 const int kRegister_ebx_Code = 3;
107 const int kRegister_esp_Code = 4; 107 const int kRegister_esp_Code = 4;
108 const int kRegister_ebp_Code = 5; 108 const int kRegister_ebp_Code = 5;
109 const int kRegister_esi_Code = 6; 109 const int kRegister_esi_Code = 6;
110 const int kRegister_edi_Code = 7; 110 const int kRegister_edi_Code = 7;
111 const int kRegister_no_reg_Code = -1; 111 const int kRegister_no_reg_Code = -1;
112 112
113 const Register eax = { kRegister_eax_Code }; 113 const Register eax = { kRegister_eax_Code };
114 const Register ecx = { kRegister_ecx_Code }; 114 const Register ecx = { kRegister_ecx_Code };
115 const Register edx = { kRegister_edx_Code }; 115 const Register edx = { kRegister_edx_Code };
116 const Register ebx = { kRegister_ebx_Code }; 116 const Register ebx = { kRegister_ebx_Code };
117 const Register esp = { kRegister_esp_Code }; 117 const Register esp = { kRegister_esp_Code };
118 const Register ebp = { kRegister_ebp_Code }; 118 const Register ebp = { kRegister_ebp_Code };
119 const Register esi = { kRegister_esi_Code }; 119 const Register esi = { kRegister_esi_Code };
120 const Register edi = { kRegister_edi_Code }; 120 const Register edi = { kRegister_edi_Code };
121 const Register no_reg = { kRegister_no_reg_Code }; 121 const Register no_reg = { kRegister_no_reg_Code };
122 122
123 123
124 inline const char* Register::AllocationIndexToString(int index) { 124 inline const char* Register::AllocationIndexToString(int index) {
125 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); 125 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
126 // This is the mapping of allocation indices to registers. 126 // This is the mapping of allocation indices to registers.
127 const char* const kNames[] = { "eax", "ecx", "edx", "ebx", "esi", "edi" }; 127 const char* const kNames[] = { "eax", "ecx", "edx", "ebx", "esi", "edi" };
128 return kNames[index]; 128 return kNames[index];
129 } 129 }
130 130
131 131
132 inline int Register::ToAllocationIndex(Register reg) { 132 inline int Register::ToAllocationIndex(Register reg) {
133 ASSERT(reg.is_valid() && !reg.is(esp) && !reg.is(ebp)); 133 DCHECK(reg.is_valid() && !reg.is(esp) && !reg.is(ebp));
134 return (reg.code() >= 6) ? reg.code() - 2 : reg.code(); 134 return (reg.code() >= 6) ? reg.code() - 2 : reg.code();
135 } 135 }
136 136
137 137
138 inline Register Register::FromAllocationIndex(int index) { 138 inline Register Register::FromAllocationIndex(int index) {
139 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); 139 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
140 return (index >= 4) ? from_code(index + 2) : from_code(index); 140 return (index >= 4) ? from_code(index + 2) : from_code(index);
141 } 141 }
142 142
143 143
144 struct XMMRegister { 144 struct XMMRegister {
145 static const int kMaxNumAllocatableRegisters = 7; 145 static const int kMaxNumAllocatableRegisters = 7;
146 static const int kMaxNumRegisters = 8; 146 static const int kMaxNumRegisters = 8;
147 static int NumAllocatableRegisters() { 147 static int NumAllocatableRegisters() {
148 return kMaxNumAllocatableRegisters; 148 return kMaxNumAllocatableRegisters;
149 } 149 }
150 150
151 static int ToAllocationIndex(XMMRegister reg) { 151 static int ToAllocationIndex(XMMRegister reg) {
152 ASSERT(reg.code() != 0); 152 DCHECK(reg.code() != 0);
153 return reg.code() - 1; 153 return reg.code() - 1;
154 } 154 }
155 155
156 static XMMRegister FromAllocationIndex(int index) { 156 static XMMRegister FromAllocationIndex(int index) {
157 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); 157 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
158 return from_code(index + 1); 158 return from_code(index + 1);
159 } 159 }
160 160
161 static XMMRegister from_code(int code) { 161 static XMMRegister from_code(int code) {
162 XMMRegister result = { code }; 162 XMMRegister result = { code };
163 return result; 163 return result;
164 } 164 }
165 165
166 bool is_valid() const { 166 bool is_valid() const {
167 return 0 <= code_ && code_ < kMaxNumRegisters; 167 return 0 <= code_ && code_ < kMaxNumRegisters;
168 } 168 }
169 169
170 int code() const { 170 int code() const {
171 ASSERT(is_valid()); 171 DCHECK(is_valid());
172 return code_; 172 return code_;
173 } 173 }
174 174
175 bool is(XMMRegister reg) const { return code_ == reg.code_; } 175 bool is(XMMRegister reg) const { return code_ == reg.code_; }
176 176
177 static const char* AllocationIndexToString(int index) { 177 static const char* AllocationIndexToString(int index) {
178 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); 178 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters);
179 const char* const names[] = { 179 const char* const names[] = {
180 "xmm1", 180 "xmm1",
181 "xmm2", 181 "xmm2",
182 "xmm3", 182 "xmm3",
183 "xmm4", 183 "xmm4",
184 "xmm5", 184 "xmm5",
185 "xmm6", 185 "xmm6",
186 "xmm7" 186 "xmm7"
187 }; 187 };
188 return names[index]; 188 return names[index];
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { 1168 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) {
1169 if (assembler_->buffer_overflow()) assembler_->GrowBuffer(); 1169 if (assembler_->buffer_overflow()) assembler_->GrowBuffer();
1170 #ifdef DEBUG 1170 #ifdef DEBUG
1171 space_before_ = assembler_->available_space(); 1171 space_before_ = assembler_->available_space();
1172 #endif 1172 #endif
1173 } 1173 }
1174 1174
1175 #ifdef DEBUG 1175 #ifdef DEBUG
1176 ~EnsureSpace() { 1176 ~EnsureSpace() {
1177 int bytes_generated = space_before_ - assembler_->available_space(); 1177 int bytes_generated = space_before_ - assembler_->available_space();
1178 ASSERT(bytes_generated < assembler_->kGap); 1178 DCHECK(bytes_generated < assembler_->kGap);
1179 } 1179 }
1180 #endif 1180 #endif
1181 1181
1182 private: 1182 private:
1183 Assembler* assembler_; 1183 Assembler* assembler_;
1184 #ifdef DEBUG 1184 #ifdef DEBUG
1185 int space_before_; 1185 int space_before_;
1186 #endif 1186 #endif
1187 }; 1187 };
1188 1188
1189 } } // namespace v8::internal 1189 } } // namespace v8::internal
1190 1190
1191 #endif // V8_IA32_ASSEMBLER_IA32_H_ 1191 #endif // V8_IA32_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/hydrogen-uint32-analysis.cc ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698