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

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

Issue 7527001: Encapsulate element handling into a class keyed on ElementsKind (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with tot Created 9 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
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 break; 283 break;
284 } 284 }
285 case FAST_DOUBLE_ELEMENTS: { 285 case FAST_DOUBLE_ELEMENTS: {
286 // Print in array notation for non-sparse arrays. 286 // Print in array notation for non-sparse arrays.
287 FixedDoubleArray* p = FixedDoubleArray::cast(elements()); 287 FixedDoubleArray* p = FixedDoubleArray::cast(elements());
288 for (int i = 0; i < p->length(); i++) { 288 for (int i = 0; i < p->length(); i++) {
289 if (p->is_the_hole(i)) { 289 if (p->is_the_hole(i)) {
290 PrintF(out, " %d: <the hole>", i); 290 PrintF(out, " %d: <the hole>", i);
291 } else { 291 } else {
292 PrintF(out, " %d: %g", i, p->get(i)); 292 PrintF(out, " %d: %g", i, p->get_scalar(i));
293 } 293 }
294 PrintF(out, "\n"); 294 PrintF(out, "\n");
295 } 295 }
296 break; 296 break;
297 } 297 }
298 case EXTERNAL_PIXEL_ELEMENTS: { 298 case EXTERNAL_PIXEL_ELEMENTS: {
299 ExternalPixelArray* p = ExternalPixelArray::cast(elements()); 299 ExternalPixelArray* p = ExternalPixelArray::cast(elements());
300 for (int i = 0; i < p->length(); i++) { 300 for (int i = 0; i < p->length(); i++) {
301 PrintF(out, " %d: %d\n", i, p->get(i)); 301 PrintF(out, " %d: %d\n", i, p->get_scalar(i));
302 } 302 }
303 break; 303 break;
304 } 304 }
305 case EXTERNAL_BYTE_ELEMENTS: { 305 case EXTERNAL_BYTE_ELEMENTS: {
306 ExternalByteArray* p = ExternalByteArray::cast(elements()); 306 ExternalByteArray* p = ExternalByteArray::cast(elements());
307 for (int i = 0; i < p->length(); i++) { 307 for (int i = 0; i < p->length(); i++) {
308 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); 308 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
309 } 309 }
310 break; 310 break;
311 } 311 }
312 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { 312 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
313 ExternalUnsignedByteArray* p = 313 ExternalUnsignedByteArray* p =
314 ExternalUnsignedByteArray::cast(elements()); 314 ExternalUnsignedByteArray::cast(elements());
315 for (int i = 0; i < p->length(); i++) { 315 for (int i = 0; i < p->length(); i++) {
316 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); 316 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
317 } 317 }
318 break; 318 break;
319 } 319 }
320 case EXTERNAL_SHORT_ELEMENTS: { 320 case EXTERNAL_SHORT_ELEMENTS: {
321 ExternalShortArray* p = ExternalShortArray::cast(elements()); 321 ExternalShortArray* p = ExternalShortArray::cast(elements());
322 for (int i = 0; i < p->length(); i++) { 322 for (int i = 0; i < p->length(); i++) {
323 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); 323 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
324 } 324 }
325 break; 325 break;
326 } 326 }
327 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { 327 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
328 ExternalUnsignedShortArray* p = 328 ExternalUnsignedShortArray* p =
329 ExternalUnsignedShortArray::cast(elements()); 329 ExternalUnsignedShortArray::cast(elements());
330 for (int i = 0; i < p->length(); i++) { 330 for (int i = 0; i < p->length(); i++) {
331 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); 331 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
332 } 332 }
333 break; 333 break;
334 } 334 }
335 case EXTERNAL_INT_ELEMENTS: { 335 case EXTERNAL_INT_ELEMENTS: {
336 ExternalIntArray* p = ExternalIntArray::cast(elements()); 336 ExternalIntArray* p = ExternalIntArray::cast(elements());
337 for (int i = 0; i < p->length(); i++) { 337 for (int i = 0; i < p->length(); i++) {
338 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); 338 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
339 } 339 }
340 break; 340 break;
341 } 341 }
342 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { 342 case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
343 ExternalUnsignedIntArray* p = 343 ExternalUnsignedIntArray* p =
344 ExternalUnsignedIntArray::cast(elements()); 344 ExternalUnsignedIntArray::cast(elements());
345 for (int i = 0; i < p->length(); i++) { 345 for (int i = 0; i < p->length(); i++) {
346 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i))); 346 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get_scalar(i)));
347 } 347 }
348 break; 348 break;
349 } 349 }
350 case EXTERNAL_FLOAT_ELEMENTS: { 350 case EXTERNAL_FLOAT_ELEMENTS: {
351 ExternalFloatArray* p = ExternalFloatArray::cast(elements()); 351 ExternalFloatArray* p = ExternalFloatArray::cast(elements());
352 for (int i = 0; i < p->length(); i++) { 352 for (int i = 0; i < p->length(); i++) {
353 PrintF(out, " %d: %f\n", i, p->get(i)); 353 PrintF(out, " %d: %f\n", i, p->get_scalar(i));
354 } 354 }
355 break; 355 break;
356 } 356 }
357 case EXTERNAL_DOUBLE_ELEMENTS: { 357 case EXTERNAL_DOUBLE_ELEMENTS: {
358 ExternalDoubleArray* p = ExternalDoubleArray::cast(elements()); 358 ExternalDoubleArray* p = ExternalDoubleArray::cast(elements());
359 for (int i = 0; i < p->length(); i++) { 359 for (int i = 0; i < p->length(); i++) {
360 PrintF(out, " %d: %f\n", i, p->get(i)); 360 PrintF(out, " %d: %f\n", i, p->get_scalar(i));
361 } 361 }
362 break; 362 break;
363 } 363 }
364 case DICTIONARY_ELEMENTS: 364 case DICTIONARY_ELEMENTS:
365 elements()->Print(out); 365 elements()->Print(out);
366 break; 366 break;
367 case NON_STRICT_ARGUMENTS_ELEMENTS: { 367 case NON_STRICT_ARGUMENTS_ELEMENTS: {
368 FixedArray* p = FixedArray::cast(elements()); 368 FixedArray* p = FixedArray::cast(elements());
369 for (int i = 2; i < p->length(); i++) { 369 for (int i = 2; i < p->length(); i++) {
370 PrintF(out, " %d: ", i); 370 PrintF(out, " %d: ", i);
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 desc.Print(out); 861 desc.Print(out);
862 } 862 }
863 PrintF(out, "\n"); 863 PrintF(out, "\n");
864 } 864 }
865 865
866 866
867 #endif // OBJECT_PRINT 867 #endif // OBJECT_PRINT
868 868
869 869
870 } } // namespace v8::internal 870 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/objects-inl.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698