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

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

Issue 140793003: Revert "Implement in-heap backing store for typed arrays." (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
« no previous file with comments | « src/objects-inl.h ('k') | src/objects-visiting.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 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 break; 129 break;
130 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 130 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
131 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out); 131 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out);
132 break; 132 break;
133 case EXTERNAL_FLOAT_ARRAY_TYPE: 133 case EXTERNAL_FLOAT_ARRAY_TYPE:
134 ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out); 134 ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out);
135 break; 135 break;
136 case EXTERNAL_DOUBLE_ARRAY_TYPE: 136 case EXTERNAL_DOUBLE_ARRAY_TYPE:
137 ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out); 137 ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out);
138 break; 138 break;
139 #define PRINT_FIXED_TYPED_ARRAY(Type) \
140 case Fixed##Type##Array::kInstanceType: \
141 Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \
142 break;
143
144 PRINT_FIXED_TYPED_ARRAY(Uint8)
145 PRINT_FIXED_TYPED_ARRAY(Int8)
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
157 case FILLER_TYPE: 139 case FILLER_TYPE:
158 PrintF(out, "filler"); 140 PrintF(out, "filler");
159 break; 141 break;
160 case JS_OBJECT_TYPE: // fall through 142 case JS_OBJECT_TYPE: // fall through
161 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 143 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
162 case JS_ARRAY_TYPE: 144 case JS_ARRAY_TYPE:
163 case JS_GENERATOR_OBJECT_TYPE: 145 case JS_GENERATOR_OBJECT_TYPE:
164 case JS_REGEXP_TYPE: 146 case JS_REGEXP_TYPE:
165 JSObject::cast(this)->JSObjectPrint(out); 147 JSObject::cast(this)->JSObjectPrint(out);
166 break; 148 break;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 278
297 void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) { 279 void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) {
298 PrintF(out, "external float array"); 280 PrintF(out, "external float array");
299 } 281 }
300 282
301 283
302 void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) { 284 void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) {
303 PrintF(out, "external double array"); 285 PrintF(out, "external double array");
304 } 286 }
305 287
306 template <class Traits>
307 void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) {
308 PrintF(out, "fixed %s", Traits::Designator());
309 }
310
311 288
312 void JSObject::PrintProperties(FILE* out) { 289 void JSObject::PrintProperties(FILE* out) {
313 if (HasFastProperties()) { 290 if (HasFastProperties()) {
314 DescriptorArray* descs = map()->instance_descriptors(); 291 DescriptorArray* descs = map()->instance_descriptors();
315 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { 292 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
316 PrintF(out, " "); 293 PrintF(out, " ");
317 descs->GetKey(i)->NamePrint(out); 294 descs->GetKey(i)->NamePrint(out);
318 PrintF(out, ": "); 295 PrintF(out, ": ");
319 switch (descs->GetType(i)) { 296 switch (descs->GetType(i)) {
320 case FIELD: { 297 case FIELD: {
(...skipping 19 matching lines...) Expand all
340 UNREACHABLE(); 317 UNREACHABLE();
341 break; 318 break;
342 } 319 }
343 } 320 }
344 } else { 321 } else {
345 property_dictionary()->Print(out); 322 property_dictionary()->Print(out);
346 } 323 }
347 } 324 }
348 325
349 326
350 template<class T>
351 static void DoPrintElements(FILE *out, Object* object) {
352 T* p = T::cast(object);
353 for (int i = 0; i < p->length(); i++) {
354 PrintF(out, " %d: %d\n", i, p->get_scalar(i));
355 }
356 }
357
358
359 template<class T>
360 static void DoPrintDoubleElements(FILE* out, Object* object) {
361 T* p = T::cast(object);
362 for (int i = 0; i < p->length(); i++) {
363 PrintF(out, " %d: %f\n", i, p->get_scalar(i));
364 }
365 }
366
367
368 void JSObject::PrintElements(FILE* out) { 327 void JSObject::PrintElements(FILE* out) {
369 // Don't call GetElementsKind, its validation code can cause the printer to 328 // Don't call GetElementsKind, its validation code can cause the printer to
370 // fail when debugging. 329 // fail when debugging.
371 switch (map()->elements_kind()) { 330 switch (map()->elements_kind()) {
372 case FAST_HOLEY_SMI_ELEMENTS: 331 case FAST_HOLEY_SMI_ELEMENTS:
373 case FAST_SMI_ELEMENTS: 332 case FAST_SMI_ELEMENTS:
374 case FAST_HOLEY_ELEMENTS: 333 case FAST_HOLEY_ELEMENTS:
375 case FAST_ELEMENTS: { 334 case FAST_ELEMENTS: {
376 // Print in array notation for non-sparse arrays. 335 // Print in array notation for non-sparse arrays.
377 FixedArray* p = FixedArray::cast(elements()); 336 FixedArray* p = FixedArray::cast(elements());
(...skipping 13 matching lines...) Expand all
391 if (p->is_the_hole(i)) { 350 if (p->is_the_hole(i)) {
392 PrintF(out, " %d: <the hole>", i); 351 PrintF(out, " %d: <the hole>", i);
393 } else { 352 } else {
394 PrintF(out, " %d: %g", i, p->get_scalar(i)); 353 PrintF(out, " %d: %g", i, p->get_scalar(i));
395 } 354 }
396 PrintF(out, "\n"); 355 PrintF(out, "\n");
397 } 356 }
398 } 357 }
399 break; 358 break;
400 } 359 }
401 360 case EXTERNAL_PIXEL_ELEMENTS: {
402 361 ExternalPixelArray* p = ExternalPixelArray::cast(elements());
403 #define PRINT_ELEMENTS(Kind, Type) \ 362 for (int i = 0; i < p->length(); i++) {
404 case Kind: { \ 363 PrintF(out, " %d: %d\n", i, p->get_scalar(i));
405 DoPrintElements<Type>(out, elements()); \ 364 }
406 break; \ 365 break;
407 } 366 }
408 367 case EXTERNAL_BYTE_ELEMENTS: {
409 #define PRINT_DOUBLE_ELEMENTS(Kind, Type) \ 368 ExternalByteArray* p = ExternalByteArray::cast(elements());
410 case Kind: { \ 369 for (int i = 0; i < p->length(); i++) {
411 DoPrintDoubleElements<Type>(out, elements()); \ 370 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
412 break; \ 371 }
372 break;
413 } 373 }
414 374 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
415 PRINT_ELEMENTS(EXTERNAL_PIXEL_ELEMENTS, ExternalPixelArray) 375 ExternalUnsignedByteArray* p =
416 PRINT_ELEMENTS(EXTERNAL_BYTE_ELEMENTS, ExternalByteArray) 376 ExternalUnsignedByteArray::cast(elements());
417 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_BYTE_ELEMENTS, 377 for (int i = 0; i < p->length(); i++) {
418 ExternalUnsignedByteArray) 378 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
419 PRINT_ELEMENTS(EXTERNAL_SHORT_ELEMENTS, ExternalShortArray) 379 }
420 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_SHORT_ELEMENTS, 380 break;
421 ExternalUnsignedShortArray) 381 }
422 PRINT_ELEMENTS(EXTERNAL_INT_ELEMENTS, ExternalIntArray) 382 case EXTERNAL_SHORT_ELEMENTS: {
423 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_INT_ELEMENTS, 383 ExternalShortArray* p = ExternalShortArray::cast(elements());
424 ExternalUnsignedIntArray) 384 for (int i = 0; i < p->length(); i++) {
425 PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT_ELEMENTS, ExternalFloatArray) 385 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
426 PRINT_DOUBLE_ELEMENTS(EXTERNAL_DOUBLE_ELEMENTS, ExternalDoubleArray) 386 }
427 387 break;
428 388 }
429 PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array) 389 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
430 PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray) 390 ExternalUnsignedShortArray* p =
431 PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array) 391 ExternalUnsignedShortArray::cast(elements());
432 PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array) 392 for (int i = 0; i < p->length(); i++) {
433 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array) 393 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
434 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array) 394 }
435 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array) 395 break;
436 PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array) 396 }
437 PRINT_DOUBLE_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array) 397 case EXTERNAL_INT_ELEMENTS: {
438 398 ExternalIntArray* p = ExternalIntArray::cast(elements());
439 #undef PRINT_DOUBLE_ELEMENTS 399 for (int i = 0; i < p->length(); i++) {
440 #undef PRINT_ELEMENTS 400 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
441 401 }
402 break;
403 }
404 case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
405 ExternalUnsignedIntArray* p =
406 ExternalUnsignedIntArray::cast(elements());
407 for (int i = 0; i < p->length(); i++) {
408 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
409 }
410 break;
411 }
412 case EXTERNAL_FLOAT_ELEMENTS: {
413 ExternalFloatArray* p = ExternalFloatArray::cast(elements());
414 for (int i = 0; i < p->length(); i++) {
415 PrintF(out, " %d: %f\n", i, p->get_scalar(i));
416 }
417 break;
418 }
419 case EXTERNAL_DOUBLE_ELEMENTS: {
420 ExternalDoubleArray* p = ExternalDoubleArray::cast(elements());
421 for (int i = 0; i < p->length(); i++) {
422 PrintF(out, " %d: %f\n", i, p->get_scalar(i));
423 }
424 break;
425 }
442 case DICTIONARY_ELEMENTS: 426 case DICTIONARY_ELEMENTS:
443 elements()->Print(out); 427 elements()->Print(out);
444 break; 428 break;
445 case NON_STRICT_ARGUMENTS_ELEMENTS: { 429 case NON_STRICT_ARGUMENTS_ELEMENTS: {
446 FixedArray* p = FixedArray::cast(elements()); 430 FixedArray* p = FixedArray::cast(elements());
447 PrintF(out, " parameter map:"); 431 PrintF(out, " parameter map:");
448 for (int i = 2; i < p->length(); i++) { 432 for (int i = 2; i < p->length(); i++) {
449 PrintF(out, " %d:", i - 2); 433 PrintF(out, " %d:", i - 2);
450 p->get(i)->ShortPrint(out); 434 p->get(i)->ShortPrint(out);
451 } 435 }
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 } 1268 }
1285 } 1269 }
1286 PrintF(out, "\n"); 1270 PrintF(out, "\n");
1287 } 1271 }
1288 1272
1289 1273
1290 #endif // OBJECT_PRINT 1274 #endif // OBJECT_PRINT
1291 1275
1292 1276
1293 } } // namespace v8::internal 1277 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698