OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include "src/disasm.h" | 7 #include "src/disasm.h" |
8 #include "src/disassembler.h" | 8 #include "src/disassembler.h" |
9 #include "src/interpreter/bytecodes.h" | 9 #include "src/interpreter/bytecodes.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 } | 319 } |
320 | 320 |
321 | 321 |
322 void JSObject::PrintElements(std::ostream& os) { // NOLINT | 322 void JSObject::PrintElements(std::ostream& os) { // NOLINT |
323 // Don't call GetElementsKind, its validation code can cause the printer to | 323 // Don't call GetElementsKind, its validation code can cause the printer to |
324 // fail when debugging. | 324 // fail when debugging. |
325 switch (map()->elements_kind()) { | 325 switch (map()->elements_kind()) { |
326 case FAST_HOLEY_SMI_ELEMENTS: | 326 case FAST_HOLEY_SMI_ELEMENTS: |
327 case FAST_SMI_ELEMENTS: | 327 case FAST_SMI_ELEMENTS: |
328 case FAST_HOLEY_ELEMENTS: | 328 case FAST_HOLEY_ELEMENTS: |
329 case FAST_ELEMENTS: { | 329 case FAST_ELEMENTS: |
| 330 case FAST_STRING_WRAPPER_ELEMENTS: { |
330 // Print in array notation for non-sparse arrays. | 331 // Print in array notation for non-sparse arrays. |
331 FixedArray* p = FixedArray::cast(elements()); | 332 FixedArray* p = FixedArray::cast(elements()); |
332 for (int i = 0; i < p->length(); i++) { | 333 for (int i = 0; i < p->length(); i++) { |
333 os << "\n " << i << ": " << Brief(p->get(i)); | 334 os << "\n " << i << ": " << Brief(p->get(i)); |
334 } | 335 } |
335 break; | 336 break; |
336 } | 337 } |
337 case FAST_HOLEY_DOUBLE_ELEMENTS: | 338 case FAST_HOLEY_DOUBLE_ELEMENTS: |
338 case FAST_DOUBLE_ELEMENTS: { | 339 case FAST_DOUBLE_ELEMENTS: { |
339 // Print in array notation for non-sparse arrays. | 340 // Print in array notation for non-sparse arrays. |
(...skipping 24 matching lines...) Expand all Loading... |
364 PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array) | 365 PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array) |
365 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array) | 366 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array) |
366 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array) | 367 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array) |
367 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array) | 368 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array) |
368 PRINT_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array) | 369 PRINT_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array) |
369 PRINT_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array) | 370 PRINT_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array) |
370 | 371 |
371 #undef PRINT_ELEMENTS | 372 #undef PRINT_ELEMENTS |
372 | 373 |
373 case DICTIONARY_ELEMENTS: | 374 case DICTIONARY_ELEMENTS: |
| 375 case SLOW_STRING_WRAPPER_ELEMENTS: |
374 os << "\n - elements: "; | 376 os << "\n - elements: "; |
375 elements()->Print(os); | 377 elements()->Print(os); |
376 break; | 378 break; |
377 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 379 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
378 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { | 380 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { |
379 FixedArray* p = FixedArray::cast(elements()); | 381 FixedArray* p = FixedArray::cast(elements()); |
380 os << "\n parameter map:"; | 382 os << "\n parameter map:"; |
381 for (int i = 2; i < p->length(); i++) { | 383 for (int i = 2; i < p->length(); i++) { |
382 os << " " << (i - 2) << ":" << Brief(p->get(i)); | 384 os << " " << (i - 2) << ":" << Brief(p->get(i)); |
383 } | 385 } |
384 os << "\n context: " << Brief(p->get(0)) | 386 os << "\n context: " << Brief(p->get(0)) |
385 << "\n arguments: " << Brief(p->get(1)); | 387 << "\n arguments: " << Brief(p->get(1)); |
386 break; | 388 break; |
387 } | 389 } |
| 390 case NO_ELEMENTS: |
| 391 break; |
388 } | 392 } |
389 } | 393 } |
390 | 394 |
391 | 395 |
392 static void JSObjectPrintHeader(std::ostream& os, JSObject* obj, | 396 static void JSObjectPrintHeader(std::ostream& os, JSObject* obj, |
393 const char* id) { // NOLINT | 397 const char* id) { // NOLINT |
394 obj->PrintHeader(os, id); | 398 obj->PrintHeader(os, id); |
395 // Don't call GetElementsKind, its validation code can cause the printer to | 399 // Don't call GetElementsKind, its validation code can cause the printer to |
396 // fail when debugging. | 400 // fail when debugging. |
397 PrototypeIterator iter(obj->GetIsolate(), obj); | 401 PrototypeIterator iter(obj->GetIsolate(), obj); |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1326 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
1323 Object* transitions = map()->raw_transitions(); | 1327 Object* transitions = map()->raw_transitions(); |
1324 int num_transitions = TransitionArray::NumberOfTransitions(transitions); | 1328 int num_transitions = TransitionArray::NumberOfTransitions(transitions); |
1325 if (num_transitions == 0) return; | 1329 if (num_transitions == 0) return; |
1326 os << "\n - transitions"; | 1330 os << "\n - transitions"; |
1327 TransitionArray::PrintTransitions(os, transitions, false); | 1331 TransitionArray::PrintTransitions(os, transitions, false); |
1328 } | 1332 } |
1329 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1333 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
1330 } // namespace internal | 1334 } // namespace internal |
1331 } // namespace v8 | 1335 } // namespace v8 |
OLD | NEW |