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

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

Issue 6083001: Refactoring out object printing functions into objects-printer.cc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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/SConscript ('k') | src/objects-printer.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 16 matching lines...) Expand all
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "disassembler.h" 30 #include "disassembler.h"
31 #include "disasm.h" 31 #include "disasm.h"
32 #include "jsregexp.h" 32 #include "jsregexp.h"
33 #include "objects-visiting.h" 33 #include "objects-visiting.h"
34 34
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 #ifdef OBJECT_PRINT 38 #ifdef DEBUG
39 39
40 static const char* TypeToString(InstanceType type);
41
42
43 void MaybeObject::Print(FILE* out) {
44 Object* this_as_object;
45 if (ToObject(&this_as_object)) {
46 if (this_as_object->IsSmi()) {
47 Smi::cast(this_as_object)->SmiPrint(out);
48 } else {
49 HeapObject::cast(this_as_object)->HeapObjectPrint(out);
50 }
51 } else {
52 Failure::cast(this)->FailurePrint(out);
53 }
54 Flush(out);
55 }
56
57
58 void MaybeObject::PrintLn(FILE* out) {
59 Print(out);
60 PrintF(out, "\n");
61 }
62 #endif // OBJECT_PRINT
63
64
65 #ifdef DEBUG
66 void MaybeObject::Verify() { 40 void MaybeObject::Verify() {
67 Object* this_as_object; 41 Object* this_as_object;
68 if (ToObject(&this_as_object)) { 42 if (ToObject(&this_as_object)) {
69 if (this_as_object->IsSmi()) { 43 if (this_as_object->IsSmi()) {
70 Smi::cast(this_as_object)->SmiVerify(); 44 Smi::cast(this_as_object)->SmiVerify();
71 } else { 45 } else {
72 HeapObject::cast(this_as_object)->HeapObjectVerify(); 46 HeapObject::cast(this_as_object)->HeapObjectVerify();
73 } 47 }
74 } else { 48 } else {
75 Failure::cast(this)->FailureVerify(); 49 Failure::cast(this)->FailureVerify();
(...skipping 11 matching lines...) Expand all
87 61
88 62
89 void Smi::SmiVerify() { 63 void Smi::SmiVerify() {
90 ASSERT(IsSmi()); 64 ASSERT(IsSmi());
91 } 65 }
92 66
93 67
94 void Failure::FailureVerify() { 68 void Failure::FailureVerify() {
95 ASSERT(IsFailure()); 69 ASSERT(IsFailure());
96 } 70 }
97 #endif // DEBUG
98 71
99 72
100 #ifdef OBJECT_PRINT
101 void HeapObject::PrintHeader(FILE* out, const char* id) {
102 PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id);
103 }
104
105
106 void HeapObject::HeapObjectPrint(FILE* out) {
107 InstanceType instance_type = map()->instance_type();
108
109 HandleScope scope;
110 if (instance_type < FIRST_NONSTRING_TYPE) {
111 String::cast(this)->StringPrint(out);
112 return;
113 }
114
115 switch (instance_type) {
116 case MAP_TYPE:
117 Map::cast(this)->MapPrint(out);
118 break;
119 case HEAP_NUMBER_TYPE:
120 HeapNumber::cast(this)->HeapNumberPrint(out);
121 break;
122 case FIXED_ARRAY_TYPE:
123 FixedArray::cast(this)->FixedArrayPrint(out);
124 break;
125 case BYTE_ARRAY_TYPE:
126 ByteArray::cast(this)->ByteArrayPrint(out);
127 break;
128 case PIXEL_ARRAY_TYPE:
129 PixelArray::cast(this)->PixelArrayPrint(out);
130 break;
131 case EXTERNAL_BYTE_ARRAY_TYPE:
132 ExternalByteArray::cast(this)->ExternalByteArrayPrint(out);
133 break;
134 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
135 ExternalUnsignedByteArray::cast(this)
136 ->ExternalUnsignedByteArrayPrint(out);
137 break;
138 case EXTERNAL_SHORT_ARRAY_TYPE:
139 ExternalShortArray::cast(this)->ExternalShortArrayPrint(out);
140 break;
141 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
142 ExternalUnsignedShortArray::cast(this)
143 ->ExternalUnsignedShortArrayPrint(out);
144 break;
145 case EXTERNAL_INT_ARRAY_TYPE:
146 ExternalIntArray::cast(this)->ExternalIntArrayPrint(out);
147 break;
148 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
149 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayPrint(out);
150 break;
151 case EXTERNAL_FLOAT_ARRAY_TYPE:
152 ExternalFloatArray::cast(this)->ExternalFloatArrayPrint(out);
153 break;
154 case FILLER_TYPE:
155 PrintF(out, "filler");
156 break;
157 case JS_OBJECT_TYPE: // fall through
158 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
159 case JS_ARRAY_TYPE:
160 case JS_REGEXP_TYPE:
161 JSObject::cast(this)->JSObjectPrint(out);
162 break;
163 case ODDBALL_TYPE:
164 Oddball::cast(this)->to_string()->Print(out);
165 break;
166 case JS_FUNCTION_TYPE:
167 JSFunction::cast(this)->JSFunctionPrint(out);
168 break;
169 case JS_GLOBAL_PROXY_TYPE:
170 JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out);
171 break;
172 case JS_GLOBAL_OBJECT_TYPE:
173 JSGlobalObject::cast(this)->JSGlobalObjectPrint(out);
174 break;
175 case JS_BUILTINS_OBJECT_TYPE:
176 JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out);
177 break;
178 case JS_VALUE_TYPE:
179 PrintF(out, "Value wrapper around:");
180 JSValue::cast(this)->value()->Print(out);
181 break;
182 case CODE_TYPE:
183 Code::cast(this)->CodePrint(out);
184 break;
185 case PROXY_TYPE:
186 Proxy::cast(this)->ProxyPrint(out);
187 break;
188 case SHARED_FUNCTION_INFO_TYPE:
189 SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out);
190 break;
191 case JS_GLOBAL_PROPERTY_CELL_TYPE:
192 JSGlobalPropertyCell::cast(this)->JSGlobalPropertyCellPrint(out);
193 break;
194 #define MAKE_STRUCT_CASE(NAME, Name, name) \
195 case NAME##_TYPE: \
196 Name::cast(this)->Name##Print(out); \
197 break;
198 STRUCT_LIST(MAKE_STRUCT_CASE)
199 #undef MAKE_STRUCT_CASE
200
201 default:
202 PrintF(out, "UNKNOWN TYPE %d", map()->instance_type());
203 UNREACHABLE();
204 break;
205 }
206 }
207 #endif // OBJECT_PRINT
208
209
210 #ifdef DEBUG
211 void HeapObject::HeapObjectVerify() { 73 void HeapObject::HeapObjectVerify() {
212 InstanceType instance_type = map()->instance_type(); 74 InstanceType instance_type = map()->instance_type();
213 75
214 if (instance_type < FIRST_NONSTRING_TYPE) { 76 if (instance_type < FIRST_NONSTRING_TYPE) {
215 String::cast(this)->StringVerify(); 77 String::cast(this)->StringVerify();
216 return; 78 return;
217 } 79 }
218 80
219 switch (instance_type) { 81 switch (instance_type) {
220 case MAP_TYPE: 82 case MAP_TYPE:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 175
314 void HeapObject::VerifyHeapPointer(Object* p) { 176 void HeapObject::VerifyHeapPointer(Object* p) {
315 ASSERT(p->IsHeapObject()); 177 ASSERT(p->IsHeapObject());
316 ASSERT(Heap::Contains(HeapObject::cast(p))); 178 ASSERT(Heap::Contains(HeapObject::cast(p)));
317 } 179 }
318 180
319 181
320 void HeapNumber::HeapNumberVerify() { 182 void HeapNumber::HeapNumberVerify() {
321 ASSERT(IsHeapNumber()); 183 ASSERT(IsHeapNumber());
322 } 184 }
323 #endif // DEBUG
324 185
325 186
326 #ifdef OBJECT_PRINT
327 void ByteArray::ByteArrayPrint(FILE* out) {
328 PrintF(out, "byte array, data starts at %p", GetDataStartAddress());
329 }
330
331
332 void PixelArray::PixelArrayPrint(FILE* out) {
333 PrintF(out, "pixel array");
334 }
335
336
337 void ExternalByteArray::ExternalByteArrayPrint(FILE* out) {
338 PrintF(out, "external byte array");
339 }
340
341
342 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayPrint(FILE* out) {
343 PrintF(out, "external unsigned byte array");
344 }
345
346
347 void ExternalShortArray::ExternalShortArrayPrint(FILE* out) {
348 PrintF(out, "external short array");
349 }
350
351
352 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayPrint(FILE* out) {
353 PrintF(out, "external unsigned short array");
354 }
355
356
357 void ExternalIntArray::ExternalIntArrayPrint(FILE* out) {
358 PrintF(out, "external int array");
359 }
360
361
362 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayPrint(FILE* out) {
363 PrintF(out, "external unsigned int array");
364 }
365
366
367 void ExternalFloatArray::ExternalFloatArrayPrint(FILE* out) {
368 PrintF(out, "external float array");
369 }
370 #endif // OBJECT_PRINT
371
372
373 #ifdef DEBUG
374 void ByteArray::ByteArrayVerify() { 187 void ByteArray::ByteArrayVerify() {
375 ASSERT(IsByteArray()); 188 ASSERT(IsByteArray());
376 } 189 }
377 190
378 191
379 void PixelArray::PixelArrayVerify() { 192 void PixelArray::PixelArrayVerify() {
380 ASSERT(IsPixelArray()); 193 ASSERT(IsPixelArray());
381 } 194 }
382 195
383 196
(...skipping 23 matching lines...) Expand all
407 220
408 221
409 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() { 222 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() {
410 ASSERT(IsExternalUnsignedIntArray()); 223 ASSERT(IsExternalUnsignedIntArray());
411 } 224 }
412 225
413 226
414 void ExternalFloatArray::ExternalFloatArrayVerify() { 227 void ExternalFloatArray::ExternalFloatArrayVerify() {
415 ASSERT(IsExternalFloatArray()); 228 ASSERT(IsExternalFloatArray());
416 } 229 }
417 #endif // DEBUG
418 230
419 231
420 #ifdef OBJECT_PRINT
421 void JSObject::PrintProperties(FILE* out) {
422 if (HasFastProperties()) {
423 DescriptorArray* descs = map()->instance_descriptors();
424 for (int i = 0; i < descs->number_of_descriptors(); i++) {
425 PrintF(out, " ");
426 descs->GetKey(i)->StringPrint(out);
427 PrintF(out, ": ");
428 switch (descs->GetType(i)) {
429 case FIELD: {
430 int index = descs->GetFieldIndex(i);
431 FastPropertyAt(index)->ShortPrint(out);
432 PrintF(out, " (field at offset %d)\n", index);
433 break;
434 }
435 case CONSTANT_FUNCTION:
436 descs->GetConstantFunction(i)->ShortPrint(out);
437 PrintF(out, " (constant function)\n");
438 break;
439 case CALLBACKS:
440 descs->GetCallbacksObject(i)->ShortPrint(out);
441 PrintF(out, " (callback)\n");
442 break;
443 case MAP_TRANSITION:
444 PrintF(out, " (map transition)\n");
445 break;
446 case CONSTANT_TRANSITION:
447 PrintF(out, " (constant transition)\n");
448 break;
449 case NULL_DESCRIPTOR:
450 PrintF(out, " (null descriptor)\n");
451 break;
452 default:
453 UNREACHABLE();
454 break;
455 }
456 }
457 } else {
458 property_dictionary()->Print(out);
459 }
460 }
461
462
463 void JSObject::PrintElements(FILE* out) {
464 switch (GetElementsKind()) {
465 case FAST_ELEMENTS: {
466 // Print in array notation for non-sparse arrays.
467 FixedArray* p = FixedArray::cast(elements());
468 for (int i = 0; i < p->length(); i++) {
469 PrintF(out, " %d: ", i);
470 p->get(i)->ShortPrint(out);
471 PrintF(out, "\n");
472 }
473 break;
474 }
475 case PIXEL_ELEMENTS: {
476 PixelArray* p = PixelArray::cast(elements());
477 for (int i = 0; i < p->length(); i++) {
478 PrintF(out, " %d: %d\n", i, p->get(i));
479 }
480 break;
481 }
482 case EXTERNAL_BYTE_ELEMENTS: {
483 ExternalByteArray* p = ExternalByteArray::cast(elements());
484 for (int i = 0; i < p->length(); i++) {
485 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i)));
486 }
487 break;
488 }
489 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
490 ExternalUnsignedByteArray* p =
491 ExternalUnsignedByteArray::cast(elements());
492 for (int i = 0; i < p->length(); i++) {
493 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i)));
494 }
495 break;
496 }
497 case EXTERNAL_SHORT_ELEMENTS: {
498 ExternalShortArray* p = ExternalShortArray::cast(elements());
499 for (int i = 0; i < p->length(); i++) {
500 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i)));
501 }
502 break;
503 }
504 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
505 ExternalUnsignedShortArray* p =
506 ExternalUnsignedShortArray::cast(elements());
507 for (int i = 0; i < p->length(); i++) {
508 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i)));
509 }
510 break;
511 }
512 case EXTERNAL_INT_ELEMENTS: {
513 ExternalIntArray* p = ExternalIntArray::cast(elements());
514 for (int i = 0; i < p->length(); i++) {
515 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i)));
516 }
517 break;
518 }
519 case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
520 ExternalUnsignedIntArray* p =
521 ExternalUnsignedIntArray::cast(elements());
522 for (int i = 0; i < p->length(); i++) {
523 PrintF(out, " %d: %d\n", i, static_cast<int>(p->get(i)));
524 }
525 break;
526 }
527 case EXTERNAL_FLOAT_ELEMENTS: {
528 ExternalFloatArray* p = ExternalFloatArray::cast(elements());
529 for (int i = 0; i < p->length(); i++) {
530 PrintF(out, " %d: %f\n", i, p->get(i));
531 }
532 break;
533 }
534 case DICTIONARY_ELEMENTS:
535 elements()->Print(out);
536 break;
537 default:
538 UNREACHABLE();
539 break;
540 }
541 }
542
543
544 void JSObject::JSObjectPrint(FILE* out) {
545 PrintF(out, "%p: [JSObject]\n", reinterpret_cast<void*>(this));
546 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
547 PrintF(out, " - prototype = %p\n", reinterpret_cast<void*>(GetPrototype()));
548 PrintF(out, " {\n");
549 PrintProperties(out);
550 PrintElements(out);
551 PrintF(out, " }\n");
552 }
553 #endif // OBJECT_PRINT
554
555
556 #ifdef DEBUG
557 void JSObject::JSObjectVerify() { 232 void JSObject::JSObjectVerify() {
558 VerifyHeapPointer(properties()); 233 VerifyHeapPointer(properties());
559 VerifyHeapPointer(elements()); 234 VerifyHeapPointer(elements());
560 if (HasFastProperties()) { 235 if (HasFastProperties()) {
561 CHECK_EQ(map()->unused_property_fields(), 236 CHECK_EQ(map()->unused_property_fields(),
562 (map()->inobject_properties() + properties()->length() - 237 (map()->inobject_properties() + properties()->length() -
563 map()->NextFreePropertyIndex())); 238 map()->NextFreePropertyIndex()));
564 } 239 }
565 ASSERT(map()->has_fast_elements() == 240 ASSERT(map()->has_fast_elements() ==
566 (elements()->map() == Heap::fixed_array_map() || 241 (elements()->map() == Heap::fixed_array_map() ||
567 elements()->map() == Heap::fixed_cow_array_map())); 242 elements()->map() == Heap::fixed_cow_array_map()));
568 ASSERT(map()->has_fast_elements() == HasFastElements()); 243 ASSERT(map()->has_fast_elements() == HasFastElements());
569 } 244 }
570 #endif // DEBUG
571 245
572 246
573 #ifdef OBJECT_PRINT
574 static const char* TypeToString(InstanceType type) {
575 switch (type) {
576 case INVALID_TYPE: return "INVALID";
577 case MAP_TYPE: return "MAP";
578 case HEAP_NUMBER_TYPE: return "HEAP_NUMBER";
579 case SYMBOL_TYPE: return "SYMBOL";
580 case ASCII_SYMBOL_TYPE: return "ASCII_SYMBOL";
581 case CONS_SYMBOL_TYPE: return "CONS_SYMBOL";
582 case CONS_ASCII_SYMBOL_TYPE: return "CONS_ASCII_SYMBOL";
583 case EXTERNAL_ASCII_SYMBOL_TYPE:
584 case EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE:
585 case EXTERNAL_SYMBOL_TYPE: return "EXTERNAL_SYMBOL";
586 case ASCII_STRING_TYPE: return "ASCII_STRING";
587 case STRING_TYPE: return "TWO_BYTE_STRING";
588 case CONS_STRING_TYPE:
589 case CONS_ASCII_STRING_TYPE: return "CONS_STRING";
590 case EXTERNAL_ASCII_STRING_TYPE:
591 case EXTERNAL_STRING_WITH_ASCII_DATA_TYPE:
592 case EXTERNAL_STRING_TYPE: return "EXTERNAL_STRING";
593 case FIXED_ARRAY_TYPE: return "FIXED_ARRAY";
594 case BYTE_ARRAY_TYPE: return "BYTE_ARRAY";
595 case PIXEL_ARRAY_TYPE: return "PIXEL_ARRAY";
596 case EXTERNAL_BYTE_ARRAY_TYPE: return "EXTERNAL_BYTE_ARRAY";
597 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
598 return "EXTERNAL_UNSIGNED_BYTE_ARRAY";
599 case EXTERNAL_SHORT_ARRAY_TYPE: return "EXTERNAL_SHORT_ARRAY";
600 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
601 return "EXTERNAL_UNSIGNED_SHORT_ARRAY";
602 case EXTERNAL_INT_ARRAY_TYPE: return "EXTERNAL_INT_ARRAY";
603 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
604 return "EXTERNAL_UNSIGNED_INT_ARRAY";
605 case EXTERNAL_FLOAT_ARRAY_TYPE: return "EXTERNAL_FLOAT_ARRAY";
606 case FILLER_TYPE: return "FILLER";
607 case JS_OBJECT_TYPE: return "JS_OBJECT";
608 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: return "JS_CONTEXT_EXTENSION_OBJECT";
609 case ODDBALL_TYPE: return "ODDBALL";
610 case JS_GLOBAL_PROPERTY_CELL_TYPE: return "JS_GLOBAL_PROPERTY_CELL";
611 case SHARED_FUNCTION_INFO_TYPE: return "SHARED_FUNCTION_INFO";
612 case JS_FUNCTION_TYPE: return "JS_FUNCTION";
613 case CODE_TYPE: return "CODE";
614 case JS_ARRAY_TYPE: return "JS_ARRAY";
615 case JS_REGEXP_TYPE: return "JS_REGEXP";
616 case JS_VALUE_TYPE: return "JS_VALUE";
617 case JS_GLOBAL_OBJECT_TYPE: return "JS_GLOBAL_OBJECT";
618 case JS_BUILTINS_OBJECT_TYPE: return "JS_BUILTINS_OBJECT";
619 case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY";
620 case PROXY_TYPE: return "PROXY";
621 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME;
622 STRUCT_LIST(MAKE_STRUCT_CASE)
623 #undef MAKE_STRUCT_CASE
624 }
625 return "UNKNOWN";
626 }
627
628
629 void Map::MapPrint(FILE* out) {
630 HeapObject::PrintHeader(out, "Map");
631 PrintF(out, " - type: %s\n", TypeToString(instance_type()));
632 PrintF(out, " - instance size: %d\n", instance_size());
633 PrintF(out, " - inobject properties: %d\n", inobject_properties());
634 PrintF(out, " - pre-allocated property fields: %d\n",
635 pre_allocated_property_fields());
636 PrintF(out, " - unused property fields: %d\n", unused_property_fields());
637 if (is_hidden_prototype()) {
638 PrintF(out, " - hidden_prototype\n");
639 }
640 if (has_named_interceptor()) {
641 PrintF(out, " - named_interceptor\n");
642 }
643 if (has_indexed_interceptor()) {
644 PrintF(out, " - indexed_interceptor\n");
645 }
646 if (is_undetectable()) {
647 PrintF(out, " - undetectable\n");
648 }
649 if (has_instance_call_handler()) {
650 PrintF(out, " - instance_call_handler\n");
651 }
652 if (is_access_check_needed()) {
653 PrintF(out, " - access_check_needed\n");
654 }
655 PrintF(out, " - instance descriptors: ");
656 instance_descriptors()->ShortPrint(out);
657 PrintF(out, "\n - prototype: ");
658 prototype()->ShortPrint(out);
659 PrintF(out, "\n - constructor: ");
660 constructor()->ShortPrint(out);
661 PrintF(out, "\n");
662 }
663 #endif // OBJECT_PRINT
664
665
666 #ifdef DEBUG
667 void Map::MapVerify() { 247 void Map::MapVerify() {
668 ASSERT(!Heap::InNewSpace(this)); 248 ASSERT(!Heap::InNewSpace(this));
669 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); 249 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE);
670 ASSERT(instance_size() == kVariableSizeSentinel || 250 ASSERT(instance_size() == kVariableSizeSentinel ||
671 (kPointerSize <= instance_size() && 251 (kPointerSize <= instance_size() &&
672 instance_size() < Heap::Capacity())); 252 instance_size() < Heap::Capacity()));
673 VerifyHeapPointer(prototype()); 253 VerifyHeapPointer(prototype());
674 VerifyHeapPointer(instance_descriptors()); 254 VerifyHeapPointer(instance_descriptors());
675 } 255 }
676 256
677 257
678 void Map::SharedMapVerify() { 258 void Map::SharedMapVerify() {
679 MapVerify(); 259 MapVerify();
680 ASSERT(is_shared()); 260 ASSERT(is_shared());
681 ASSERT_EQ(Heap::empty_descriptor_array(), instance_descriptors()); 261 ASSERT_EQ(Heap::empty_descriptor_array(), instance_descriptors());
682 ASSERT_EQ(Heap::empty_fixed_array(), code_cache()); 262 ASSERT_EQ(Heap::empty_fixed_array(), code_cache());
683 ASSERT_EQ(0, pre_allocated_property_fields()); 263 ASSERT_EQ(0, pre_allocated_property_fields());
684 ASSERT_EQ(0, unused_property_fields()); 264 ASSERT_EQ(0, unused_property_fields());
685 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), 265 ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()),
686 visitor_id()); 266 visitor_id());
687 } 267 }
688 #endif // DEBUG
689 268
690 269
691 #ifdef OBJECT_PRINT
692 void CodeCache::CodeCachePrint(FILE* out) {
693 HeapObject::PrintHeader(out, "CodeCache");
694 PrintF(out, "\n - default_cache: ");
695 default_cache()->ShortPrint(out);
696 PrintF(out, "\n - normal_type_cache: ");
697 normal_type_cache()->ShortPrint(out);
698 }
699 #endif // OBJECT_PRINT
700
701
702 #ifdef DEBUG
703 void CodeCache::CodeCacheVerify() { 270 void CodeCache::CodeCacheVerify() {
704 VerifyHeapPointer(default_cache()); 271 VerifyHeapPointer(default_cache());
705 VerifyHeapPointer(normal_type_cache()); 272 VerifyHeapPointer(normal_type_cache());
706 ASSERT(default_cache()->IsFixedArray()); 273 ASSERT(default_cache()->IsFixedArray());
707 ASSERT(normal_type_cache()->IsUndefined() 274 ASSERT(normal_type_cache()->IsUndefined()
708 || normal_type_cache()->IsCodeCacheHashTable()); 275 || normal_type_cache()->IsCodeCacheHashTable());
709 } 276 }
710 #endif // DEBUG
711 277
712 278
713 #ifdef OBJECT_PRINT
714 void FixedArray::FixedArrayPrint(FILE* out) {
715 HeapObject::PrintHeader(out, "FixedArray");
716 PrintF(out, " - length: %d", length());
717 for (int i = 0; i < length(); i++) {
718 PrintF(out, "\n [%d]: ", i);
719 get(i)->ShortPrint(out);
720 }
721 PrintF(out, "\n");
722 }
723 #endif // OBJECT_PRINT
724
725
726 #ifdef DEBUG
727 void FixedArray::FixedArrayVerify() { 279 void FixedArray::FixedArrayVerify() {
728 for (int i = 0; i < length(); i++) { 280 for (int i = 0; i < length(); i++) {
729 Object* e = get(i); 281 Object* e = get(i);
730 if (e->IsHeapObject()) { 282 if (e->IsHeapObject()) {
731 VerifyHeapPointer(e); 283 VerifyHeapPointer(e);
732 } else { 284 } else {
733 e->Verify(); 285 e->Verify();
734 } 286 }
735 } 287 }
736 } 288 }
737 #endif // DEBUG
738 289
739 290
740 #ifdef OBJECT_PRINT
741 void JSValue::JSValuePrint(FILE* out) {
742 HeapObject::PrintHeader(out, "ValueObject");
743 value()->Print(out);
744 }
745 #endif // OBJECT_PRINT
746
747
748 #ifdef DEBUG
749 void JSValue::JSValueVerify() { 291 void JSValue::JSValueVerify() {
750 Object* v = value(); 292 Object* v = value();
751 if (v->IsHeapObject()) { 293 if (v->IsHeapObject()) {
752 VerifyHeapPointer(v); 294 VerifyHeapPointer(v);
753 } 295 }
754 } 296 }
755 #endif // DEBUG
756 297
757 298
758 #ifdef OBJECT_PRINT
759 void String::StringPrint(FILE* out) {
760 if (StringShape(this).IsSymbol()) {
761 PrintF(out, "#");
762 } else if (StringShape(this).IsCons()) {
763 PrintF(out, "c\"");
764 } else {
765 PrintF(out, "\"");
766 }
767
768 const char truncated_epilogue[] = "...<truncated>";
769 int len = length();
770 if (!FLAG_use_verbose_printer) {
771 if (len > 100) {
772 len = 100 - sizeof(truncated_epilogue);
773 }
774 }
775 for (int i = 0; i < len; i++) {
776 PrintF(out, "%c", Get(i));
777 }
778 if (len != length()) {
779 PrintF(out, "%s", truncated_epilogue);
780 }
781
782 if (!StringShape(this).IsSymbol()) PrintF(out, "\"");
783 }
784 #endif // OBJECT_PRINT
785
786
787 #ifdef DEBUG
788 void String::StringVerify() { 299 void String::StringVerify() {
789 CHECK(IsString()); 300 CHECK(IsString());
790 CHECK(length() >= 0 && length() <= Smi::kMaxValue); 301 CHECK(length() >= 0 && length() <= Smi::kMaxValue);
791 if (IsSymbol()) { 302 if (IsSymbol()) {
792 CHECK(!Heap::InNewSpace(this)); 303 CHECK(!Heap::InNewSpace(this));
793 } 304 }
794 } 305 }
795 #endif // DEBUG
796 306
797 307
798 #ifdef OBJECT_PRINT
799 void JSFunction::JSFunctionPrint(FILE* out) {
800 HeapObject::PrintHeader(out, "Function");
801 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
802 PrintF(out, " - initial_map = ");
803 if (has_initial_map()) {
804 initial_map()->ShortPrint(out);
805 }
806 PrintF(out, "\n - shared_info = ");
807 shared()->ShortPrint(out);
808 PrintF(out, "\n - name = ");
809 shared()->name()->Print(out);
810 PrintF(out, "\n - context = ");
811 unchecked_context()->ShortPrint(out);
812 PrintF(out, "\n - code = ");
813 code()->ShortPrint(out);
814 PrintF(out, "\n");
815
816 PrintProperties(out);
817 PrintElements(out);
818
819 PrintF(out, "\n");
820 }
821 #endif // OBJECT_PRINT
822
823
824 #ifdef DEBUG
825 void JSFunction::JSFunctionVerify() { 308 void JSFunction::JSFunctionVerify() {
826 CHECK(IsJSFunction()); 309 CHECK(IsJSFunction());
827 VerifyObjectField(kPrototypeOrInitialMapOffset); 310 VerifyObjectField(kPrototypeOrInitialMapOffset);
828 VerifyObjectField(kNextFunctionLinkOffset); 311 VerifyObjectField(kNextFunctionLinkOffset);
829 CHECK(next_function_link()->IsUndefined() || 312 CHECK(next_function_link()->IsUndefined() ||
830 next_function_link()->IsJSFunction()); 313 next_function_link()->IsJSFunction());
831 } 314 }
832 #endif // DEBUG
833 315
834 316
835 #ifdef OBJECT_PRINT
836 void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) {
837 HeapObject::PrintHeader(out, "SharedFunctionInfo");
838 PrintF(out, " - name: ");
839 name()->ShortPrint(out);
840 PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties());
841 PrintF(out, "\n - instance class name = ");
842 instance_class_name()->Print(out);
843 PrintF(out, "\n - code = ");
844 code()->ShortPrint(out);
845 PrintF(out, "\n - source code = ");
846 GetSourceCode()->ShortPrint(out);
847 // Script files are often large, hard to read.
848 // PrintF(out, "\n - script =");
849 // script()->Print(out);
850 PrintF(out, "\n - function token position = %d", function_token_position());
851 PrintF(out, "\n - start position = %d", start_position());
852 PrintF(out, "\n - end position = %d", end_position());
853 PrintF(out, "\n - is expression = %d", is_expression());
854 PrintF(out, "\n - debug info = ");
855 debug_info()->ShortPrint(out);
856 PrintF(out, "\n - length = %d", length());
857 PrintF(out, "\n - has_only_simple_this_property_assignments = %d",
858 has_only_simple_this_property_assignments());
859 PrintF(out, "\n - this_property_assignments = ");
860 this_property_assignments()->ShortPrint(out);
861 PrintF(out, "\n");
862 }
863 #endif // OBJECT_PRINT
864
865
866 #ifdef DEBUG
867 void SharedFunctionInfo::SharedFunctionInfoVerify() { 317 void SharedFunctionInfo::SharedFunctionInfoVerify() {
868 CHECK(IsSharedFunctionInfo()); 318 CHECK(IsSharedFunctionInfo());
869 VerifyObjectField(kNameOffset); 319 VerifyObjectField(kNameOffset);
870 VerifyObjectField(kCodeOffset); 320 VerifyObjectField(kCodeOffset);
871 VerifyObjectField(kScopeInfoOffset); 321 VerifyObjectField(kScopeInfoOffset);
872 VerifyObjectField(kInstanceClassNameOffset); 322 VerifyObjectField(kInstanceClassNameOffset);
873 VerifyObjectField(kFunctionDataOffset); 323 VerifyObjectField(kFunctionDataOffset);
874 VerifyObjectField(kScriptOffset); 324 VerifyObjectField(kScriptOffset);
875 VerifyObjectField(kDebugInfoOffset); 325 VerifyObjectField(kDebugInfoOffset);
876 } 326 }
877 #endif // DEBUG
878 327
879 328
880 #ifdef OBJECT_PRINT
881 void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) {
882 PrintF(out, "global_proxy");
883 JSObjectPrint(out);
884 PrintF(out, "context : ");
885 context()->ShortPrint(out);
886 PrintF(out, "\n");
887 }
888 #endif // OBJECT_PRINT
889
890
891 #ifdef DEBUG
892 void JSGlobalProxy::JSGlobalProxyVerify() { 329 void JSGlobalProxy::JSGlobalProxyVerify() {
893 CHECK(IsJSGlobalProxy()); 330 CHECK(IsJSGlobalProxy());
894 JSObjectVerify(); 331 JSObjectVerify();
895 VerifyObjectField(JSGlobalProxy::kContextOffset); 332 VerifyObjectField(JSGlobalProxy::kContextOffset);
896 // Make sure that this object has no properties, elements. 333 // Make sure that this object has no properties, elements.
897 CHECK_EQ(0, properties()->length()); 334 CHECK_EQ(0, properties()->length());
898 CHECK(HasFastElements()); 335 CHECK(HasFastElements());
899 CHECK_EQ(0, FixedArray::cast(elements())->length()); 336 CHECK_EQ(0, FixedArray::cast(elements())->length());
900 } 337 }
901 #endif // DEBUG
902 338
903 339
904 #ifdef OBJECT_PRINT
905 void JSGlobalObject::JSGlobalObjectPrint(FILE* out) {
906 PrintF(out, "global ");
907 JSObjectPrint(out);
908 PrintF(out, "global context : ");
909 global_context()->ShortPrint(out);
910 PrintF(out, "\n");
911 }
912 #endif // OBJECT_PRINT
913
914
915 #ifdef DEBUG
916 void JSGlobalObject::JSGlobalObjectVerify() { 340 void JSGlobalObject::JSGlobalObjectVerify() {
917 CHECK(IsJSGlobalObject()); 341 CHECK(IsJSGlobalObject());
918 JSObjectVerify(); 342 JSObjectVerify();
919 for (int i = GlobalObject::kBuiltinsOffset; 343 for (int i = GlobalObject::kBuiltinsOffset;
920 i < JSGlobalObject::kSize; 344 i < JSGlobalObject::kSize;
921 i += kPointerSize) { 345 i += kPointerSize) {
922 VerifyObjectField(i); 346 VerifyObjectField(i);
923 } 347 }
924 } 348 }
925 #endif // DEBUG
926 349
927 350
928 #ifdef OBJECT_PRINT
929 void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) {
930 PrintF(out, "builtins ");
931 JSObjectPrint(out);
932 }
933 #endif // OBJECT_PRINT
934
935
936 #ifdef DEBUG
937 void JSBuiltinsObject::JSBuiltinsObjectVerify() { 351 void JSBuiltinsObject::JSBuiltinsObjectVerify() {
938 CHECK(IsJSBuiltinsObject()); 352 CHECK(IsJSBuiltinsObject());
939 JSObjectVerify(); 353 JSObjectVerify();
940 for (int i = GlobalObject::kBuiltinsOffset; 354 for (int i = GlobalObject::kBuiltinsOffset;
941 i < JSBuiltinsObject::kSize; 355 i < JSBuiltinsObject::kSize;
942 i += kPointerSize) { 356 i += kPointerSize) {
943 VerifyObjectField(i); 357 VerifyObjectField(i);
944 } 358 }
945 } 359 }
946 360
(...skipping 10 matching lines...) Expand all
957 ASSERT(value == 0 || value == 1 || value == -1 || 371 ASSERT(value == 0 || value == 1 || value == -1 ||
958 value == -2 || value == -3); 372 value == -2 || value == -3);
959 } 373 }
960 } 374 }
961 375
962 376
963 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { 377 void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() {
964 CHECK(IsJSGlobalPropertyCell()); 378 CHECK(IsJSGlobalPropertyCell());
965 VerifyObjectField(kValueOffset); 379 VerifyObjectField(kValueOffset);
966 } 380 }
967 #endif // DEBUG
968 381
969 382
970 #ifdef OBJECT_PRINT
971 void JSGlobalPropertyCell::JSGlobalPropertyCellPrint(FILE* out) {
972 HeapObject::PrintHeader(out, "JSGlobalPropertyCell");
973 }
974
975
976 void Code::CodePrint(FILE* out) {
977 HeapObject::PrintHeader(out, "Code");
978 #ifdef ENABLE_DISASSEMBLER
979 if (FLAG_use_verbose_printer) {
980 Disassemble(NULL, out);
981 }
982 #endif
983 }
984 #endif // OBJECT_PRINT
985
986
987 #ifdef DEBUG
988 void Code::CodeVerify() { 383 void Code::CodeVerify() {
989 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), 384 CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()),
990 kCodeAlignment)); 385 kCodeAlignment));
991 Address last_gc_pc = NULL; 386 Address last_gc_pc = NULL;
992 for (RelocIterator it(this); !it.done(); it.next()) { 387 for (RelocIterator it(this); !it.done(); it.next()) {
993 it.rinfo()->Verify(); 388 it.rinfo()->Verify();
994 // Ensure that GC will not iterate twice over the same pointer. 389 // Ensure that GC will not iterate twice over the same pointer.
995 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { 390 if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) {
996 CHECK(it.rinfo()->pc() != last_gc_pc); 391 CHECK(it.rinfo()->pc() != last_gc_pc);
997 last_gc_pc = it.rinfo()->pc(); 392 last_gc_pc = it.rinfo()->pc();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); 427 ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi());
1033 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); 428 ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi());
1034 break; 429 break;
1035 } 430 }
1036 default: 431 default:
1037 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); 432 ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag());
1038 ASSERT(data()->IsUndefined()); 433 ASSERT(data()->IsUndefined());
1039 break; 434 break;
1040 } 435 }
1041 } 436 }
1042 #endif // DEBUG
1043 437
1044 438
1045 #ifdef OBJECT_PRINT
1046 void Proxy::ProxyPrint(FILE* out) {
1047 PrintF(out, "proxy to %p", proxy());
1048 }
1049 #endif // OBJECT_PRINT
1050
1051
1052 #ifdef DEBUG
1053 void Proxy::ProxyVerify() { 439 void Proxy::ProxyVerify() {
1054 ASSERT(IsProxy()); 440 ASSERT(IsProxy());
1055 } 441 }
1056 442
1057 443
1058 void AccessorInfo::AccessorInfoVerify() { 444 void AccessorInfo::AccessorInfoVerify() {
1059 CHECK(IsAccessorInfo()); 445 CHECK(IsAccessorInfo());
1060 VerifyPointer(getter()); 446 VerifyPointer(getter());
1061 VerifyPointer(setter()); 447 VerifyPointer(setter());
1062 VerifyPointer(name()); 448 VerifyPointer(name());
1063 VerifyPointer(data()); 449 VerifyPointer(data());
1064 VerifyPointer(flag()); 450 VerifyPointer(flag());
1065 } 451 }
1066 #endif // DEBUG
1067 452
1068 453
1069 #ifdef OBJECT_PRINT
1070 void AccessorInfo::AccessorInfoPrint(FILE* out) {
1071 HeapObject::PrintHeader(out, "AccessorInfo");
1072 PrintF(out, "\n - getter: ");
1073 getter()->ShortPrint(out);
1074 PrintF(out, "\n - setter: ");
1075 setter()->ShortPrint(out);
1076 PrintF(out, "\n - name: ");
1077 name()->ShortPrint(out);
1078 PrintF(out, "\n - data: ");
1079 data()->ShortPrint(out);
1080 PrintF(out, "\n - flag: ");
1081 flag()->ShortPrint(out);
1082 }
1083 #endif // OBJECT_PRINT
1084
1085
1086 #ifdef DEBUG
1087 void AccessCheckInfo::AccessCheckInfoVerify() { 454 void AccessCheckInfo::AccessCheckInfoVerify() {
1088 CHECK(IsAccessCheckInfo()); 455 CHECK(IsAccessCheckInfo());
1089 VerifyPointer(named_callback()); 456 VerifyPointer(named_callback());
1090 VerifyPointer(indexed_callback()); 457 VerifyPointer(indexed_callback());
1091 VerifyPointer(data()); 458 VerifyPointer(data());
1092 } 459 }
1093 #endif // DEBUG
1094 460
1095 461
1096 #ifdef OBJECT_PRINT
1097 void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) {
1098 HeapObject::PrintHeader(out, "AccessCheckInfo");
1099 PrintF(out, "\n - named_callback: ");
1100 named_callback()->ShortPrint(out);
1101 PrintF(out, "\n - indexed_callback: ");
1102 indexed_callback()->ShortPrint(out);
1103 PrintF(out, "\n - data: ");
1104 data()->ShortPrint(out);
1105 }
1106 #endif // OBJECT_PRINT
1107
1108
1109 #ifdef DEBUG
1110 void InterceptorInfo::InterceptorInfoVerify() { 462 void InterceptorInfo::InterceptorInfoVerify() {
1111 CHECK(IsInterceptorInfo()); 463 CHECK(IsInterceptorInfo());
1112 VerifyPointer(getter()); 464 VerifyPointer(getter());
1113 VerifyPointer(setter()); 465 VerifyPointer(setter());
1114 VerifyPointer(query()); 466 VerifyPointer(query());
1115 VerifyPointer(deleter()); 467 VerifyPointer(deleter());
1116 VerifyPointer(enumerator()); 468 VerifyPointer(enumerator());
1117 VerifyPointer(data()); 469 VerifyPointer(data());
1118 } 470 }
1119 #endif // DEBUG
1120 471
1121 472
1122 #ifdef OBJECT_PRINT
1123 void InterceptorInfo::InterceptorInfoPrint(FILE* out) {
1124 HeapObject::PrintHeader(out, "InterceptorInfo");
1125 PrintF(out, "\n - getter: ");
1126 getter()->ShortPrint(out);
1127 PrintF(out, "\n - setter: ");
1128 setter()->ShortPrint(out);
1129 PrintF(out, "\n - query: ");
1130 query()->ShortPrint(out);
1131 PrintF(out, "\n - deleter: ");
1132 deleter()->ShortPrint(out);
1133 PrintF(out, "\n - enumerator: ");
1134 enumerator()->ShortPrint(out);
1135 PrintF(out, "\n - data: ");
1136 data()->ShortPrint(out);
1137 }
1138 #endif // OBJECT_PRINT
1139
1140
1141 #ifdef DEBUG
1142 void CallHandlerInfo::CallHandlerInfoVerify() { 473 void CallHandlerInfo::CallHandlerInfoVerify() {
1143 CHECK(IsCallHandlerInfo()); 474 CHECK(IsCallHandlerInfo());
1144 VerifyPointer(callback()); 475 VerifyPointer(callback());
1145 VerifyPointer(data()); 476 VerifyPointer(data());
1146 } 477 }
1147 #endif // DEBUG
1148 478
1149 479
1150 #ifdef OBJECT_PRINT
1151 void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) {
1152 HeapObject::PrintHeader(out, "CallHandlerInfo");
1153 PrintF(out, "\n - callback: ");
1154 callback()->ShortPrint(out);
1155 PrintF(out, "\n - data: ");
1156 data()->ShortPrint(out);
1157 PrintF(out, "\n - call_stub_cache: ");
1158 }
1159 #endif // OBJECT_PRINT
1160
1161
1162 #ifdef DEBUG
1163 void TemplateInfo::TemplateInfoVerify() { 480 void TemplateInfo::TemplateInfoVerify() {
1164 VerifyPointer(tag()); 481 VerifyPointer(tag());
1165 VerifyPointer(property_list()); 482 VerifyPointer(property_list());
1166 } 483 }
1167 484
1168 void FunctionTemplateInfo::FunctionTemplateInfoVerify() { 485 void FunctionTemplateInfo::FunctionTemplateInfoVerify() {
1169 CHECK(IsFunctionTemplateInfo()); 486 CHECK(IsFunctionTemplateInfo());
1170 TemplateInfoVerify(); 487 TemplateInfoVerify();
1171 VerifyPointer(serial_number()); 488 VerifyPointer(serial_number());
1172 VerifyPointer(call_code()); 489 VerifyPointer(call_code());
1173 VerifyPointer(property_accessors()); 490 VerifyPointer(property_accessors());
1174 VerifyPointer(prototype_template()); 491 VerifyPointer(prototype_template());
1175 VerifyPointer(parent_template()); 492 VerifyPointer(parent_template());
1176 VerifyPointer(named_property_handler()); 493 VerifyPointer(named_property_handler());
1177 VerifyPointer(indexed_property_handler()); 494 VerifyPointer(indexed_property_handler());
1178 VerifyPointer(instance_template()); 495 VerifyPointer(instance_template());
1179 VerifyPointer(signature()); 496 VerifyPointer(signature());
1180 VerifyPointer(access_check_info()); 497 VerifyPointer(access_check_info());
1181 } 498 }
1182 #endif // DEBUG
1183 499
1184 500
1185 #ifdef OBJECT_PRINT
1186 void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) {
1187 HeapObject::PrintHeader(out, "FunctionTemplateInfo");
1188 PrintF(out, "\n - class name: ");
1189 class_name()->ShortPrint(out);
1190 PrintF(out, "\n - tag: ");
1191 tag()->ShortPrint(out);
1192 PrintF(out, "\n - property_list: ");
1193 property_list()->ShortPrint(out);
1194 PrintF(out, "\n - serial_number: ");
1195 serial_number()->ShortPrint(out);
1196 PrintF(out, "\n - call_code: ");
1197 call_code()->ShortPrint(out);
1198 PrintF(out, "\n - property_accessors: ");
1199 property_accessors()->ShortPrint(out);
1200 PrintF(out, "\n - prototype_template: ");
1201 prototype_template()->ShortPrint(out);
1202 PrintF(out, "\n - parent_template: ");
1203 parent_template()->ShortPrint(out);
1204 PrintF(out, "\n - named_property_handler: ");
1205 named_property_handler()->ShortPrint(out);
1206 PrintF(out, "\n - indexed_property_handler: ");
1207 indexed_property_handler()->ShortPrint(out);
1208 PrintF(out, "\n - instance_template: ");
1209 instance_template()->ShortPrint(out);
1210 PrintF(out, "\n - signature: ");
1211 signature()->ShortPrint(out);
1212 PrintF(out, "\n - access_check_info: ");
1213 access_check_info()->ShortPrint(out);
1214 PrintF(out, "\n - hidden_prototype: %s",
1215 hidden_prototype() ? "true" : "false");
1216 PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false");
1217 PrintF(out, "\n - need_access_check: %s",
1218 needs_access_check() ? "true" : "false");
1219 }
1220 #endif // OBJECT_PRINT
1221
1222
1223 #ifdef DEBUG
1224 void ObjectTemplateInfo::ObjectTemplateInfoVerify() { 501 void ObjectTemplateInfo::ObjectTemplateInfoVerify() {
1225 CHECK(IsObjectTemplateInfo()); 502 CHECK(IsObjectTemplateInfo());
1226 TemplateInfoVerify(); 503 TemplateInfoVerify();
1227 VerifyPointer(constructor()); 504 VerifyPointer(constructor());
1228 VerifyPointer(internal_field_count()); 505 VerifyPointer(internal_field_count());
1229 } 506 }
1230 #endif // DEBUG
1231 507
1232 508
1233 #ifdef OBJECT_PRINT
1234 void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) {
1235 HeapObject::PrintHeader(out, "ObjectTemplateInfo");
1236 PrintF(out, "\n - constructor: ");
1237 constructor()->ShortPrint(out);
1238 PrintF(out, "\n - internal_field_count: ");
1239 internal_field_count()->ShortPrint(out);
1240 }
1241 #endif // OBJECT_PRINT
1242
1243
1244 #ifdef DEBUG
1245 void SignatureInfo::SignatureInfoVerify() { 509 void SignatureInfo::SignatureInfoVerify() {
1246 CHECK(IsSignatureInfo()); 510 CHECK(IsSignatureInfo());
1247 VerifyPointer(receiver()); 511 VerifyPointer(receiver());
1248 VerifyPointer(args()); 512 VerifyPointer(args());
1249 } 513 }
1250 #endif // DEBUG
1251 514
1252 515
1253 #ifdef OBJECT_PRINT
1254 void SignatureInfo::SignatureInfoPrint(FILE* out) {
1255 HeapObject::PrintHeader(out, "SignatureInfo");
1256 PrintF(out, "\n - receiver: ");
1257 receiver()->ShortPrint(out);
1258 PrintF(out, "\n - args: ");
1259 args()->ShortPrint(out);
1260 }
1261 #endif // OBJECT_PRINT
1262
1263
1264 #ifdef DEBUG
1265 void TypeSwitchInfo::TypeSwitchInfoVerify() { 516 void TypeSwitchInfo::TypeSwitchInfoVerify() {
1266 CHECK(IsTypeSwitchInfo()); 517 CHECK(IsTypeSwitchInfo());
1267 VerifyPointer(types()); 518 VerifyPointer(types());
1268 } 519 }
1269 #endif // DEBUG
1270 520
1271 521
1272 #ifdef OBJECT_PRINT
1273 void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) {
1274 HeapObject::PrintHeader(out, "TypeSwitchInfo");
1275 PrintF(out, "\n - types: ");
1276 types()->ShortPrint(out);
1277 }
1278 #endif // OBJECT_PRINT
1279
1280
1281 #ifdef DEBUG
1282 void Script::ScriptVerify() { 522 void Script::ScriptVerify() {
1283 CHECK(IsScript()); 523 CHECK(IsScript());
1284 VerifyPointer(source()); 524 VerifyPointer(source());
1285 VerifyPointer(name()); 525 VerifyPointer(name());
1286 line_offset()->SmiVerify(); 526 line_offset()->SmiVerify();
1287 column_offset()->SmiVerify(); 527 column_offset()->SmiVerify();
1288 VerifyPointer(data()); 528 VerifyPointer(data());
1289 VerifyPointer(wrapper()); 529 VerifyPointer(wrapper());
1290 type()->SmiVerify(); 530 type()->SmiVerify();
1291 VerifyPointer(line_ends()); 531 VerifyPointer(line_ends());
1292 VerifyPointer(id()); 532 VerifyPointer(id());
1293 } 533 }
1294 #endif // DEBUG
1295
1296
1297 #ifdef OBJECT_PRINT
1298 void Script::ScriptPrint(FILE* out) {
1299 HeapObject::PrintHeader(out, "Script");
1300 PrintF(out, "\n - source: ");
1301 source()->ShortPrint(out);
1302 PrintF(out, "\n - name: ");
1303 name()->ShortPrint(out);
1304 PrintF(out, "\n - line_offset: ");
1305 line_offset()->ShortPrint(out);
1306 PrintF(out, "\n - column_offset: ");
1307 column_offset()->ShortPrint(out);
1308 PrintF(out, "\n - type: ");
1309 type()->ShortPrint(out);
1310 PrintF(out, "\n - id: ");
1311 id()->ShortPrint(out);
1312 PrintF(out, "\n - data: ");
1313 data()->ShortPrint(out);
1314 PrintF(out, "\n - context data: ");
1315 context_data()->ShortPrint(out);
1316 PrintF(out, "\n - wrapper: ");
1317 wrapper()->ShortPrint(out);
1318 PrintF(out, "\n - compilation type: ");
1319 compilation_type()->ShortPrint(out);
1320 PrintF(out, "\n - line ends: ");
1321 line_ends()->ShortPrint(out);
1322 PrintF(out, "\n - eval from shared: ");
1323 eval_from_shared()->ShortPrint(out);
1324 PrintF(out, "\n - eval from instructions offset: ");
1325 eval_from_instructions_offset()->ShortPrint(out);
1326 PrintF(out, "\n");
1327 }
1328 #endif // OBJECT_PRINT
1329 534
1330 535
1331 #ifdef ENABLE_DEBUGGER_SUPPORT 536 #ifdef ENABLE_DEBUGGER_SUPPORT
1332 #ifdef DEBUG
1333 void DebugInfo::DebugInfoVerify() { 537 void DebugInfo::DebugInfoVerify() {
1334 CHECK(IsDebugInfo()); 538 CHECK(IsDebugInfo());
1335 VerifyPointer(shared()); 539 VerifyPointer(shared());
1336 VerifyPointer(original_code()); 540 VerifyPointer(original_code());
1337 VerifyPointer(code()); 541 VerifyPointer(code());
1338 VerifyPointer(break_points()); 542 VerifyPointer(break_points());
1339 } 543 }
1340 #endif // DEBUG
1341 544
1342 545
1343 #ifdef OBJECT_PRINT
1344 void DebugInfo::DebugInfoPrint(FILE* out) {
1345 HeapObject::PrintHeader(out, "DebugInfo");
1346 PrintF(out, "\n - shared: ");
1347 shared()->ShortPrint(out);
1348 PrintF(out, "\n - original_code: ");
1349 original_code()->ShortPrint(out);
1350 PrintF(out, "\n - code: ");
1351 code()->ShortPrint(out);
1352 PrintF(out, "\n - break_points: ");
1353 break_points()->Print(out);
1354 }
1355 #endif // OBJECT_PRINT
1356
1357
1358 #ifdef DEBUG
1359 void BreakPointInfo::BreakPointInfoVerify() { 546 void BreakPointInfo::BreakPointInfoVerify() {
1360 CHECK(IsBreakPointInfo()); 547 CHECK(IsBreakPointInfo());
1361 code_position()->SmiVerify(); 548 code_position()->SmiVerify();
1362 source_position()->SmiVerify(); 549 source_position()->SmiVerify();
1363 statement_position()->SmiVerify(); 550 statement_position()->SmiVerify();
1364 VerifyPointer(break_point_objects()); 551 VerifyPointer(break_point_objects());
1365 } 552 }
1366 #endif // DEBUG
1367
1368
1369 #ifdef OBJECT_PRINT
1370 void BreakPointInfo::BreakPointInfoPrint(FILE* out) {
1371 HeapObject::PrintHeader(out, "BreakPointInfo");
1372 PrintF(out, "\n - code_position: %d", code_position()->value());
1373 PrintF(out, "\n - source_position: %d", source_position()->value());
1374 PrintF(out, "\n - statement_position: %d", statement_position()->value());
1375 PrintF(out, "\n - break_point_objects: ");
1376 break_point_objects()->ShortPrint(out);
1377 }
1378 #endif // OBJECT_PRINT
1379 #endif // ENABLE_DEBUGGER_SUPPORT 553 #endif // ENABLE_DEBUGGER_SUPPORT
1380 554
1381 555
1382 #ifdef DEBUG
1383 void JSObject::IncrementSpillStatistics(SpillInformation* info) { 556 void JSObject::IncrementSpillStatistics(SpillInformation* info) {
1384 info->number_of_objects_++; 557 info->number_of_objects_++;
1385 // Named properties 558 // Named properties
1386 if (HasFastProperties()) { 559 if (HasFastProperties()) {
1387 info->number_of_objects_with_fast_properties_++; 560 info->number_of_objects_with_fast_properties_++;
1388 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); 561 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex();
1389 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); 562 info->number_of_fast_unused_fields_ += map()->unused_property_fields();
1390 } else { 563 } else {
1391 StringDictionary* dict = property_dictionary(); 564 StringDictionary* dict = property_dictionary();
1392 info->number_of_slow_used_properties_ += dict->NumberOfElements(); 565 info->number_of_slow_used_properties_ += dict->NumberOfElements();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 PrintF(" - fast elements (#%d): %d (used) %d (unused)\n", 628 PrintF(" - fast elements (#%d): %d (used) %d (unused)\n",
1456 number_of_objects_with_fast_elements_, 629 number_of_objects_with_fast_elements_,
1457 number_of_fast_used_elements_, number_of_fast_unused_elements_); 630 number_of_fast_used_elements_, number_of_fast_unused_elements_);
1458 631
1459 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", 632 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n",
1460 number_of_objects_ - number_of_objects_with_fast_elements_, 633 number_of_objects_ - number_of_objects_with_fast_elements_,
1461 number_of_slow_used_elements_, number_of_slow_unused_elements_); 634 number_of_slow_used_elements_, number_of_slow_unused_elements_);
1462 635
1463 PrintF("\n"); 636 PrintF("\n");
1464 } 637 }
1465 #endif // DEBUG
1466 638
1467 639
1468 #ifdef OBJECT_PRINT
1469 void DescriptorArray::PrintDescriptors(FILE* out) {
1470 PrintF(out, "Descriptor array %d\n", number_of_descriptors());
1471 for (int i = 0; i < number_of_descriptors(); i++) {
1472 PrintF(out, " %d: ", i);
1473 Descriptor desc;
1474 Get(i, &desc);
1475 desc.Print(out);
1476 }
1477 PrintF(out, "\n");
1478 }
1479 #endif // OBJECT_PRINT
1480
1481
1482 #ifdef DEBUG
1483 bool DescriptorArray::IsSortedNoDuplicates() { 640 bool DescriptorArray::IsSortedNoDuplicates() {
1484 String* current_key = NULL; 641 String* current_key = NULL;
1485 uint32_t current = 0; 642 uint32_t current = 0;
1486 for (int i = 0; i < number_of_descriptors(); i++) { 643 for (int i = 0; i < number_of_descriptors(); i++) {
1487 String* key = GetKey(i); 644 String* key = GetKey(i);
1488 if (key == current_key) { 645 if (key == current_key) {
1489 PrintDescriptors(); 646 PrintDescriptors();
1490 return false; 647 return false;
1491 } 648 }
1492 current_key = key; 649 current_key = key;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 ASSERT(e->IsUndefined()); 695 ASSERT(e->IsUndefined());
1539 } 696 }
1540 } 697 }
1541 } 698 }
1542 } 699 }
1543 700
1544 701
1545 #endif // DEBUG 702 #endif // DEBUG
1546 703
1547 } } // namespace v8::internal 704 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698