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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 break; 100 break;
101 case FIXED_ARRAY_TYPE: 101 case FIXED_ARRAY_TYPE:
102 FixedArray::cast(this)->FixedArrayPrint(out); 102 FixedArray::cast(this)->FixedArrayPrint(out);
103 break; 103 break;
104 case BYTE_ARRAY_TYPE: 104 case BYTE_ARRAY_TYPE:
105 ByteArray::cast(this)->ByteArrayPrint(out); 105 ByteArray::cast(this)->ByteArrayPrint(out);
106 break; 106 break;
107 case FREE_SPACE_TYPE: 107 case FREE_SPACE_TYPE:
108 FreeSpace::cast(this)->FreeSpacePrint(out); 108 FreeSpace::cast(this)->FreeSpacePrint(out);
109 break; 109 break;
110 case EXTERNAL_PIXEL_ARRAY_TYPE: 110
111 ExternalPixelArray::cast(this)->ExternalPixelArrayPrint(out); 111 #define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
112 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
113 External##Type##Array::cast(this)->External##Type##ArrayPrint(out); \
112 break; 114 break;
113 case EXTERNAL_BYTE_ARRAY_TYPE: 115
114 ExternalByteArray::cast(this)->ExternalByteArrayPrint(out); 116 TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY)
115 break; 117 #undef PRINT_EXTERNAL_ARRAY
116 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 118
117 ExternalUnsignedByteArray::cast(this) 119 #define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
118 ->ExternalUnsignedByteArrayPrint(out);
119 break;
120 case EXTERNAL_SHORT_ARRAY_TYPE:
121 ExternalShortArray::cast(this)->ExternalShortArrayPrint(out);
122 break;
123 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
124 ExternalUnsignedShortArray::cast(this)
125 ->ExternalUnsignedShortArrayPrint(out);
126 break;
127 case EXTERNAL_INT_ARRAY_TYPE:
128 ExternalIntArray::cast(this)->ExternalIntArrayPrint(out);
129 break;
130 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
131 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out);
132 break;
133 case EXTERNAL_FLOAT_ARRAY_TYPE:
134 ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out);
135 break;
136 case EXTERNAL_DOUBLE_ARRAY_TYPE:
137 ExternalDoubleArray::cast(this)->ExternalDoubleArrayPrint(out);
138 break;
139 #define PRINT_FIXED_TYPED_ARRAY(Type) \
140 case Fixed##Type##Array::kInstanceType: \ 120 case Fixed##Type##Array::kInstanceType: \
141 Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \ 121 Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \
142 break; 122 break;
143 123
144 PRINT_FIXED_TYPED_ARRAY(Uint8) 124 TYPED_ARRAYS(PRINT_FIXED_TYPED_ARRAY)
145 PRINT_FIXED_TYPED_ARRAY(Int8) 125 #undef PRINT_FIXED_TYPED_ARRAY
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 126
157 case FILLER_TYPE: 127 case FILLER_TYPE:
158 PrintF(out, "filler"); 128 PrintF(out, "filler");
159 break; 129 break;
160 case JS_OBJECT_TYPE: // fall through 130 case JS_OBJECT_TYPE: // fall through
161 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 131 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
162 case JS_ARRAY_TYPE: 132 case JS_ARRAY_TYPE:
163 case JS_GENERATOR_OBJECT_TYPE: 133 case JS_GENERATOR_OBJECT_TYPE:
164 case JS_REGEXP_TYPE: 134 case JS_REGEXP_TYPE:
165 JSObject::cast(this)->JSObjectPrint(out); 135 JSObject::cast(this)->JSObjectPrint(out);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void ByteArray::ByteArrayPrint(FILE* out) { 222 void ByteArray::ByteArrayPrint(FILE* out) {
253 PrintF(out, "byte array, data starts at %p", GetDataStartAddress()); 223 PrintF(out, "byte array, data starts at %p", GetDataStartAddress());
254 } 224 }
255 225
256 226
257 void FreeSpace::FreeSpacePrint(FILE* out) { 227 void FreeSpace::FreeSpacePrint(FILE* out) {
258 PrintF(out, "free space, size %d", Size()); 228 PrintF(out, "free space, size %d", Size());
259 } 229 }
260 230
261 231
262 void ExternalPixelArray::ExternalPixelArrayPrint(FILE* out) { 232 #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
263 PrintF(out, "external pixel array"); 233 void External##Type##Array::External##Type##ArrayPrint(FILE* out) { \
264 } 234 PrintF(out, "external " #type " array"); \
235 }
265 236
237 TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
266 238
267 void ExternalByteArray::ExternalByteArrayPrint(FILE* out) { 239 #undef EXTERNAL_ARRAY_PRINTER
268 PrintF(out, "external byte array");
269 }
270 240
271 241
272 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) {
273 PrintF(out, "external unsigned byte array");
274 }
275
276
277 void ExternalShortArray::ExternalShortArrayPrint(FILE* out) {
278 PrintF(out, "external short array");
279 }
280
281
282 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) {
283 PrintF(out, "external unsigned short array");
284 }
285
286
287 void ExternalIntArray::ExternalIntArrayPrint(FILE* out) {
288 PrintF(out, "external int array");
289 }
290
291
292 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) {
293 PrintF(out, "external unsigned int array");
294 }
295
296
297 void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) {
298 PrintF(out, "external float array");
299 }
300
301
302 void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) {
303 PrintF(out, "external double array");
304 }
305
306 template <class Traits> 242 template <class Traits>
307 void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) { 243 void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) {
308 PrintF(out, "fixed %s", Traits::Designator()); 244 PrintF(out, "fixed %s", Traits::Designator());
309 } 245 }
310 246
311 247
312 void JSObject::PrintProperties(FILE* out) { 248 void JSObject::PrintProperties(FILE* out) {
313 if (HasFastProperties()) { 249 if (HasFastProperties()) {
314 DescriptorArray* descs = map()->instance_descriptors(); 250 DescriptorArray* descs = map()->instance_descriptors();
315 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { 251 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 DoPrintElements<Type>(out, elements()); \ 341 DoPrintElements<Type>(out, elements()); \
406 break; \ 342 break; \
407 } 343 }
408 344
409 #define PRINT_DOUBLE_ELEMENTS(Kind, Type) \ 345 #define PRINT_DOUBLE_ELEMENTS(Kind, Type) \
410 case Kind: { \ 346 case Kind: { \
411 DoPrintDoubleElements<Type>(out, elements()); \ 347 DoPrintDoubleElements<Type>(out, elements()); \
412 break; \ 348 break; \
413 } 349 }
414 350
415 PRINT_ELEMENTS(EXTERNAL_PIXEL_ELEMENTS, ExternalPixelArray) 351 PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray)
416 PRINT_ELEMENTS(EXTERNAL_BYTE_ELEMENTS, ExternalByteArray) 352 PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array)
417 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_BYTE_ELEMENTS, 353 PRINT_ELEMENTS(EXTERNAL_UINT8_ELEMENTS,
418 ExternalUnsignedByteArray) 354 ExternalUint8Array)
419 PRINT_ELEMENTS(EXTERNAL_SHORT_ELEMENTS, ExternalShortArray) 355 PRINT_ELEMENTS(EXTERNAL_INT16_ELEMENTS, ExternalInt16Array)
420 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_SHORT_ELEMENTS, 356 PRINT_ELEMENTS(EXTERNAL_UINT16_ELEMENTS,
421 ExternalUnsignedShortArray) 357 ExternalUint16Array)
422 PRINT_ELEMENTS(EXTERNAL_INT_ELEMENTS, ExternalIntArray) 358 PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array)
423 PRINT_ELEMENTS(EXTERNAL_UNSIGNED_INT_ELEMENTS, 359 PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS,
424 ExternalUnsignedIntArray) 360 ExternalUint32Array)
425 PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT_ELEMENTS, ExternalFloatArray) 361 PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
426 PRINT_DOUBLE_ELEMENTS(EXTERNAL_DOUBLE_ELEMENTS, ExternalDoubleArray) 362 PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
427 363
428 364
429 PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array) 365 PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
430 PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray) 366 PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray)
431 PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array) 367 PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array)
432 PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array) 368 PRINT_ELEMENTS(UINT16_ELEMENTS, FixedUint16Array)
433 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array) 369 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array)
434 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array) 370 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array)
435 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array) 371 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array)
436 PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array) 372 PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array)
(...skipping 20 matching lines...) Expand all
457 break; 393 break;
458 } 394 }
459 } 395 }
460 } 396 }
461 397
462 398
463 void JSObject::PrintTransitions(FILE* out) { 399 void JSObject::PrintTransitions(FILE* out) {
464 if (!map()->HasTransitionArray()) return; 400 if (!map()->HasTransitionArray()) return;
465 TransitionArray* transitions = map()->transitions(); 401 TransitionArray* transitions = map()->transitions();
466 for (int i = 0; i < transitions->number_of_transitions(); i++) { 402 for (int i = 0; i < transitions->number_of_transitions(); i++) {
403 Name* key = transitions->GetKey(i);
467 PrintF(out, " "); 404 PrintF(out, " ");
468 transitions->GetKey(i)->NamePrint(out); 405 key->NamePrint(out);
469 PrintF(out, ": "); 406 PrintF(out, ": ");
470 switch (transitions->GetTargetDetails(i).type()) { 407 if (key == GetHeap()->frozen_symbol()) {
471 case FIELD: { 408 PrintF(out, " (transition to frozen)\n");
472 PrintF(out, " (transition to field)\n"); 409 } else if (key == GetHeap()->elements_transition_symbol()) {
473 break; 410 PrintF(out, " (transition to ");
411 PrintElementsKind(out, transitions->GetTarget(i)->elements_kind());
412 PrintF(out, ")\n");
413 } else if (key == GetHeap()->observed_symbol()) {
414 PrintF(out, " (transition to Object.observe)\n");
415 } else {
416 switch (transitions->GetTargetDetails(i).type()) {
417 case FIELD: {
418 PrintF(out, " (transition to field)\n");
419 break;
420 }
421 case CONSTANT:
422 PrintF(out, " (transition to constant)\n");
423 break;
424 case CALLBACKS:
425 PrintF(out, " (transition to callback)\n");
426 break;
427 // Values below are never in the target descriptor array.
428 case NORMAL:
429 case HANDLER:
430 case INTERCEPTOR:
431 case TRANSITION:
432 case NONEXISTENT:
433 UNREACHABLE();
434 break;
474 } 435 }
475 case CONSTANT:
476 PrintF(out, " (transition to constant)\n");
477 break;
478 case CALLBACKS:
479 PrintF(out, " (transition to callback)\n");
480 break;
481 // Values below are never in the target descriptor array.
482 case NORMAL:
483 case HANDLER:
484 case INTERCEPTOR:
485 case TRANSITION:
486 case NONEXISTENT:
487 UNREACHABLE();
488 break;
489 } 436 }
490 } 437 }
491 } 438 }
492 439
493 440
494 void JSObject::JSObjectPrint(FILE* out) { 441 void JSObject::JSObjectPrint(FILE* out) {
495 PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this)); 442 PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this));
496 PrintF(out, " - map = %p [", reinterpret_cast<void*>(map())); 443 PrintF(out, " - map = %p [", reinterpret_cast<void*>(map()));
497 // Don't call GetElementsKind, its validation code can cause the printer to 444 // Don't call GetElementsKind, its validation code can cause the printer to
498 // fail when debugging. 445 // fail when debugging.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 HeapObject::PrintHeader(out, "PolymorphicCodeCache"); 559 HeapObject::PrintHeader(out, "PolymorphicCodeCache");
613 PrintF(out, "\n - cache: "); 560 PrintF(out, "\n - cache: ");
614 cache()->ShortPrint(out); 561 cache()->ShortPrint(out);
615 } 562 }
616 563
617 564
618 void TypeFeedbackInfo::TypeFeedbackInfoPrint(FILE* out) { 565 void TypeFeedbackInfo::TypeFeedbackInfoPrint(FILE* out) {
619 HeapObject::PrintHeader(out, "TypeFeedbackInfo"); 566 HeapObject::PrintHeader(out, "TypeFeedbackInfo");
620 PrintF(out, " - ic_total_count: %d, ic_with_type_info_count: %d\n", 567 PrintF(out, " - ic_total_count: %d, ic_with_type_info_count: %d\n",
621 ic_total_count(), ic_with_type_info_count()); 568 ic_total_count(), ic_with_type_info_count());
622 PrintF(out, " - type_feedback_cells: "); 569 PrintF(out, " - feedback_vector: ");
623 type_feedback_cells()->FixedArrayPrint(out); 570 feedback_vector()->FixedArrayPrint(out);
624 } 571 }
625 572
626 573
627 void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(FILE* out) { 574 void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(FILE* out) {
628 HeapObject::PrintHeader(out, "AliasedArgumentsEntry"); 575 HeapObject::PrintHeader(out, "AliasedArgumentsEntry");
629 PrintF(out, "\n - aliased_context_slot: %d", aliased_context_slot()); 576 PrintF(out, "\n - aliased_context_slot: %d", aliased_context_slot());
630 } 577 }
631 578
632 579
633 void FixedArray::FixedArrayPrint(FILE* out) { 580 void FixedArray::FixedArrayPrint(FILE* out) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 void JSMessageObject::JSMessageObjectPrint(FILE* out) { 628 void JSMessageObject::JSMessageObjectPrint(FILE* out) {
682 HeapObject::PrintHeader(out, "JSMessageObject"); 629 HeapObject::PrintHeader(out, "JSMessageObject");
683 PrintF(out, " - type: "); 630 PrintF(out, " - type: ");
684 type()->ShortPrint(out); 631 type()->ShortPrint(out);
685 PrintF(out, "\n - arguments: "); 632 PrintF(out, "\n - arguments: ");
686 arguments()->ShortPrint(out); 633 arguments()->ShortPrint(out);
687 PrintF(out, "\n - start_position: %d", start_position()); 634 PrintF(out, "\n - start_position: %d", start_position());
688 PrintF(out, "\n - end_position: %d", end_position()); 635 PrintF(out, "\n - end_position: %d", end_position());
689 PrintF(out, "\n - script: "); 636 PrintF(out, "\n - script: ");
690 script()->ShortPrint(out); 637 script()->ShortPrint(out);
691 PrintF(out, "\n - stack_trace: ");
692 stack_trace()->ShortPrint(out);
693 PrintF(out, "\n - stack_frames: "); 638 PrintF(out, "\n - stack_frames: ");
694 stack_frames()->ShortPrint(out); 639 stack_frames()->ShortPrint(out);
695 PrintF(out, "\n"); 640 PrintF(out, "\n");
696 } 641 }
697 642
698 643
699 void String::StringPrint(FILE* out) { 644 void String::StringPrint(FILE* out) {
700 if (StringShape(this).IsInternalized()) { 645 if (StringShape(this).IsInternalized()) {
701 PrintF(out, "#"); 646 PrintF(out, "#");
702 } else if (StringShape(this).IsCons()) { 647 } else if (StringShape(this).IsCons()) {
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 } 1229 }
1285 } 1230 }
1286 PrintF(out, "\n"); 1231 PrintF(out, "\n");
1287 } 1232 }
1288 1233
1289 1234
1290 #endif // OBJECT_PRINT 1235 #endif // OBJECT_PRINT
1291 1236
1292 1237
1293 } } // namespace v8::internal 1238 } } // 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