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

Side by Side Diff: src/objects-printer.cc

Issue 145133013: External Array renaming and boilerplate scrapping (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 break; 100 break;
101 case FIXED_ARRAY_TYPE: 101 case FIXED_ARRAY_TYPE:
102 FixedArray::cast(this)->FixedArrayPrint(out); 102 FixedArray::cast(this)->FixedArrayPrint(out);
103 break; 103 break;
104 case BYTE_ARRAY_TYPE: 104 case BYTE_ARRAY_TYPE:
105 ByteArray::cast(this)->ByteArrayPrint(out); 105 ByteArray::cast(this)->ByteArrayPrint(out);
106 break; 106 break;
107 case FREE_SPACE_TYPE: 107 case FREE_SPACE_TYPE:
108 FreeSpace::cast(this)->FreeSpacePrint(out); 108 FreeSpace::cast(this)->FreeSpacePrint(out);
109 break; 109 break;
110 case EXTERNAL_PIXEL_ARRAY_TYPE: 110
111 ExternalPixelArray::cast(this)->ExternalPixelArrayPrint(out); 111 #define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
112 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
113 External##Type##Array::cast(this)->External##Type##ArrayPrint(out); \
112 break; 114 break;
113 case EXTERNAL_BYTE_ARRAY_TYPE: 115
114 ExternalByteArray::cast(this)->ExternalByteArrayPrint(out); 116 TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY)
115 break; 117 #undef PRINT_EXTERNAL_ARRAY
116 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 118
117 ExternalUnsignedByteArray::cast(this) 119 #define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
118 ->ExternalUnsignedByteArrayPrint(out);
119 break;
120 case EXTERNAL_SHORT_ARRAY_TYPE:
121 ExternalShortArray::cast(this)->ExternalShortArrayPrint(out);
122 break;
123 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
124 ExternalUnsignedShortArray::cast(this)
125 ->ExternalUnsignedShortArrayPrint(out);
126 break;
127 case EXTERNAL_INT_ARRAY_TYPE:
128 ExternalIntArray::cast(this)->ExternalIntArrayPrint(out);
129 break;
130 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
131 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out);
132 break;
133 case EXTERNAL_FLOAT_ARRAY_TYPE:
134 ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out);
135 break;
136 case EXTERNAL_DOUBLE_ARRAY_TYPE:
137 ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out);
138 break;
139 #define PRINT_FIXED_TYPED_ARRAY(Type) \
140 case Fixed##Type##Array::kInstanceType: \ 120 case Fixed##Type##Array::kInstanceType: \
141 Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \ 121 Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \
142 break; 122 break;
143 123
144 PRINT_FIXED_TYPED_ARRAY(Uint8) 124 TYPED_ARRAYS(PRINT_FIXED_TYPED_ARRAY)
145 PRINT_FIXED_TYPED_ARRAY(Int8) 125 #undef PRINT_FIXED_TYPED_ARRAY
146 PRINT_FIXED_TYPED_ARRAY(Uint16)
147 PRINT_FIXED_TYPED_ARRAY(Int16)
148 PRINT_FIXED_TYPED_ARRAY(Uint32)
149 PRINT_FIXED_TYPED_ARRAY(Int32)
150 PRINT_FIXED_TYPED_ARRAY(Float32)
151 PRINT_FIXED_TYPED_ARRAY(Float64)
152 PRINT_FIXED_TYPED_ARRAY(Uint8Clamped)
153
154 #undef PPINT_FIXED_TYPED_ARRAY
155
156 126
157 case FILLER_TYPE: 127 case FILLER_TYPE:
158 PrintF(out, "filler"); 128 PrintF(out, "filler");
159 break; 129 break;
160 case JS_OBJECT_TYPE: // fall through 130 case JS_OBJECT_TYPE: // fall through
161 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 131 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
162 case JS_ARRAY_TYPE: 132 case JS_ARRAY_TYPE:
163 case JS_GENERATOR_OBJECT_TYPE: 133 case JS_GENERATOR_OBJECT_TYPE:
164 case JS_REGEXP_TYPE: 134 case JS_REGEXP_TYPE:
165 JSObject::cast(this)->JSObjectPrint(out); 135 JSObject::cast(this)->JSObjectPrint(out);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void ByteArray::ByteArrayPrint(FILE* out) { 222 void ByteArray::ByteArrayPrint(FILE* out) {
253 PrintF(out, "byte array, data starts at %p", GetDataStartAddress()); 223 PrintF(out, "byte array, data starts at %p", GetDataStartAddress());
254 } 224 }
255 225
256 226
257 void FreeSpace::FreeSpacePrint(FILE* out) { 227 void FreeSpace::FreeSpacePrint(FILE* out) {
258 PrintF(out, "free space, size %d", Size()); 228 PrintF(out, "free space, size %d", Size());
259 } 229 }
260 230
261 231
262 void ExternalPixelArray::ExternalPixelArrayPrint(FILE* out) { 232 #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
263 PrintF(out, "external pixel array"); 233 void External##Type##Array::External##Type##ArrayPrint(FILE* out) { \
264 } 234 PrintF(out, "external " #type " array"); \
235 }
265 236
237 TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
266 238
267 void ExternalByteArray::ExternalByteArrayPrint(FILE* out) { 239 #undef EXTERNAL_ARRAY_PRINTER
268 PrintF(out, "external byte array");
269 }
270 240
271 241
272 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) {
273 PrintF(out, "external unsigned byte array");
274 }
275
276
277 void ExternalShortArray::ExternalShortArrayPrint(FILE* out) {
278 PrintF(out, "external short array");
279 }
280
281
282 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) {
283 PrintF(out, "external unsigned short array");
284 }
285
286
287 void ExternalIntArray::ExternalIntArrayPrint(FILE* out) {
288 PrintF(out, "external int array");
289 }
290
291
292 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) {
293 PrintF(out, "external unsigned int array");
294 }
295
296
297 void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) {
298 PrintF(out, "external float array");
299 }
300
301
302 void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) {
303 PrintF(out, "external double array");
304 }
305
306 template <class Traits> 242 template <class Traits>
307 void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) { 243 void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) {
308 PrintF(out, "fixed %s", Traits::Designator()); 244 PrintF(out, "fixed %s", Traits::Designator());
309 } 245 }
310 246
311 247
312 void JSObject::PrintProperties(FILE* out) { 248 void JSObject::PrintProperties(FILE* out) {
313 if (HasFastProperties()) { 249 if (HasFastProperties()) {
314 DescriptorArray* descs = map()->instance_descriptors(); 250 DescriptorArray* descs = map()->instance_descriptors();
315 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { 251 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 DoPrintElements<Type>(out, elements()); \ 341 DoPrintElements<Type>(out, elements()); \
406 break; \ 342 break; \
407 } 343 }
408 344
409 #define PRINT_DOUBLE_ELEMENTS(Kind, Type) \ 345 #define PRINT_DOUBLE_ELEMENTS(Kind, Type) \
410 case Kind: { \ 346 case Kind: { \
411 DoPrintDoubleElements<Type>(out, elements()); \ 347 DoPrintDoubleElements<Type>(out, elements()); \
412 break; \ 348 break; \
413 } 349 }
414 350
415 PRINT_ELEMENTS(EXTERNAL_PIXEL_ELEMENTS, ExternalPixelArray) 351 PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray)
416 PRINT_ELEMENTS(EXTERNAL_BYTE_ELEMENTS, ExternalByteArray) 352 PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array)
417 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_BYTE_ELEMENTS, 353 PRINT_ELEMENTS(EXTERNAL_UINT8_ELEMENTS,
418 ExternalUnsignedByteArray) 354 ExternalUint8Array)
419 PRINT_ELEMENTS(EXTERNAL_SHORT_ELEMENTS, ExternalShortArray) 355 PRINT_ELEMENTS(EXTERNAL_INT16_ELEMENTS, ExternalInt16Array)
420 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_SHORT_ELEMENTS, 356 PRINT_ELEMENTS(EXTERNAL_UINT16_ELEMENTS,
421 ExternalUnsignedShortArray) 357 ExternalUint16Array)
422 PRINT_ELEMENTS(EXTERNAL_INT_ELEMENTS, ExternalIntArray) 358 PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array)
423 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_INT_ELEMENTS, 359 PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS,
424 ExternalUnsignedIntArray) 360 ExternalUint32Array)
425 PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT_ELEMENTS, ExternalFloatArray) 361 PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
426 PRINT_DOUBLE_ELEMENTS(EXTERNAL_DOUBLE_ELEMENTS, ExternalDoubleArray) 362 PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
427 363
428 364
429 PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array) 365 PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
430 PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray) 366 PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray)
431 PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array) 367 PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array)
432 PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array) 368 PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array)
433 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array) 369 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array)
434 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array) 370 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array)
435 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array) 371 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array)
436 PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array) 372 PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array)
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 } 1220 }
1285 } 1221 }
1286 PrintF(out, "\n"); 1222 PrintF(out, "\n");
1287 } 1223 }
1288 1224
1289 1225
1290 #endif // OBJECT_PRINT 1226 #endif // OBJECT_PRINT
1291 1227
1292 1228
1293 } } // namespace v8::internal 1229 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/objects-inl.h ('k') | src/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698