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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 8387070: Make non-templatized versions of LIR printing functions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 1 month 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-instructions.h ('k') | src/ia32/assembler-ia32.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 return 0xffffffff; 120 return 0xffffffff;
121 } 121 }
122 122
123 123
124 void Range::AddConstant(int32_t value) { 124 void Range::AddConstant(int32_t value) {
125 if (value == 0) return; 125 if (value == 0) return;
126 bool may_overflow = false; // Overflow is ignored here. 126 bool may_overflow = false; // Overflow is ignored here.
127 lower_ = AddWithoutOverflow(lower_, value, &may_overflow); 127 lower_ = AddWithoutOverflow(lower_, value, &may_overflow);
128 upper_ = AddWithoutOverflow(upper_, value, &may_overflow); 128 upper_ = AddWithoutOverflow(upper_, value, &may_overflow);
129 #ifdef DEBUG
129 Verify(); 130 Verify();
131 #endif
130 } 132 }
131 133
132 134
133 void Range::Intersect(Range* other) { 135 void Range::Intersect(Range* other) {
134 upper_ = Min(upper_, other->upper_); 136 upper_ = Min(upper_, other->upper_);
135 lower_ = Max(lower_, other->lower_); 137 lower_ = Max(lower_, other->lower_);
136 bool b = CanBeMinusZero() && other->CanBeMinusZero(); 138 bool b = CanBeMinusZero() && other->CanBeMinusZero();
137 set_can_be_minus_zero(b); 139 set_can_be_minus_zero(b);
138 } 140 }
139 141
(...skipping 26 matching lines...) Expand all
166 } 168 }
167 set_can_be_minus_zero(false); 169 set_can_be_minus_zero(false);
168 } 170 }
169 171
170 172
171 bool Range::AddAndCheckOverflow(Range* other) { 173 bool Range::AddAndCheckOverflow(Range* other) {
172 bool may_overflow = false; 174 bool may_overflow = false;
173 lower_ = AddWithoutOverflow(lower_, other->lower(), &may_overflow); 175 lower_ = AddWithoutOverflow(lower_, other->lower(), &may_overflow);
174 upper_ = AddWithoutOverflow(upper_, other->upper(), &may_overflow); 176 upper_ = AddWithoutOverflow(upper_, other->upper(), &may_overflow);
175 KeepOrder(); 177 KeepOrder();
178 #ifdef DEBUG
176 Verify(); 179 Verify();
180 #endif
177 return may_overflow; 181 return may_overflow;
178 } 182 }
179 183
180 184
181 bool Range::SubAndCheckOverflow(Range* other) { 185 bool Range::SubAndCheckOverflow(Range* other) {
182 bool may_overflow = false; 186 bool may_overflow = false;
183 lower_ = SubWithoutOverflow(lower_, other->upper(), &may_overflow); 187 lower_ = SubWithoutOverflow(lower_, other->upper(), &may_overflow);
184 upper_ = SubWithoutOverflow(upper_, other->lower(), &may_overflow); 188 upper_ = SubWithoutOverflow(upper_, other->lower(), &may_overflow);
185 KeepOrder(); 189 KeepOrder();
190 #ifdef DEBUG
186 Verify(); 191 Verify();
192 #endif
187 return may_overflow; 193 return may_overflow;
188 } 194 }
189 195
190 196
191 void Range::KeepOrder() { 197 void Range::KeepOrder() {
192 if (lower_ > upper_) { 198 if (lower_ > upper_) {
193 int32_t tmp = lower_; 199 int32_t tmp = lower_;
194 lower_ = upper_; 200 lower_ = upper_;
195 upper_ = tmp; 201 upper_ = tmp;
196 } 202 }
197 } 203 }
198 204
199 205
206 #ifdef DEBUG
200 void Range::Verify() const { 207 void Range::Verify() const {
201 ASSERT(lower_ <= upper_); 208 ASSERT(lower_ <= upper_);
202 } 209 }
210 #endif
203 211
204 212
205 bool Range::MulAndCheckOverflow(Range* other) { 213 bool Range::MulAndCheckOverflow(Range* other) {
206 bool may_overflow = false; 214 bool may_overflow = false;
207 int v1 = MulWithoutOverflow(lower_, other->lower(), &may_overflow); 215 int v1 = MulWithoutOverflow(lower_, other->lower(), &may_overflow);
208 int v2 = MulWithoutOverflow(lower_, other->upper(), &may_overflow); 216 int v2 = MulWithoutOverflow(lower_, other->upper(), &may_overflow);
209 int v3 = MulWithoutOverflow(upper_, other->lower(), &may_overflow); 217 int v3 = MulWithoutOverflow(upper_, other->lower(), &may_overflow);
210 int v4 = MulWithoutOverflow(upper_, other->upper(), &may_overflow); 218 int v4 = MulWithoutOverflow(upper_, other->upper(), &may_overflow);
211 lower_ = Min(Min(v1, v2), Min(v3, v4)); 219 lower_ = Min(Min(v1, v2), Min(v3, v4));
212 upper_ = Max(Max(v1, v2), Max(v3, v4)); 220 upper_ = Max(Max(v1, v2), Max(v3, v4));
221 #ifdef DEBUG
213 Verify(); 222 Verify();
223 #endif
214 return may_overflow; 224 return may_overflow;
215 } 225 }
216 226
217 227
218 const char* HType::ToString() { 228 const char* HType::ToString() {
219 switch (type_) { 229 switch (type_) {
220 case kTagged: return "tagged"; 230 case kTagged: return "tagged";
221 case kTaggedPrimitive: return "primitive"; 231 case kTaggedPrimitive: return "primitive";
222 case kTaggedNumber: return "number"; 232 case kTaggedNumber: return "number";
223 case kSmi: return "smi"; 233 case kSmi: return "smi";
224 case kHeapNumber: return "heap-number"; 234 case kHeapNumber: return "heap-number";
225 case kString: return "string"; 235 case kString: return "string";
226 case kBoolean: return "boolean"; 236 case kBoolean: return "boolean";
227 case kNonPrimitive: return "non-primitive"; 237 case kNonPrimitive: return "non-primitive";
228 case kJSArray: return "array"; 238 case kJSArray: return "array";
229 case kJSObject: return "object"; 239 case kJSObject: return "object";
230 case kUninitialized: return "uninitialized"; 240 case kUninitialized: return "uninitialized";
231 } 241 }
232 UNREACHABLE(); 242 UNREACHABLE();
233 return "Unreachable code"; 243 return "Unreachable code";
234 } 244 }
235 245
236 246
237 const char* HType::ToShortString() {
238 switch (type_) {
239 case kTagged: return "t";
240 case kTaggedPrimitive: return "p";
241 case kTaggedNumber: return "n";
242 case kSmi: return "m";
243 case kHeapNumber: return "h";
244 case kString: return "s";
245 case kBoolean: return "b";
246 case kNonPrimitive: return "r";
247 case kJSArray: return "a";
248 case kJSObject: return "o";
249 case kUninitialized: return "z";
250 }
251 UNREACHABLE();
252 return "Unreachable code";
253 }
254
255
256 HType HType::TypeFromValue(Handle<Object> value) { 247 HType HType::TypeFromValue(Handle<Object> value) {
257 HType result = HType::Tagged(); 248 HType result = HType::Tagged();
258 if (value->IsSmi()) { 249 if (value->IsSmi()) {
259 result = HType::Smi(); 250 result = HType::Smi();
260 } else if (value->IsHeapNumber()) { 251 } else if (value->IsHeapNumber()) {
261 result = HType::HeapNumber(); 252 result = HType::HeapNumber();
262 } else if (value->IsString()) { 253 } else if (value->IsString()) {
263 result = HType::String(); 254 result = HType::String();
264 } else if (value->IsBoolean()) { 255 } else if (value->IsBoolean()) {
265 result = HType::Boolean(); 256 result = HType::Boolean();
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 1934
1944 1935
1945 void HCheckPrototypeMaps::Verify() { 1936 void HCheckPrototypeMaps::Verify() {
1946 HInstruction::Verify(); 1937 HInstruction::Verify();
1947 ASSERT(HasNoUses()); 1938 ASSERT(HasNoUses());
1948 } 1939 }
1949 1940
1950 #endif 1941 #endif
1951 1942
1952 } } // namespace v8::internal 1943 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698