Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / v8 / src / objects-printer.cc
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 //     * Redistributions of source code must retain the above copyright
7 //       notice, this list of conditions and the following disclaimer.
8 //     * Redistributions in binary form must reproduce the above
9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #include "v8.h"
29
30 #include "disassembler.h"
31 #include "disasm.h"
32 #include "jsregexp.h"
33 #include "objects-visiting.h"
34
35 namespace v8 {
36 namespace internal {
37
38 #ifdef OBJECT_PRINT
39
40 void MaybeObject::Print() {
41   Print(stdout);
42 }
43
44
45 void MaybeObject::Print(FILE* out) {
46   Object* this_as_object;
47   if (ToObject(&this_as_object)) {
48     if (this_as_object->IsSmi()) {
49       Smi::cast(this_as_object)->SmiPrint(out);
50     } else {
51       HeapObject::cast(this_as_object)->HeapObjectPrint(out);
52     }
53   } else {
54     Failure::cast(this)->FailurePrint(out);
55   }
56   Flush(out);
57 }
58
59
60 void MaybeObject::PrintLn() {
61   PrintLn(stdout);
62 }
63
64
65 void MaybeObject::PrintLn(FILE* out) {
66   Print(out);
67   PrintF(out, "\n");
68 }
69
70
71 void HeapObject::PrintHeader(FILE* out, const char* id) {
72   PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id);
73 }
74
75
76 void HeapObject::HeapObjectPrint(FILE* out) {
77   InstanceType instance_type = map()->instance_type();
78
79   HandleScope scope(GetIsolate());
80   if (instance_type < FIRST_NONSTRING_TYPE) {
81     String::cast(this)->StringPrint(out);
82     return;
83   }
84
85   switch (instance_type) {
86     case SYMBOL_TYPE:
87       Symbol::cast(this)->SymbolPrint(out);
88       break;
89     case MAP_TYPE:
90       Map::cast(this)->MapPrint(out);
91       break;
92     case HEAP_NUMBER_TYPE:
93       HeapNumber::cast(this)->HeapNumberPrint(out);
94       break;
95     case FLOAT32x4_TYPE:
96       Float32x4::cast(this)->Float32x4Print(out);
97       break;
98     case INT32x4_TYPE:
99       Int32x4::cast(this)->Int32x4Print(out);
100       break;
101     case FIXED_DOUBLE_ARRAY_TYPE:
102       FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(out);
103       break;
104     case CONSTANT_POOL_ARRAY_TYPE:
105       ConstantPoolArray::cast(this)->ConstantPoolArrayPrint(out);
106       break;
107     case FIXED_ARRAY_TYPE:
108       FixedArray::cast(this)->FixedArrayPrint(out);
109       break;
110     case BYTE_ARRAY_TYPE:
111       ByteArray::cast(this)->ByteArrayPrint(out);
112       break;
113     case FREE_SPACE_TYPE:
114       FreeSpace::cast(this)->FreeSpacePrint(out);
115       break;
116
117 #define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size)                    \
118     case EXTERNAL_##TYPE##_ARRAY_TYPE:                                         \
119       External##Type##Array::cast(this)->External##Type##ArrayPrint(out);      \
120       break;
121
122      TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY)
123 #undef PRINT_EXTERNAL_ARRAY
124
125 #define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size)                 \
126     case Fixed##Type##Array::kInstanceType:                                    \
127       Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out);               \
128       break;
129
130     TYPED_ARRAYS(PRINT_FIXED_TYPED_ARRAY)
131 #undef PRINT_FIXED_TYPED_ARRAY
132
133     case FILLER_TYPE:
134       PrintF(out, "filler");
135       break;
136     case JS_OBJECT_TYPE:  // fall through
137     case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
138     case JS_ARRAY_TYPE:
139     case JS_GENERATOR_OBJECT_TYPE:
140     case JS_REGEXP_TYPE:
141       JSObject::cast(this)->JSObjectPrint(out);
142       break;
143     case ODDBALL_TYPE:
144       Oddball::cast(this)->to_string()->Print(out);
145       break;
146     case JS_MODULE_TYPE:
147       JSModule::cast(this)->JSModulePrint(out);
148       break;
149     case JS_FUNCTION_TYPE:
150       JSFunction::cast(this)->JSFunctionPrint(out);
151       break;
152     case JS_GLOBAL_PROXY_TYPE:
153       JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out);
154       break;
155     case JS_GLOBAL_OBJECT_TYPE:
156       JSGlobalObject::cast(this)->JSGlobalObjectPrint(out);
157       break;
158     case JS_BUILTINS_OBJECT_TYPE:
159       JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out);
160       break;
161     case JS_VALUE_TYPE:
162       PrintF(out, "Value wrapper around:");
163       JSValue::cast(this)->value()->Print(out);
164       break;
165     case JS_DATE_TYPE:
166       JSDate::cast(this)->JSDatePrint(out);
167       break;
168     case CODE_TYPE:
169       Code::cast(this)->CodePrint(out);
170       break;
171     case JS_PROXY_TYPE:
172       JSProxy::cast(this)->JSProxyPrint(out);
173       break;
174     case JS_FUNCTION_PROXY_TYPE:
175       JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out);
176       break;
177     case JS_SET_TYPE:
178       JSSet::cast(this)->JSSetPrint(out);
179       break;
180     case JS_MAP_TYPE:
181       JSMap::cast(this)->JSMapPrint(out);
182       break;
183     case JS_WEAK_MAP_TYPE:
184       JSWeakMap::cast(this)->JSWeakMapPrint(out);
185       break;
186     case JS_WEAK_SET_TYPE:
187       JSWeakSet::cast(this)->JSWeakSetPrint(out);
188       break;
189     case FOREIGN_TYPE:
190       Foreign::cast(this)->ForeignPrint(out);
191       break;
192     case SHARED_FUNCTION_INFO_TYPE:
193       SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out);
194       break;
195     case JS_MESSAGE_OBJECT_TYPE:
196       JSMessageObject::cast(this)->JSMessageObjectPrint(out);
197       break;
198     case CELL_TYPE:
199       Cell::cast(this)->CellPrint(out);
200       break;
201     case PROPERTY_CELL_TYPE:
202       PropertyCell::cast(this)->PropertyCellPrint(out);
203       break;
204     case JS_ARRAY_BUFFER_TYPE:
205       JSArrayBuffer::cast(this)->JSArrayBufferPrint(out);
206       break;
207     case JS_TYPED_ARRAY_TYPE:
208       JSTypedArray::cast(this)->JSTypedArrayPrint(out);
209       break;
210     case JS_DATA_VIEW_TYPE:
211       JSDataView::cast(this)->JSDataViewPrint(out);
212       break;
213 #define MAKE_STRUCT_CASE(NAME, Name, name) \
214   case NAME##_TYPE:                        \
215     Name::cast(this)->Name##Print(out);    \
216     break;
217   STRUCT_LIST(MAKE_STRUCT_CASE)
218 #undef MAKE_STRUCT_CASE
219
220     default:
221       PrintF(out, "UNKNOWN TYPE %d", map()->instance_type());
222       UNREACHABLE();
223       break;
224   }
225 }
226
227
228 void ByteArray::ByteArrayPrint(FILE* out) {
229   PrintF(out, "byte array, data starts at %p", GetDataStartAddress());
230 }
231
232
233 void FreeSpace::FreeSpacePrint(FILE* out) {
234   PrintF(out, "free space, size %d", Size());
235 }
236
237
238 #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size)                 \
239   void External##Type##Array::External##Type##ArrayPrint(FILE* out) {         \
240     PrintF(out, "external " #type " array");                                  \
241   }
242
243 TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
244
245 #undef EXTERNAL_ARRAY_PRINTER
246
247
248 template <class Traits>
249 void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) {
250   PrintF(out, "fixed %s", Traits::Designator());
251 }
252
253
254 void JSObject::PrintProperties(FILE* out) {
255   if (HasFastProperties()) {
256     DescriptorArray* descs = map()->instance_descriptors();
257     for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
258       PrintF(out, "   ");
259       descs->GetKey(i)->NamePrint(out);
260       PrintF(out, ": ");
261       switch (descs->GetType(i)) {
262         case FIELD: {
263           int index = descs->GetFieldIndex(i);
264           RawFastPropertyAt(index)->ShortPrint(out);
265           PrintF(out, " (field at offset %d)\n", index);
266           break;
267         }
268         case CONSTANT:
269           descs->GetConstant(i)->ShortPrint(out);
270           PrintF(out, " (constant)\n");
271           break;
272         case CALLBACKS:
273           descs->GetCallbacksObject(i)->ShortPrint(out);
274           PrintF(out, " (callback)\n");
275           break;
276         case NORMAL:  // only in slow mode
277         case HANDLER:  // only in lookup results, not in descriptors
278         case INTERCEPTOR:  // only in lookup results, not in descriptors
279         // There are no transitions in the descriptor array.
280         case TRANSITION:
281         case NONEXISTENT:
282           UNREACHABLE();
283           break;
284       }
285     }
286   } else {
287     property_dictionary()->Print(out);
288   }
289 }
290
291
292 template<class T>
293 static void DoPrintElements(FILE *out, Object* object) {
294   T* p = T::cast(object);
295   for (int i = 0; i < p->length(); i++) {
296     PrintF(out, "   %d: %d\n", i, p->get_scalar(i));
297   }
298 }
299
300
301 template<class T>
302 static void DoPrintDoubleElements(FILE* out, Object* object) {
303   T* p = T::cast(object);
304   for (int i = 0; i < p->length(); i++) {
305     PrintF(out, "   %d: %f\n", i, p->get_scalar(i));
306   }
307 }
308
309
310 template<class T>
311 static void DoPrintFloat32x4Elements(FILE* out, Object* object) {
312   T* p = T::cast(object);
313   for (int i = 0; i < p->length(); i++) {
314     float32x4_value_t value =  p->get_scalar(i);
315     PrintF(out, "   %d: (%f, %f, %f, %f)\n",
316            i, value.storage[0], value.storage[1],
317            value.storage[2], value.storage[3]);
318   }
319 }
320
321
322 template<class T>
323 static void DoPrintInt32x4Elements(FILE* out, Object* object) {
324   T* p = T::cast(object);
325   for (int i = 0; i < p->length(); i++) {
326     int32x4_value_t value =  p->get_scalar(i);
327     PrintF(out, "   %d: (%d, %d, %d, %d)\n",
328            i, value.storage[0], value.storage[1],
329            value.storage[2], value.storage[3]);
330   }
331 }
332
333
334 void JSObject::PrintElements(FILE* out) {
335   // Don't call GetElementsKind, its validation code can cause the printer to
336   // fail when debugging.
337   switch (map()->elements_kind()) {
338     case FAST_HOLEY_SMI_ELEMENTS:
339     case FAST_SMI_ELEMENTS:
340     case FAST_HOLEY_ELEMENTS:
341     case FAST_ELEMENTS: {
342       // Print in array notation for non-sparse arrays.
343       FixedArray* p = FixedArray::cast(elements());
344       for (int i = 0; i < p->length(); i++) {
345         PrintF(out, "   %d: ", i);
346         p->get(i)->ShortPrint(out);
347         PrintF(out, "\n");
348       }
349       break;
350     }
351     case FAST_HOLEY_DOUBLE_ELEMENTS:
352     case FAST_DOUBLE_ELEMENTS: {
353       // Print in array notation for non-sparse arrays.
354       if (elements()->length() > 0) {
355         FixedDoubleArray* p = FixedDoubleArray::cast(elements());
356         for (int i = 0; i < p->length(); i++) {
357           if (p->is_the_hole(i)) {
358             PrintF(out, "   %d: <the hole>", i);
359           } else {
360             PrintF(out, "   %d: %g", i, p->get_scalar(i));
361           }
362           PrintF(out, "\n");
363         }
364       }
365       break;
366     }
367
368
369 #define PRINT_ELEMENTS(Kind, Type)                                          \
370     case Kind: {                                                            \
371       DoPrintElements<Type>(out, elements());                               \
372       break;                                                                \
373     }
374
375 #define PRINT_DOUBLE_ELEMENTS(Kind, Type)                                   \
376     case Kind: {                                                            \
377       DoPrintDoubleElements<Type>(out, elements());                         \
378       break;                                                                \
379     }
380
381 #define PRINT_FLOAT32x4_ELEMENTS(Kind, Type)                                \
382     case Kind: {                                                            \
383       DoPrintFloat32x4Elements<Type>(out, elements());                      \
384       break;                                                                \
385     }
386
387 #define PRINT_INT32x4_ELEMENTS(Kind, Type)                                  \
388     case Kind: {                                                            \
389       DoPrintInt32x4Elements<Type>(out, elements());                        \
390       break;                                                                \
391     }
392
393     PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray)
394     PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array)
395     PRINT_ELEMENTS(EXTERNAL_UINT8_ELEMENTS,
396         ExternalUint8Array)
397     PRINT_ELEMENTS(EXTERNAL_INT16_ELEMENTS, ExternalInt16Array)
398     PRINT_ELEMENTS(EXTERNAL_UINT16_ELEMENTS,
399         ExternalUint16Array)
400     PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array)
401     PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS,
402         ExternalUint32Array)
403     PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
404     PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
405     PRINT_FLOAT32x4_ELEMENTS(EXTERNAL_FLOAT32x4_ELEMENTS,
406         ExternalFloat32x4Array)
407     PRINT_INT32x4_ELEMENTS(EXTERNAL_INT32x4_ELEMENTS, ExternalInt32x4Array)
408
409
410     PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
411     PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray)
412     PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array)
413     PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array)
414     PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array)
415     PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array)
416     PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array)
417     PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array)
418     PRINT_DOUBLE_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array)
419     PRINT_FLOAT32x4_ELEMENTS(FLOAT32x4_ELEMENTS, FixedFloat32x4Array)
420     PRINT_INT32x4_ELEMENTS(INT32x4_ELEMENTS, FixedInt32x4Array)
421
422 #undef PRINT_DOUBLE_ELEMENTS
423 #undef PRINT_ELEMENTS
424
425     case DICTIONARY_ELEMENTS:
426       elements()->Print(out);
427       break;
428     case NON_STRICT_ARGUMENTS_ELEMENTS: {
429       FixedArray* p = FixedArray::cast(elements());
430       PrintF(out, "   parameter map:");
431       for (int i = 2; i < p->length(); i++) {
432         PrintF(out, " %d:", i - 2);
433         p->get(i)->ShortPrint(out);
434       }
435       PrintF(out, "\n   context: ");
436       p->get(0)->ShortPrint(out);
437       PrintF(out, "\n   arguments: ");
438       p->get(1)->ShortPrint(out);
439       PrintF(out, "\n");
440       break;
441     }
442   }
443 }
444
445
446 void JSObject::PrintTransitions(FILE* out) {
447   if (!map()->HasTransitionArray()) return;
448   TransitionArray* transitions = map()->transitions();
449   for (int i = 0; i < transitions->number_of_transitions(); i++) {
450     PrintF(out, "   ");
451     transitions->GetKey(i)->NamePrint(out);
452     PrintF(out, ": ");
453     switch (transitions->GetTargetDetails(i).type()) {
454       case FIELD: {
455         PrintF(out, " (transition to field)\n");
456         break;
457       }
458       case CONSTANT:
459         PrintF(out, " (transition to constant)\n");
460         break;
461       case CALLBACKS:
462         PrintF(out, " (transition to callback)\n");
463         break;
464       // Values below are never in the target descriptor array.
465       case NORMAL:
466       case HANDLER:
467       case INTERCEPTOR:
468       case TRANSITION:
469       case NONEXISTENT:
470         UNREACHABLE();
471         break;
472     }
473   }
474 }
475
476
477 void JSObject::JSObjectPrint(FILE* out) {
478   PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this));
479   PrintF(out, " - map = %p [", reinterpret_cast<void*>(map()));
480   // Don't call GetElementsKind, its validation code can cause the printer to
481   // fail when debugging.
482   PrintElementsKind(out, this->map()->elements_kind());
483   PrintF(out,
484          "]\n - prototype = %p\n",
485          reinterpret_cast<void*>(GetPrototype()));
486   PrintF(out, " {\n");
487   PrintProperties(out);
488   PrintTransitions(out);
489   PrintElements(out);
490   PrintF(out, " }\n");
491 }
492
493
494 void JSModule::JSModulePrint(FILE* out) {
495   HeapObject::PrintHeader(out, "JSModule");
496   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
497   PrintF(out, " - context = ");
498   context()->Print(out);
499   PrintF(out, " - scope_info = ");
500   scope_info()->ShortPrint(out);
501   PrintElementsKind(out, this->map()->elements_kind());
502   PrintF(out, " {\n");
503   PrintProperties(out);
504   PrintElements(out);
505   PrintF(out, " }\n");
506 }
507
508
509 static const char* TypeToString(InstanceType type) {
510   switch (type) {
511 #define TYPE_TO_STRING(TYPE) case TYPE: return #TYPE;
512   INSTANCE_TYPE_LIST(TYPE_TO_STRING)
513 #undef TYPE_TO_STRING
514   }
515   UNREACHABLE();
516   return "UNKNOWN";  // Keep the compiler happy.
517 }
518
519
520 void Symbol::SymbolPrint(FILE* out) {
521   HeapObject::PrintHeader(out, "Symbol");
522   PrintF(out, " - hash: %d\n", Hash());
523   PrintF(out, " - name: ");
524   name()->ShortPrint();
525   PrintF(out, " - private: %d\n", is_private());
526   PrintF(out, "\n");
527 }
528
529
530 void Map::MapPrint(FILE* out) {
531   HeapObject::PrintHeader(out, "Map");
532   PrintF(out, " - type: %s\n", TypeToString(instance_type()));
533   PrintF(out, " - instance size: %d\n", instance_size());
534   PrintF(out, " - inobject properties: %d\n", inobject_properties());
535   PrintF(out, " - elements kind: ");
536   PrintElementsKind(out, elements_kind());
537   PrintF(out, "\n - pre-allocated property fields: %d\n",
538       pre_allocated_property_fields());
539   PrintF(out, " - unused property fields: %d\n", unused_property_fields());
540   if (is_hidden_prototype()) {
541     PrintF(out, " - hidden_prototype\n");
542   }
543   if (has_named_interceptor()) {
544     PrintF(out, " - named_interceptor\n");
545   }
546   if (has_indexed_interceptor()) {
547     PrintF(out, " - indexed_interceptor\n");
548   }
549   if (is_undetectable()) {
550     PrintF(out, " - undetectable\n");
551   }
552   if (has_instance_call_handler()) {
553     PrintF(out, " - instance_call_handler\n");
554   }
555   if (is_access_check_needed()) {
556     PrintF(out, " - access_check_needed\n");
557   }
558   if (is_frozen()) {
559     PrintF(out, " - frozen\n");
560   } else if (!is_extensible()) {
561     PrintF(out, " - sealed\n");
562   }
563   PrintF(out, " - back pointer: ");
564   GetBackPointer()->ShortPrint(out);
565   PrintF(out, "\n - instance descriptors %s#%i: ",
566          owns_descriptors() ? "(own) " : "",
567          NumberOfOwnDescriptors());
568   instance_descriptors()->ShortPrint(out);
569   if (HasTransitionArray()) {
570     PrintF(out, "\n - transitions: ");
571     transitions()->ShortPrint(out);
572   }
573   PrintF(out, "\n - prototype: ");
574   prototype()->ShortPrint(out);
575   PrintF(out, "\n - constructor: ");
576   constructor()->ShortPrint(out);
577   PrintF(out, "\n - code cache: ");
578   code_cache()->ShortPrint(out);
579   PrintF(out, "\n - dependent code: ");
580   dependent_code()->ShortPrint(out);
581   PrintF(out, "\n");
582 }
583
584
585 void CodeCache::CodeCachePrint(FILE* out) {
586   HeapObject::PrintHeader(out, "CodeCache");
587   PrintF(out, "\n - default_cache: ");
588   default_cache()->ShortPrint(out);
589   PrintF(out, "\n - normal_type_cache: ");
590   normal_type_cache()->ShortPrint(out);
591 }
592
593
594 void PolymorphicCodeCache::PolymorphicCodeCachePrint(FILE* out) {
595   HeapObject::PrintHeader(out, "PolymorphicCodeCache");
596   PrintF(out, "\n - cache: ");
597   cache()->ShortPrint(out);
598 }
599
600
601 void TypeFeedbackInfo::TypeFeedbackInfoPrint(FILE* out) {
602   HeapObject::PrintHeader(out, "TypeFeedbackInfo");
603   PrintF(out, " - ic_total_count: %d, ic_with_type_info_count: %d\n",
604          ic_total_count(), ic_with_type_info_count());
605   PrintF(out, " - type_feedback_cells: ");
606   type_feedback_cells()->FixedArrayPrint(out);
607 }
608
609
610 void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(FILE* out) {
611   HeapObject::PrintHeader(out, "AliasedArgumentsEntry");
612   PrintF(out, "\n - aliased_context_slot: %d", aliased_context_slot());
613 }
614
615
616 void FixedArray::FixedArrayPrint(FILE* out) {
617   HeapObject::PrintHeader(out, "FixedArray");
618   PrintF(out, " - length: %d", length());
619   for (int i = 0; i < length(); i++) {
620     PrintF(out, "\n  [%d]: ", i);
621     get(i)->ShortPrint(out);
622   }
623   PrintF(out, "\n");
624 }
625
626
627 void FixedDoubleArray::FixedDoubleArrayPrint(FILE* out) {
628   HeapObject::PrintHeader(out, "FixedDoubleArray");
629   PrintF(out, " - length: %d", length());
630   for (int i = 0; i < length(); i++) {
631     if (is_the_hole(i)) {
632       PrintF(out, "\n  [%d]: <the hole>", i);
633     } else {
634       PrintF(out, "\n  [%d]: %g", i, get_scalar(i));
635     }
636   }
637   PrintF(out, "\n");
638 }
639
640
641 void ConstantPoolArray::ConstantPoolArrayPrint(FILE* out) {
642   HeapObject::PrintHeader(out, "ConstantPoolArray");
643   PrintF(out, " - length: %d", length());
644   for (int i = 0; i < length(); i++) {
645     if (i < first_ptr_index()) {
646       PrintF(out, "\n  [%d]: double: %g", i, get_int64_entry_as_double(i));
647     } else if (i < first_int32_index()) {
648       PrintF(out, "\n  [%d]: pointer: %p", i,
649              reinterpret_cast<void*>(get_ptr_entry(i)));
650     } else {
651       PrintF(out, "\n  [%d]: int32: %d", i, get_int32_entry(i));
652     }
653   }
654   PrintF(out, "\n");
655 }
656
657
658 void JSValue::JSValuePrint(FILE* out) {
659   HeapObject::PrintHeader(out, "ValueObject");
660   value()->Print(out);
661 }
662
663
664 void JSMessageObject::JSMessageObjectPrint(FILE* out) {
665   HeapObject::PrintHeader(out, "JSMessageObject");
666   PrintF(out, " - type: ");
667   type()->ShortPrint(out);
668   PrintF(out, "\n - arguments: ");
669   arguments()->ShortPrint(out);
670   PrintF(out, "\n - start_position: %d", start_position());
671   PrintF(out, "\n - end_position: %d", end_position());
672   PrintF(out, "\n - script: ");
673   script()->ShortPrint(out);
674   PrintF(out, "\n - stack_trace: ");
675   stack_trace()->ShortPrint(out);
676   PrintF(out, "\n - stack_frames: ");
677   stack_frames()->ShortPrint(out);
678   PrintF(out, "\n");
679 }
680
681
682 void String::StringPrint(FILE* out) {
683   if (StringShape(this).IsInternalized()) {
684     PrintF(out, "#");
685   } else if (StringShape(this).IsCons()) {
686     PrintF(out, "c\"");
687   } else {
688     PrintF(out, "\"");
689   }
690
691   const char truncated_epilogue[] = "...<truncated>";
692   int len = length();
693   if (!FLAG_use_verbose_printer) {
694     if (len > 100) {
695       len = 100 - sizeof(truncated_epilogue);
696     }
697   }
698   for (int i = 0; i < len; i++) {
699     PrintF(out, "%c", Get(i));
700   }
701   if (len != length()) {
702     PrintF(out, "%s", truncated_epilogue);
703   }
704
705   if (!StringShape(this).IsInternalized()) PrintF(out, "\"");
706 }
707
708
709 void Name::NamePrint(FILE* out) {
710   if (IsString())
711     String::cast(this)->StringPrint(out);
712   else
713     ShortPrint();
714 }
715
716
717 // This method is only meant to be called from gdb for debugging purposes.
718 // Since the string can also be in two-byte encoding, non-ASCII characters
719 // will be ignored in the output.
720 char* String::ToAsciiArray() {
721   // Static so that subsequent calls frees previously allocated space.
722   // This also means that previous results will be overwritten.
723   static char* buffer = NULL;
724   if (buffer != NULL) free(buffer);
725   buffer = new char[length()+1];
726   WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
727   buffer[length()] = 0;
728   return buffer;
729 }
730
731
732 static const char* const weekdays[] = {
733   "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
734 };
735
736
737 void JSDate::JSDatePrint(FILE* out) {
738   HeapObject::PrintHeader(out, "JSDate");
739   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
740   PrintF(out, " - value = ");
741   value()->Print(out);
742   if (!year()->IsSmi()) {
743     PrintF(out, " - time = NaN\n");
744   } else {
745     PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
746            weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
747            year()->IsSmi() ? Smi::cast(year())->value() : -1,
748            month()->IsSmi() ? Smi::cast(month())->value() : -1,
749            day()->IsSmi() ? Smi::cast(day())->value() : -1,
750            hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
751            min()->IsSmi() ? Smi::cast(min())->value() : -1,
752            sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
753   }
754 }
755
756
757 void JSProxy::JSProxyPrint(FILE* out) {
758   HeapObject::PrintHeader(out, "JSProxy");
759   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
760   PrintF(out, " - handler = ");
761   handler()->Print(out);
762   PrintF(out, " - hash = ");
763   hash()->Print(out);
764   PrintF(out, "\n");
765 }
766
767
768 void JSFunctionProxy::JSFunctionProxyPrint(FILE* out) {
769   HeapObject::PrintHeader(out, "JSFunctionProxy");
770   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
771   PrintF(out, " - handler = ");
772   handler()->Print(out);
773   PrintF(out, " - call_trap = ");
774   call_trap()->Print(out);
775   PrintF(out, " - construct_trap = ");
776   construct_trap()->Print(out);
777   PrintF(out, "\n");
778 }
779
780
781 void JSSet::JSSetPrint(FILE* out) {
782   HeapObject::PrintHeader(out, "JSSet");
783   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
784   PrintF(out, " - table = ");
785   table()->ShortPrint(out);
786   PrintF(out, "\n");
787 }
788
789
790 void JSMap::JSMapPrint(FILE* out) {
791   HeapObject::PrintHeader(out, "JSMap");
792   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
793   PrintF(out, " - table = ");
794   table()->ShortPrint(out);
795   PrintF(out, "\n");
796 }
797
798
799 void JSWeakMap::JSWeakMapPrint(FILE* out) {
800   HeapObject::PrintHeader(out, "JSWeakMap");
801   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
802   PrintF(out, " - table = ");
803   table()->ShortPrint(out);
804   PrintF(out, "\n");
805 }
806
807
808 void JSWeakSet::JSWeakSetPrint(FILE* out) {
809   HeapObject::PrintHeader(out, "JSWeakSet");
810   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
811   PrintF(out, " - table = ");
812   table()->ShortPrint(out);
813   PrintF(out, "\n");
814 }
815
816
817 void JSArrayBuffer::JSArrayBufferPrint(FILE* out) {
818   HeapObject::PrintHeader(out, "JSArrayBuffer");
819   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
820   PrintF(out, " - backing_store = %p\n", backing_store());
821   PrintF(out, " - byte_length = ");
822   byte_length()->ShortPrint(out);
823   PrintF(out, "\n");
824 }
825
826
827 void JSTypedArray::JSTypedArrayPrint(FILE* out) {
828   HeapObject::PrintHeader(out, "JSTypedArray");
829   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
830   PrintF(out, " - buffer =");
831   buffer()->ShortPrint(out);
832   PrintF(out, "\n - byte_offset = ");
833   byte_offset()->ShortPrint(out);
834   PrintF(out, "\n - byte_length = ");
835   byte_length()->ShortPrint(out);
836   PrintF(out, "\n - length = ");
837   length()->ShortPrint(out);
838   PrintF(out, "\n");
839   PrintElements(out);
840 }
841
842
843 void JSDataView::JSDataViewPrint(FILE* out) {
844   HeapObject::PrintHeader(out, "JSDataView");
845   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
846   PrintF(out, " - buffer =");
847   buffer()->ShortPrint(out);
848   PrintF(out, "\n - byte_offset = ");
849   byte_offset()->ShortPrint(out);
850   PrintF(out, "\n - byte_length = ");
851   byte_length()->ShortPrint(out);
852   PrintF(out, "\n");
853 }
854
855
856 void JSFunction::JSFunctionPrint(FILE* out) {
857   HeapObject::PrintHeader(out, "Function");
858   PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
859   PrintF(out, " - initial_map = ");
860   if (has_initial_map()) {
861     initial_map()->ShortPrint(out);
862   }
863   PrintF(out, "\n - shared_info = ");
864   shared()->ShortPrint(out);
865   PrintF(out, "\n   - name = ");
866   shared()->name()->Print(out);
867   PrintF(out, "\n - context = ");
868   context()->ShortPrint(out);
869   if (shared()->bound()) {
870     PrintF(out, "\n - bindings = ");
871     function_bindings()->ShortPrint(out);
872   } else {
873     PrintF(out, "\n - literals = ");
874     literals()->ShortPrint(out);
875   }
876   PrintF(out, "\n - code = ");
877   code()->ShortPrint(out);
878   PrintF(out, "\n");
879
880   PrintProperties(out);
881   PrintElements(out);
882
883   PrintF(out, "\n");
884 }
885
886
887 void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) {
888   HeapObject::PrintHeader(out, "SharedFunctionInfo");
889   PrintF(out, " - name: ");
890   name()->ShortPrint(out);
891   PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties());
892   PrintF(out, "\n - instance class name = ");
893   instance_class_name()->Print(out);
894   PrintF(out, "\n - code = ");
895   code()->ShortPrint(out);
896   if (HasSourceCode()) {
897     PrintF(out, "\n - source code = ");
898     String* source = String::cast(Script::cast(script())->source());
899     int start = start_position();
900     int length = end_position() - start;
901     SmartArrayPointer<char> source_string =
902         source->ToCString(DISALLOW_NULLS,
903                           FAST_STRING_TRAVERSAL,
904                           start, length, NULL);
905     PrintF(out, "%s", source_string.get());
906   }
907   // Script files are often large, hard to read.
908   // PrintF(out, "\n - script =");
909   // script()->Print(out);
910   PrintF(out, "\n - function token position = %d", function_token_position());
911   PrintF(out, "\n - start position = %d", start_position());
912   PrintF(out, "\n - end position = %d", end_position());
913   PrintF(out, "\n - is expression = %d", is_expression());
914   PrintF(out, "\n - debug info = ");
915   debug_info()->ShortPrint(out);
916   PrintF(out, "\n - length = %d", length());
917   PrintF(out, "\n - optimized_code_map = ");
918   optimized_code_map()->ShortPrint(out);
919   PrintF(out, "\n");
920 }
921
922
923 void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) {
924   PrintF(out, "global_proxy ");
925   JSObjectPrint(out);
926   PrintF(out, "native context : ");
927   native_context()->ShortPrint(out);
928   PrintF(out, "\n");
929 }
930
931
932 void JSGlobalObject::JSGlobalObjectPrint(FILE* out) {
933   PrintF(out, "global ");
934   JSObjectPrint(out);
935   PrintF(out, "native context : ");
936   native_context()->ShortPrint(out);
937   PrintF(out, "\n");
938 }
939
940
941 void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) {
942   PrintF(out, "builtins ");
943   JSObjectPrint(out);
944 }
945
946
947 void Cell::CellPrint(FILE* out) {
948   HeapObject::PrintHeader(out, "Cell");
949 }
950
951
952 void PropertyCell::PropertyCellPrint(FILE* out) {
953   HeapObject::PrintHeader(out, "PropertyCell");
954 }
955
956
957 void Code::CodePrint(FILE* out) {
958   HeapObject::PrintHeader(out, "Code");
959 #ifdef ENABLE_DISASSEMBLER
960   if (FLAG_use_verbose_printer) {
961     Disassemble(NULL, out);
962   }
963 #endif
964 }
965
966
967 void Foreign::ForeignPrint(FILE* out) {
968   PrintF(out, "foreign address : %p", foreign_address());
969 }
970
971
972 void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(FILE* out) {
973   HeapObject::PrintHeader(out, "ExecutableAccessorInfo");
974   PrintF(out, "\n - name: ");
975   name()->ShortPrint(out);
976   PrintF(out, "\n - flag: ");
977   flag()->ShortPrint(out);
978   PrintF(out, "\n - getter: ");
979   getter()->ShortPrint(out);
980   PrintF(out, "\n - setter: ");
981   setter()->ShortPrint(out);
982   PrintF(out, "\n - data: ");
983   data()->ShortPrint(out);
984 }
985
986
987 void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(FILE* out) {
988   HeapObject::PrintHeader(out, "DeclaredAccessorInfo");
989   PrintF(out, "\n - name: ");
990   name()->ShortPrint(out);
991   PrintF(out, "\n - flag: ");
992   flag()->ShortPrint(out);
993   PrintF(out, "\n - descriptor: ");
994   descriptor()->ShortPrint(out);
995 }
996
997
998 void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(FILE* out) {
999   HeapObject::PrintHeader(out, "DeclaredAccessorDescriptor");
1000   PrintF(out, "\n - internal field: ");
1001   serialized_data()->ShortPrint(out);
1002 }
1003
1004
1005 void Box::BoxPrint(FILE* out) {
1006   HeapObject::PrintHeader(out, "Box");
1007   PrintF(out, "\n - value: ");
1008   value()->ShortPrint(out);
1009 }
1010
1011
1012 void AccessorPair::AccessorPairPrint(FILE* out) {
1013   HeapObject::PrintHeader(out, "AccessorPair");
1014   PrintF(out, "\n - getter: ");
1015   getter()->ShortPrint(out);
1016   PrintF(out, "\n - setter: ");
1017   setter()->ShortPrint(out);
1018   PrintF(out, "\n - flag: ");
1019   access_flags()->ShortPrint(out);
1020 }
1021
1022
1023 void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) {
1024   HeapObject::PrintHeader(out, "AccessCheckInfo");
1025   PrintF(out, "\n - named_callback: ");
1026   named_callback()->ShortPrint(out);
1027   PrintF(out, "\n - indexed_callback: ");
1028   indexed_callback()->ShortPrint(out);
1029   PrintF(out, "\n - data: ");
1030   data()->ShortPrint(out);
1031 }
1032
1033
1034 void InterceptorInfo::InterceptorInfoPrint(FILE* out) {
1035   HeapObject::PrintHeader(out, "InterceptorInfo");
1036   PrintF(out, "\n - getter: ");
1037   getter()->ShortPrint(out);
1038   PrintF(out, "\n - setter: ");
1039   setter()->ShortPrint(out);
1040   PrintF(out, "\n - query: ");
1041   query()->ShortPrint(out);
1042   PrintF(out, "\n - deleter: ");
1043   deleter()->ShortPrint(out);
1044   PrintF(out, "\n - enumerator: ");
1045   enumerator()->ShortPrint(out);
1046   PrintF(out, "\n - data: ");
1047   data()->ShortPrint(out);
1048 }
1049
1050
1051 void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) {
1052   HeapObject::PrintHeader(out, "CallHandlerInfo");
1053   PrintF(out, "\n - callback: ");
1054   callback()->ShortPrint(out);
1055   PrintF(out, "\n - data: ");
1056   data()->ShortPrint(out);
1057   PrintF(out, "\n - call_stub_cache: ");
1058 }
1059
1060
1061 void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) {
1062   HeapObject::PrintHeader(out, "FunctionTemplateInfo");
1063   PrintF(out, "\n - class name: ");
1064   class_name()->ShortPrint(out);
1065   PrintF(out, "\n - tag: ");
1066   tag()->ShortPrint(out);
1067   PrintF(out, "\n - property_list: ");
1068   property_list()->ShortPrint(out);
1069   PrintF(out, "\n - serial_number: ");
1070   serial_number()->ShortPrint(out);
1071   PrintF(out, "\n - call_code: ");
1072   call_code()->ShortPrint(out);
1073   PrintF(out, "\n - property_accessors: ");
1074   property_accessors()->ShortPrint(out);
1075   PrintF(out, "\n - prototype_template: ");
1076   prototype_template()->ShortPrint(out);
1077   PrintF(out, "\n - parent_template: ");
1078   parent_template()->ShortPrint(out);
1079   PrintF(out, "\n - named_property_handler: ");
1080   named_property_handler()->ShortPrint(out);
1081   PrintF(out, "\n - indexed_property_handler: ");
1082   indexed_property_handler()->ShortPrint(out);
1083   PrintF(out, "\n - instance_template: ");
1084   instance_template()->ShortPrint(out);
1085   PrintF(out, "\n - signature: ");
1086   signature()->ShortPrint(out);
1087   PrintF(out, "\n - access_check_info: ");
1088   access_check_info()->ShortPrint(out);
1089   PrintF(out, "\n - hidden_prototype: %s",
1090          hidden_prototype() ? "true" : "false");
1091   PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false");
1092   PrintF(out, "\n - need_access_check: %s",
1093          needs_access_check() ? "true" : "false");
1094 }
1095
1096
1097 void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) {
1098   HeapObject::PrintHeader(out, "ObjectTemplateInfo");
1099   PrintF(out, " - tag: ");
1100   tag()->ShortPrint(out);
1101   PrintF(out, "\n - property_list: ");
1102   property_list()->ShortPrint(out);
1103   PrintF(out, "\n - property_accessors: ");
1104   property_accessors()->ShortPrint(out);
1105   PrintF(out, "\n - constructor: ");
1106   constructor()->ShortPrint(out);
1107   PrintF(out, "\n - internal_field_count: ");
1108   internal_field_count()->ShortPrint(out);
1109   PrintF(out, "\n");
1110 }
1111
1112
1113 void SignatureInfo::SignatureInfoPrint(FILE* out) {
1114   HeapObject::PrintHeader(out, "SignatureInfo");
1115   PrintF(out, "\n - receiver: ");
1116   receiver()->ShortPrint(out);
1117   PrintF(out, "\n - args: ");
1118   args()->ShortPrint(out);
1119 }
1120
1121
1122 void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) {
1123   HeapObject::PrintHeader(out, "TypeSwitchInfo");
1124   PrintF(out, "\n - types: ");
1125   types()->ShortPrint(out);
1126 }
1127
1128
1129 void AllocationSite::AllocationSitePrint(FILE* out) {
1130   HeapObject::PrintHeader(out, "AllocationSite");
1131   PrintF(out, " - weak_next: ");
1132   weak_next()->ShortPrint(out);
1133   PrintF(out, "\n - dependent code: ");
1134   dependent_code()->ShortPrint(out);
1135   PrintF(out, "\n - nested site: ");
1136   nested_site()->ShortPrint(out);
1137   PrintF(out, "\n - memento found count: ");
1138   Smi::FromInt(memento_found_count())->ShortPrint(out);
1139   PrintF(out, "\n - memento create count: ");
1140   Smi::FromInt(memento_create_count())->ShortPrint(out);
1141   PrintF(out, "\n - pretenure decision: ");
1142   Smi::FromInt(pretenure_decision())->ShortPrint(out);
1143   PrintF(out, "\n - transition_info: ");
1144   if (transition_info()->IsSmi()) {
1145     ElementsKind kind = GetElementsKind();
1146     PrintF(out, "Array allocation with ElementsKind ");
1147     PrintElementsKind(out, kind);
1148     PrintF(out, "\n");
1149     return;
1150   } else if (transition_info()->IsJSArray()) {
1151     PrintF(out, "Array literal ");
1152     transition_info()->ShortPrint(out);
1153     PrintF(out, "\n");
1154     return;
1155   }
1156
1157   PrintF(out, "unknown transition_info");
1158   transition_info()->ShortPrint(out);
1159   PrintF(out, "\n");
1160 }
1161
1162
1163 void AllocationMemento::AllocationMementoPrint(FILE* out) {
1164   HeapObject::PrintHeader(out, "AllocationMemento");
1165   PrintF(out, " - allocation site: ");
1166   if (IsValid()) {
1167     GetAllocationSite()->Print();
1168   } else {
1169     PrintF(out, "<invalid>\n");
1170   }
1171 }
1172
1173
1174 void Script::ScriptPrint(FILE* out) {
1175   HeapObject::PrintHeader(out, "Script");
1176   PrintF(out, "\n - source: ");
1177   source()->ShortPrint(out);
1178   PrintF(out, "\n - name: ");
1179   name()->ShortPrint(out);
1180   PrintF(out, "\n - line_offset: ");
1181   line_offset()->ShortPrint(out);
1182   PrintF(out, "\n - column_offset: ");
1183   column_offset()->ShortPrint(out);
1184   PrintF(out, "\n - type: ");
1185   type()->ShortPrint(out);
1186   PrintF(out, "\n - id: ");
1187   id()->ShortPrint(out);
1188   PrintF(out, "\n - data: ");
1189   data()->ShortPrint(out);
1190   PrintF(out, "\n - context data: ");
1191   context_data()->ShortPrint(out);
1192   PrintF(out, "\n - wrapper: ");
1193   wrapper()->ShortPrint(out);
1194   PrintF(out, "\n - compilation type: %d", compilation_type());
1195   PrintF(out, "\n - line ends: ");
1196   line_ends()->ShortPrint(out);
1197   PrintF(out, "\n - eval from shared: ");
1198   eval_from_shared()->ShortPrint(out);
1199   PrintF(out, "\n - eval from instructions offset: ");
1200   eval_from_instructions_offset()->ShortPrint(out);
1201   PrintF(out, "\n");
1202 }
1203
1204
1205 #ifdef ENABLE_DEBUGGER_SUPPORT
1206 void DebugInfo::DebugInfoPrint(FILE* out) {
1207   HeapObject::PrintHeader(out, "DebugInfo");
1208   PrintF(out, "\n - shared: ");
1209   shared()->ShortPrint(out);
1210   PrintF(out, "\n - original_code: ");
1211   original_code()->ShortPrint(out);
1212   PrintF(out, "\n - code: ");
1213   code()->ShortPrint(out);
1214   PrintF(out, "\n - break_points: ");
1215   break_points()->Print(out);
1216 }
1217
1218
1219 void BreakPointInfo::BreakPointInfoPrint(FILE* out) {
1220   HeapObject::PrintHeader(out, "BreakPointInfo");
1221   PrintF(out, "\n - code_position: %d", code_position()->value());
1222   PrintF(out, "\n - source_position: %d", source_position()->value());
1223   PrintF(out, "\n - statement_position: %d", statement_position()->value());
1224   PrintF(out, "\n - break_point_objects: ");
1225   break_point_objects()->ShortPrint(out);
1226 }
1227 #endif  // ENABLE_DEBUGGER_SUPPORT
1228
1229
1230 void DescriptorArray::PrintDescriptors(FILE* out) {
1231   PrintF(out, "Descriptor array  %d\n", number_of_descriptors());
1232   for (int i = 0; i < number_of_descriptors(); i++) {
1233     PrintF(out, " %d: ", i);
1234     Descriptor desc;
1235     Get(i, &desc);
1236     desc.Print(out);
1237   }
1238   PrintF(out, "\n");
1239 }
1240
1241
1242 void TransitionArray::PrintTransitions(FILE* out) {
1243   PrintF(out, "Transition array  %d\n", number_of_transitions());
1244   for (int i = 0; i < number_of_transitions(); i++) {
1245     PrintF(out, " %d: ", i);
1246     GetKey(i)->NamePrint(out);
1247     PrintF(out, ": ");
1248     switch (GetTargetDetails(i).type()) {
1249       case FIELD: {
1250         PrintF(out, " (transition to field)\n");
1251         break;
1252       }
1253       case CONSTANT:
1254         PrintF(out, " (transition to constant)\n");
1255         break;
1256       case CALLBACKS:
1257         PrintF(out, " (transition to callback)\n");
1258         break;
1259       // Values below are never in the target descriptor array.
1260       case NORMAL:
1261       case HANDLER:
1262       case INTERCEPTOR:
1263       case TRANSITION:
1264       case NONEXISTENT:
1265         UNREACHABLE();
1266         break;
1267     }
1268   }
1269   PrintF(out, "\n");
1270 }
1271
1272
1273 #endif  // OBJECT_PRINT
1274
1275
1276 } }  // namespace v8::internal