OLD | NEW |
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } else { | 311 } else { |
312 property_dictionary()->Print(out); | 312 property_dictionary()->Print(out); |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 void JSObject::PrintElements(FILE* out) { | 317 void JSObject::PrintElements(FILE* out) { |
318 // Don't call GetElementsKind, its validation code can cause the printer to | 318 // Don't call GetElementsKind, its validation code can cause the printer to |
319 // fail when debugging. | 319 // fail when debugging. |
320 switch (map()->elements_kind()) { | 320 switch (map()->elements_kind()) { |
321 case FAST_SMI_ONLY_ELEMENTS: | 321 case FAST_HOLEY_SMI_ELEMENTS: |
| 322 case FAST_SMI_ELEMENTS: |
| 323 case FAST_HOLEY_ELEMENTS: |
322 case FAST_ELEMENTS: { | 324 case FAST_ELEMENTS: { |
323 // Print in array notation for non-sparse arrays. | 325 // Print in array notation for non-sparse arrays. |
324 FixedArray* p = FixedArray::cast(elements()); | 326 FixedArray* p = FixedArray::cast(elements()); |
325 for (int i = 0; i < p->length(); i++) { | 327 for (int i = 0; i < p->length(); i++) { |
326 PrintF(out, " %d: ", i); | 328 PrintF(out, " %d: ", i); |
327 p->get(i)->ShortPrint(out); | 329 p->get(i)->ShortPrint(out); |
328 PrintF(out, "\n"); | 330 PrintF(out, "\n"); |
329 } | 331 } |
330 break; | 332 break; |
331 } | 333 } |
| 334 case FAST_HOLEY_DOUBLE_ELEMENTS: |
332 case FAST_DOUBLE_ELEMENTS: { | 335 case FAST_DOUBLE_ELEMENTS: { |
333 // Print in array notation for non-sparse arrays. | 336 // Print in array notation for non-sparse arrays. |
334 FixedDoubleArray* p = FixedDoubleArray::cast(elements()); | 337 if (elements()->length() != 0) { |
335 for (int i = 0; i < p->length(); i++) { | 338 FixedDoubleArray* p = FixedDoubleArray::cast(elements()); |
336 if (p->is_the_hole(i)) { | 339 for (int i = 0; i < p->length(); i++) { |
337 PrintF(out, " %d: <the hole>", i); | 340 if (p->is_the_hole(i)) { |
338 } else { | 341 PrintF(out, " %d: <the hole>", i); |
339 PrintF(out, " %d: %g", i, p->get_scalar(i)); | 342 } else { |
| 343 PrintF(out, " %d: %g", i, p->get_scalar(i)); |
| 344 } |
| 345 PrintF(out, "\n"); |
340 } | 346 } |
341 PrintF(out, "\n"); | |
342 } | 347 } |
343 break; | 348 break; |
344 } | 349 } |
345 case EXTERNAL_PIXEL_ELEMENTS: { | 350 case EXTERNAL_PIXEL_ELEMENTS: { |
346 ExternalPixelArray* p = ExternalPixelArray::cast(elements()); | 351 ExternalPixelArray* p = ExternalPixelArray::cast(elements()); |
347 for (int i = 0; i < p->length(); i++) { | 352 for (int i = 0; i < p->length(); i++) { |
348 PrintF(out, " %d: %d\n", i, p->get_scalar(i)); | 353 PrintF(out, " %d: %d\n", i, p->get_scalar(i)); |
349 } | 354 } |
350 break; | 355 break; |
351 } | 356 } |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 desc.Print(out); | 1033 desc.Print(out); |
1029 } | 1034 } |
1030 PrintF(out, "\n"); | 1035 PrintF(out, "\n"); |
1031 } | 1036 } |
1032 | 1037 |
1033 | 1038 |
1034 #endif // OBJECT_PRINT | 1039 #endif // OBJECT_PRINT |
1035 | 1040 |
1036 | 1041 |
1037 } } // namespace v8::internal | 1042 } } // namespace v8::internal |
OLD | NEW |