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

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

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 2 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.cc ('k') | src/ostreams.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/disasm.h" 7 #include "src/disasm.h"
8 #include "src/disassembler.h" 8 #include "src/disassembler.h"
9 #include "src/heap/objects-visiting.h" 9 #include "src/heap/objects-visiting.h"
10 #include "src/jsregexp.h" 10 #include "src/jsregexp.h"
11 #include "src/ostreams.h" 11 #include "src/ostreams.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 #ifdef OBJECT_PRINT 16 #ifdef OBJECT_PRINT
17 17
18 void Object::Print() { 18 void Object::Print() {
19 OFStream os(stdout); 19 OFStream os(stdout);
20 this->Print(os); 20 this->Print(os);
21 os << flush; 21 os << std::flush;
22 } 22 }
23 23
24 24
25 void Object::Print(OStream& os) { // NOLINT 25 void Object::Print(std::ostream& os) { // NOLINT
26 if (IsSmi()) { 26 if (IsSmi()) {
27 Smi::cast(this)->SmiPrint(os); 27 Smi::cast(this)->SmiPrint(os);
28 } else { 28 } else {
29 HeapObject::cast(this)->HeapObjectPrint(os); 29 HeapObject::cast(this)->HeapObjectPrint(os);
30 } 30 }
31 } 31 }
32 32
33 33
34 void HeapObject::PrintHeader(OStream& os, const char* id) { // NOLINT 34 void HeapObject::PrintHeader(std::ostream& os, const char* id) { // NOLINT
35 os << "" << reinterpret_cast<void*>(this) << ": [" << id << "]\n"; 35 os << "" << reinterpret_cast<void*>(this) << ": [" << id << "]\n";
36 } 36 }
37 37
38 38
39 void HeapObject::HeapObjectPrint(OStream& os) { // NOLINT 39 void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
40 InstanceType instance_type = map()->instance_type(); 40 InstanceType instance_type = map()->instance_type();
41 41
42 HandleScope scope(GetIsolate()); 42 HandleScope scope(GetIsolate());
43 if (instance_type < FIRST_NONSTRING_TYPE) { 43 if (instance_type < FIRST_NONSTRING_TYPE) {
44 String::cast(this)->StringPrint(os); 44 String::cast(this)->StringPrint(os);
45 return; 45 return;
46 } 46 }
47 47
48 switch (instance_type) { 48 switch (instance_type) {
49 case SYMBOL_TYPE: 49 case SYMBOL_TYPE:
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 #undef MAKE_STRUCT_CASE 186 #undef MAKE_STRUCT_CASE
187 187
188 default: 188 default:
189 os << "UNKNOWN TYPE " << map()->instance_type(); 189 os << "UNKNOWN TYPE " << map()->instance_type();
190 UNREACHABLE(); 190 UNREACHABLE();
191 break; 191 break;
192 } 192 }
193 } 193 }
194 194
195 195
196 void ByteArray::ByteArrayPrint(OStream& os) { // NOLINT 196 void ByteArray::ByteArrayPrint(std::ostream& os) { // NOLINT
197 os << "byte array, data starts at " << GetDataStartAddress(); 197 os << "byte array, data starts at " << GetDataStartAddress();
198 } 198 }
199 199
200 200
201 void FreeSpace::FreeSpacePrint(OStream& os) { // NOLINT 201 void FreeSpace::FreeSpacePrint(std::ostream& os) { // NOLINT
202 os << "free space, size " << Size(); 202 os << "free space, size " << Size();
203 } 203 }
204 204
205 205
206 #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \ 206 #define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
207 void External##Type##Array::External##Type##ArrayPrint(OStream& os) { \ 207 void External##Type##Array::External##Type##ArrayPrint(std::ostream& os) { \
208 os << "external " #type " array"; \ 208 os << "external " #type " array"; \
209 } 209 }
210 210
211 TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER) 211 TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
212 212
213 #undef EXTERNAL_ARRAY_PRINTER 213 #undef EXTERNAL_ARRAY_PRINTER
214 214
215 215
216 template <class Traits> 216 template <class Traits>
217 void FixedTypedArray<Traits>::FixedTypedArrayPrint(OStream& os) { // NOLINT 217 void FixedTypedArray<Traits>::FixedTypedArrayPrint(
218 std::ostream& os) { // NOLINT
218 os << "fixed " << Traits::Designator(); 219 os << "fixed " << Traits::Designator();
219 } 220 }
220 221
221 222
222 void JSObject::PrintProperties(OStream& os) { // NOLINT 223 void JSObject::PrintProperties(std::ostream& os) { // NOLINT
223 if (HasFastProperties()) { 224 if (HasFastProperties()) {
224 DescriptorArray* descs = map()->instance_descriptors(); 225 DescriptorArray* descs = map()->instance_descriptors();
225 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { 226 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
226 os << " "; 227 os << " ";
227 descs->GetKey(i)->NamePrint(os); 228 descs->GetKey(i)->NamePrint(os);
228 os << ": "; 229 os << ": ";
229 switch (descs->GetType(i)) { 230 switch (descs->GetType(i)) {
230 case FIELD: { 231 case FIELD: {
231 FieldIndex index = FieldIndex::ForDescriptor(map(), i); 232 FieldIndex index = FieldIndex::ForDescriptor(map(), i);
232 os << Brief(RawFastPropertyAt(index)) << " (field at offset " 233 os << Brief(RawFastPropertyAt(index)) << " (field at offset "
(...skipping 11 matching lines...) Expand all
244 break; 245 break;
245 } 246 }
246 } 247 }
247 } else { 248 } else {
248 property_dictionary()->Print(os); 249 property_dictionary()->Print(os);
249 } 250 }
250 } 251 }
251 252
252 253
253 template <class T> 254 template <class T>
254 static void DoPrintElements(OStream& os, Object* object) { // NOLINT 255 static void DoPrintElements(std::ostream& os, Object* object) { // NOLINT
255 T* p = T::cast(object); 256 T* p = T::cast(object);
256 for (int i = 0; i < p->length(); i++) { 257 for (int i = 0; i < p->length(); i++) {
257 os << " " << i << ": " << p->get_scalar(i) << "\n"; 258 os << " " << i << ": " << p->get_scalar(i) << "\n";
258 } 259 }
259 } 260 }
260 261
261 262
262 void JSObject::PrintElements(OStream& os) { // NOLINT 263 void JSObject::PrintElements(std::ostream& os) { // NOLINT
263 // Don't call GetElementsKind, its validation code can cause the printer to 264 // Don't call GetElementsKind, its validation code can cause the printer to
264 // fail when debugging. 265 // fail when debugging.
265 switch (map()->elements_kind()) { 266 switch (map()->elements_kind()) {
266 case FAST_HOLEY_SMI_ELEMENTS: 267 case FAST_HOLEY_SMI_ELEMENTS:
267 case FAST_SMI_ELEMENTS: 268 case FAST_SMI_ELEMENTS:
268 case FAST_HOLEY_ELEMENTS: 269 case FAST_HOLEY_ELEMENTS:
269 case FAST_ELEMENTS: { 270 case FAST_ELEMENTS: {
270 // Print in array notation for non-sparse arrays. 271 // Print in array notation for non-sparse arrays.
271 FixedArray* p = FixedArray::cast(elements()); 272 FixedArray* p = FixedArray::cast(elements());
272 for (int i = 0; i < p->length(); i++) { 273 for (int i = 0; i < p->length(); i++) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 os << " " << (i - 2) << ":" << Brief(p->get(i)); 335 os << " " << (i - 2) << ":" << Brief(p->get(i));
335 } 336 }
336 os << "\n context: " << Brief(p->get(0)) 337 os << "\n context: " << Brief(p->get(0))
337 << "\n arguments: " << Brief(p->get(1)) << "\n"; 338 << "\n arguments: " << Brief(p->get(1)) << "\n";
338 break; 339 break;
339 } 340 }
340 } 341 }
341 } 342 }
342 343
343 344
344 void JSObject::PrintTransitions(OStream& os) { // NOLINT 345 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
345 if (!map()->HasTransitionArray()) return; 346 if (!map()->HasTransitionArray()) return;
346 TransitionArray* transitions = map()->transitions(); 347 TransitionArray* transitions = map()->transitions();
347 for (int i = 0; i < transitions->number_of_transitions(); i++) { 348 for (int i = 0; i < transitions->number_of_transitions(); i++) {
348 Name* key = transitions->GetKey(i); 349 Name* key = transitions->GetKey(i);
349 os << " "; 350 os << " ";
350 key->NamePrint(os); 351 key->NamePrint(os);
351 os << ": "; 352 os << ": ";
352 if (key == GetHeap()->frozen_symbol()) { 353 if (key == GetHeap()->frozen_symbol()) {
353 os << " (transition to frozen)\n"; 354 os << " (transition to frozen)\n";
354 } else if (key == GetHeap()->elements_transition_symbol()) { 355 } else if (key == GetHeap()->elements_transition_symbol()) {
(...skipping 17 matching lines...) Expand all
372 // Values below are never in the target descriptor array. 373 // Values below are never in the target descriptor array.
373 case NORMAL: 374 case NORMAL:
374 UNREACHABLE(); 375 UNREACHABLE();
375 break; 376 break;
376 } 377 }
377 } 378 }
378 } 379 }
379 } 380 }
380 381
381 382
382 void JSObject::JSObjectPrint(OStream& os) { // NOLINT 383 void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
383 HeapObject::PrintHeader(os, "JSObject"); 384 HeapObject::PrintHeader(os, "JSObject");
384 // Don't call GetElementsKind, its validation code can cause the printer to 385 // Don't call GetElementsKind, its validation code can cause the printer to
385 // fail when debugging. 386 // fail when debugging.
386 PrototypeIterator iter(GetIsolate(), this); 387 PrototypeIterator iter(GetIsolate(), this);
387 os << " - map = " << reinterpret_cast<void*>(map()) << " [" 388 os << " - map = " << reinterpret_cast<void*>(map()) << " ["
388 << ElementsKindToString(this->map()->elements_kind()) 389 << ElementsKindToString(this->map()->elements_kind())
389 << "]\n - prototype = " << reinterpret_cast<void*>(iter.GetCurrent()) 390 << "]\n - prototype = " << reinterpret_cast<void*>(iter.GetCurrent())
390 << "\n {\n"; 391 << "\n {\n";
391 PrintProperties(os); 392 PrintProperties(os);
392 PrintTransitions(os); 393 PrintTransitions(os);
393 PrintElements(os); 394 PrintElements(os);
394 os << " }\n"; 395 os << " }\n";
395 } 396 }
396 397
397 398
398 void JSModule::JSModulePrint(OStream& os) { // NOLINT 399 void JSModule::JSModulePrint(std::ostream& os) { // NOLINT
399 HeapObject::PrintHeader(os, "JSModule"); 400 HeapObject::PrintHeader(os, "JSModule");
400 os << " - map = " << reinterpret_cast<void*>(map()) << "\n" 401 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"
401 << " - context = "; 402 << " - context = ";
402 context()->Print(os); 403 context()->Print(os);
403 os << " - scope_info = " << Brief(scope_info()) 404 os << " - scope_info = " << Brief(scope_info())
404 << ElementsKindToString(this->map()->elements_kind()) << " {\n"; 405 << ElementsKindToString(this->map()->elements_kind()) << " {\n";
405 PrintProperties(os); 406 PrintProperties(os);
406 PrintElements(os); 407 PrintElements(os);
407 os << " }\n"; 408 os << " }\n";
408 } 409 }
409 410
410 411
411 static const char* TypeToString(InstanceType type) { 412 static const char* TypeToString(InstanceType type) {
412 switch (type) { 413 switch (type) {
413 #define TYPE_TO_STRING(TYPE) case TYPE: return #TYPE; 414 #define TYPE_TO_STRING(TYPE) case TYPE: return #TYPE;
414 INSTANCE_TYPE_LIST(TYPE_TO_STRING) 415 INSTANCE_TYPE_LIST(TYPE_TO_STRING)
415 #undef TYPE_TO_STRING 416 #undef TYPE_TO_STRING
416 } 417 }
417 UNREACHABLE(); 418 UNREACHABLE();
418 return "UNKNOWN"; // Keep the compiler happy. 419 return "UNKNOWN"; // Keep the compiler happy.
419 } 420 }
420 421
421 422
422 void Symbol::SymbolPrint(OStream& os) { // NOLINT 423 void Symbol::SymbolPrint(std::ostream& os) { // NOLINT
423 HeapObject::PrintHeader(os, "Symbol"); 424 HeapObject::PrintHeader(os, "Symbol");
424 os << " - hash: " << Hash(); 425 os << " - hash: " << Hash();
425 os << "\n - name: " << Brief(name()); 426 os << "\n - name: " << Brief(name());
426 os << "\n - private: " << is_private(); 427 os << "\n - private: " << is_private();
427 os << "\n - own: " << is_own(); 428 os << "\n - own: " << is_own();
428 os << "\n"; 429 os << "\n";
429 } 430 }
430 431
431 432
432 void Map::MapPrint(OStream& os) { // NOLINT 433 void Map::MapPrint(std::ostream& os) { // NOLINT
433 HeapObject::PrintHeader(os, "Map"); 434 HeapObject::PrintHeader(os, "Map");
434 os << " - type: " << TypeToString(instance_type()) << "\n"; 435 os << " - type: " << TypeToString(instance_type()) << "\n";
435 os << " - instance size: " << instance_size() << "\n"; 436 os << " - instance size: " << instance_size() << "\n";
436 os << " - inobject properties: " << inobject_properties() << "\n"; 437 os << " - inobject properties: " << inobject_properties() << "\n";
437 os << " - elements kind: " << ElementsKindToString(elements_kind()); 438 os << " - elements kind: " << ElementsKindToString(elements_kind());
438 os << "\n - pre-allocated property fields: " 439 os << "\n - pre-allocated property fields: "
439 << pre_allocated_property_fields() << "\n"; 440 << pre_allocated_property_fields() << "\n";
440 os << " - unused property fields: " << unused_property_fields() << "\n"; 441 os << " - unused property fields: " << unused_property_fields() << "\n";
441 if (is_hidden_prototype()) os << " - hidden_prototype\n"; 442 if (is_hidden_prototype()) os << " - hidden_prototype\n";
442 if (has_named_interceptor()) os << " - named_interceptor\n"; 443 if (has_named_interceptor()) os << " - named_interceptor\n";
(...skipping 14 matching lines...) Expand all
457 os << "\n - transitions: " << Brief(transitions()); 458 os << "\n - transitions: " << Brief(transitions());
458 } 459 }
459 os << "\n - prototype: " << Brief(prototype()); 460 os << "\n - prototype: " << Brief(prototype());
460 os << "\n - constructor: " << Brief(constructor()); 461 os << "\n - constructor: " << Brief(constructor());
461 os << "\n - code cache: " << Brief(code_cache()); 462 os << "\n - code cache: " << Brief(code_cache());
462 os << "\n - dependent code: " << Brief(dependent_code()); 463 os << "\n - dependent code: " << Brief(dependent_code());
463 os << "\n"; 464 os << "\n";
464 } 465 }
465 466
466 467
467 void CodeCache::CodeCachePrint(OStream& os) { // NOLINT 468 void CodeCache::CodeCachePrint(std::ostream& os) { // NOLINT
468 HeapObject::PrintHeader(os, "CodeCache"); 469 HeapObject::PrintHeader(os, "CodeCache");
469 os << "\n - default_cache: " << Brief(default_cache()); 470 os << "\n - default_cache: " << Brief(default_cache());
470 os << "\n - normal_type_cache: " << Brief(normal_type_cache()); 471 os << "\n - normal_type_cache: " << Brief(normal_type_cache());
471 } 472 }
472 473
473 474
474 void PolymorphicCodeCache::PolymorphicCodeCachePrint(OStream& os) { // NOLINT 475 void PolymorphicCodeCache::PolymorphicCodeCachePrint(
476 std::ostream& os) { // NOLINT
475 HeapObject::PrintHeader(os, "PolymorphicCodeCache"); 477 HeapObject::PrintHeader(os, "PolymorphicCodeCache");
476 os << "\n - cache: " << Brief(cache()); 478 os << "\n - cache: " << Brief(cache());
477 } 479 }
478 480
479 481
480 void TypeFeedbackInfo::TypeFeedbackInfoPrint(OStream& os) { // NOLINT 482 void TypeFeedbackInfo::TypeFeedbackInfoPrint(std::ostream& os) { // NOLINT
481 HeapObject::PrintHeader(os, "TypeFeedbackInfo"); 483 HeapObject::PrintHeader(os, "TypeFeedbackInfo");
482 os << " - ic_total_count: " << ic_total_count() 484 os << " - ic_total_count: " << ic_total_count()
483 << ", ic_with_type_info_count: " << ic_with_type_info_count() 485 << ", ic_with_type_info_count: " << ic_with_type_info_count()
484 << ", ic_generic_count: " << ic_generic_count() << "\n"; 486 << ", ic_generic_count: " << ic_generic_count() << "\n";
485 } 487 }
486 488
487 489
488 void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(OStream& os) { // NOLINT 490 void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(
491 std::ostream& os) { // NOLINT
489 HeapObject::PrintHeader(os, "AliasedArgumentsEntry"); 492 HeapObject::PrintHeader(os, "AliasedArgumentsEntry");
490 os << "\n - aliased_context_slot: " << aliased_context_slot(); 493 os << "\n - aliased_context_slot: " << aliased_context_slot();
491 } 494 }
492 495
493 496
494 void FixedArray::FixedArrayPrint(OStream& os) { // NOLINT 497 void FixedArray::FixedArrayPrint(std::ostream& os) { // NOLINT
495 HeapObject::PrintHeader(os, "FixedArray"); 498 HeapObject::PrintHeader(os, "FixedArray");
496 os << " - length: " << length(); 499 os << " - length: " << length();
497 for (int i = 0; i < length(); i++) { 500 for (int i = 0; i < length(); i++) {
498 os << "\n [" << i << "]: " << Brief(get(i)); 501 os << "\n [" << i << "]: " << Brief(get(i));
499 } 502 }
500 os << "\n"; 503 os << "\n";
501 } 504 }
502 505
503 506
504 void FixedDoubleArray::FixedDoubleArrayPrint(OStream& os) { // NOLINT 507 void FixedDoubleArray::FixedDoubleArrayPrint(std::ostream& os) { // NOLINT
505 HeapObject::PrintHeader(os, "FixedDoubleArray"); 508 HeapObject::PrintHeader(os, "FixedDoubleArray");
506 os << " - length: " << length(); 509 os << " - length: " << length();
507 for (int i = 0; i < length(); i++) { 510 for (int i = 0; i < length(); i++) {
508 os << "\n [" << i << "]: "; 511 os << "\n [" << i << "]: ";
509 if (is_the_hole(i)) { 512 if (is_the_hole(i)) {
510 os << "<the hole>"; 513 os << "<the hole>";
511 } else { 514 } else {
512 os << get_scalar(i); 515 os << get_scalar(i);
513 } 516 }
514 } 517 }
515 os << "\n"; 518 os << "\n";
516 } 519 }
517 520
518 521
519 void ConstantPoolArray::ConstantPoolArrayPrint(OStream& os) { // NOLINT 522 void ConstantPoolArray::ConstantPoolArrayPrint(std::ostream& os) { // NOLINT
520 HeapObject::PrintHeader(os, "ConstantPoolArray"); 523 HeapObject::PrintHeader(os, "ConstantPoolArray");
521 os << " - length: " << length(); 524 os << " - length: " << length();
522 for (int i = 0; i <= last_index(INT32, SMALL_SECTION); i++) { 525 for (int i = 0; i <= last_index(INT32, SMALL_SECTION); i++) {
523 if (i < last_index(INT64, SMALL_SECTION)) { 526 if (i < last_index(INT64, SMALL_SECTION)) {
524 os << "\n [" << i << "]: double: " << get_int64_entry_as_double(i); 527 os << "\n [" << i << "]: double: " << get_int64_entry_as_double(i);
525 } else if (i <= last_index(CODE_PTR, SMALL_SECTION)) { 528 } else if (i <= last_index(CODE_PTR, SMALL_SECTION)) {
526 os << "\n [" << i << "]: code target pointer: " 529 os << "\n [" << i << "]: code target pointer: "
527 << reinterpret_cast<void*>(get_code_ptr_entry(i)); 530 << reinterpret_cast<void*>(get_code_ptr_entry(i));
528 } else if (i <= last_index(HEAP_PTR, SMALL_SECTION)) { 531 } else if (i <= last_index(HEAP_PTR, SMALL_SECTION)) {
529 os << "\n [" << i << "]: heap pointer: " 532 os << "\n [" << i << "]: heap pointer: "
(...skipping 16 matching lines...) Expand all
546 << reinterpret_cast<void*>(get_heap_ptr_entry(i)); 549 << reinterpret_cast<void*>(get_heap_ptr_entry(i));
547 } else if (i <= last_index(INT32, EXTENDED_SECTION)) { 550 } else if (i <= last_index(INT32, EXTENDED_SECTION)) {
548 os << "\n [" << i << "]: int32: " << get_int32_entry(i); 551 os << "\n [" << i << "]: int32: " << get_int32_entry(i);
549 } 552 }
550 } 553 }
551 } 554 }
552 os << "\n"; 555 os << "\n";
553 } 556 }
554 557
555 558
556 void JSValue::JSValuePrint(OStream& os) { // NOLINT 559 void JSValue::JSValuePrint(std::ostream& os) { // NOLINT
557 HeapObject::PrintHeader(os, "ValueObject"); 560 HeapObject::PrintHeader(os, "ValueObject");
558 value()->Print(os); 561 value()->Print(os);
559 } 562 }
560 563
561 564
562 void JSMessageObject::JSMessageObjectPrint(OStream& os) { // NOLINT 565 void JSMessageObject::JSMessageObjectPrint(std::ostream& os) { // NOLINT
563 HeapObject::PrintHeader(os, "JSMessageObject"); 566 HeapObject::PrintHeader(os, "JSMessageObject");
564 os << " - type: " << Brief(type()); 567 os << " - type: " << Brief(type());
565 os << "\n - arguments: " << Brief(arguments()); 568 os << "\n - arguments: " << Brief(arguments());
566 os << "\n - start_position: " << start_position(); 569 os << "\n - start_position: " << start_position();
567 os << "\n - end_position: " << end_position(); 570 os << "\n - end_position: " << end_position();
568 os << "\n - script: " << Brief(script()); 571 os << "\n - script: " << Brief(script());
569 os << "\n - stack_frames: " << Brief(stack_frames()); 572 os << "\n - stack_frames: " << Brief(stack_frames());
570 os << "\n"; 573 os << "\n";
571 } 574 }
572 575
573 576
574 void String::StringPrint(OStream& os) { // NOLINT 577 void String::StringPrint(std::ostream& os) { // NOLINT
575 if (StringShape(this).IsInternalized()) { 578 if (StringShape(this).IsInternalized()) {
576 os << "#"; 579 os << "#";
577 } else if (StringShape(this).IsCons()) { 580 } else if (StringShape(this).IsCons()) {
578 os << "c\""; 581 os << "c\"";
579 } else { 582 } else {
580 os << "\""; 583 os << "\"";
581 } 584 }
582 585
583 const char truncated_epilogue[] = "...<truncated>"; 586 const char truncated_epilogue[] = "...<truncated>";
584 int len = length(); 587 int len = length();
585 if (!FLAG_use_verbose_printer) { 588 if (!FLAG_use_verbose_printer) {
586 if (len > 100) { 589 if (len > 100) {
587 len = 100 - sizeof(truncated_epilogue); 590 len = 100 - sizeof(truncated_epilogue);
588 } 591 }
589 } 592 }
590 for (int i = 0; i < len; i++) { 593 for (int i = 0; i < len; i++) {
591 os << AsUC16(Get(i)); 594 os << AsUC16(Get(i));
592 } 595 }
593 if (len != length()) { 596 if (len != length()) {
594 os << truncated_epilogue; 597 os << truncated_epilogue;
595 } 598 }
596 599
597 if (!StringShape(this).IsInternalized()) os << "\""; 600 if (!StringShape(this).IsInternalized()) os << "\"";
598 } 601 }
599 602
600 603
601 void Name::NamePrint(OStream& os) { // NOLINT 604 void Name::NamePrint(std::ostream& os) { // NOLINT
602 if (IsString()) 605 if (IsString())
603 String::cast(this)->StringPrint(os); 606 String::cast(this)->StringPrint(os);
604 else 607 else
605 os << Brief(this); 608 os << Brief(this);
606 } 609 }
607 610
608 611
609 // This method is only meant to be called from gdb for debugging purposes. 612 // This method is only meant to be called from gdb for debugging purposes.
610 // Since the string can also be in two-byte encoding, non-Latin1 characters 613 // Since the string can also be in two-byte encoding, non-Latin1 characters
611 // will be ignored in the output. 614 // will be ignored in the output.
612 char* String::ToAsciiArray() { 615 char* String::ToAsciiArray() {
613 // Static so that subsequent calls frees previously allocated space. 616 // Static so that subsequent calls frees previously allocated space.
614 // This also means that previous results will be overwritten. 617 // This also means that previous results will be overwritten.
615 static char* buffer = NULL; 618 static char* buffer = NULL;
616 if (buffer != NULL) free(buffer); 619 if (buffer != NULL) free(buffer);
617 buffer = new char[length()+1]; 620 buffer = new char[length()+1];
618 WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length()); 621 WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
619 buffer[length()] = 0; 622 buffer[length()] = 0;
620 return buffer; 623 return buffer;
621 } 624 }
622 625
623 626
624 static const char* const weekdays[] = { 627 static const char* const weekdays[] = {
625 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 628 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
626 }; 629 };
627 630
628 631
629 void JSDate::JSDatePrint(OStream& os) { // NOLINT 632 void JSDate::JSDatePrint(std::ostream& os) { // NOLINT
630 HeapObject::PrintHeader(os, "JSDate"); 633 HeapObject::PrintHeader(os, "JSDate");
631 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 634 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
632 os << " - value = "; 635 os << " - value = ";
633 value()->Print(os); 636 value()->Print(os);
634 if (!year()->IsSmi()) { 637 if (!year()->IsSmi()) {
635 os << " - time = NaN\n"; 638 os << " - time = NaN\n";
636 } else { 639 } else {
637 // TODO(svenpanne) Add some basic formatting to our streams. 640 // TODO(svenpanne) Add some basic formatting to our streams.
638 Vector<char> buf = Vector<char>::New(100); 641 Vector<char> buf = Vector<char>::New(100);
639 SNPrintF( 642 SNPrintF(
640 buf, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n", 643 buf, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
641 weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0], 644 weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
642 year()->IsSmi() ? Smi::cast(year())->value() : -1, 645 year()->IsSmi() ? Smi::cast(year())->value() : -1,
643 month()->IsSmi() ? Smi::cast(month())->value() : -1, 646 month()->IsSmi() ? Smi::cast(month())->value() : -1,
644 day()->IsSmi() ? Smi::cast(day())->value() : -1, 647 day()->IsSmi() ? Smi::cast(day())->value() : -1,
645 hour()->IsSmi() ? Smi::cast(hour())->value() : -1, 648 hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
646 min()->IsSmi() ? Smi::cast(min())->value() : -1, 649 min()->IsSmi() ? Smi::cast(min())->value() : -1,
647 sec()->IsSmi() ? Smi::cast(sec())->value() : -1); 650 sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
648 os << buf.start(); 651 os << buf.start();
649 } 652 }
650 } 653 }
651 654
652 655
653 void JSProxy::JSProxyPrint(OStream& os) { // NOLINT 656 void JSProxy::JSProxyPrint(std::ostream& os) { // NOLINT
654 HeapObject::PrintHeader(os, "JSProxy"); 657 HeapObject::PrintHeader(os, "JSProxy");
655 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 658 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
656 os << " - handler = "; 659 os << " - handler = ";
657 handler()->Print(os); 660 handler()->Print(os);
658 os << "\n - hash = "; 661 os << "\n - hash = ";
659 hash()->Print(os); 662 hash()->Print(os);
660 os << "\n"; 663 os << "\n";
661 } 664 }
662 665
663 666
664 void JSFunctionProxy::JSFunctionProxyPrint(OStream& os) { // NOLINT 667 void JSFunctionProxy::JSFunctionProxyPrint(std::ostream& os) { // NOLINT
665 HeapObject::PrintHeader(os, "JSFunctionProxy"); 668 HeapObject::PrintHeader(os, "JSFunctionProxy");
666 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 669 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
667 os << " - handler = "; 670 os << " - handler = ";
668 handler()->Print(os); 671 handler()->Print(os);
669 os << "\n - call_trap = "; 672 os << "\n - call_trap = ";
670 call_trap()->Print(os); 673 call_trap()->Print(os);
671 os << "\n - construct_trap = "; 674 os << "\n - construct_trap = ";
672 construct_trap()->Print(os); 675 construct_trap()->Print(os);
673 os << "\n"; 676 os << "\n";
674 } 677 }
675 678
676 679
677 void JSSet::JSSetPrint(OStream& os) { // NOLINT 680 void JSSet::JSSetPrint(std::ostream& os) { // NOLINT
678 HeapObject::PrintHeader(os, "JSSet"); 681 HeapObject::PrintHeader(os, "JSSet");
679 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 682 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
680 os << " - table = " << Brief(table()); 683 os << " - table = " << Brief(table());
681 os << "\n"; 684 os << "\n";
682 } 685 }
683 686
684 687
685 void JSMap::JSMapPrint(OStream& os) { // NOLINT 688 void JSMap::JSMapPrint(std::ostream& os) { // NOLINT
686 HeapObject::PrintHeader(os, "JSMap"); 689 HeapObject::PrintHeader(os, "JSMap");
687 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 690 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
688 os << " - table = " << Brief(table()); 691 os << " - table = " << Brief(table());
689 os << "\n"; 692 os << "\n";
690 } 693 }
691 694
692 695
693 template <class Derived, class TableType> 696 template <class Derived, class TableType>
694 void OrderedHashTableIterator< 697 void
695 Derived, TableType>::OrderedHashTableIteratorPrint(OStream& os) { // NOLINT 698 OrderedHashTableIterator<Derived, TableType>::OrderedHashTableIteratorPrint(
699 std::ostream& os) { // NOLINT
696 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 700 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
697 os << " - table = " << Brief(table()); 701 os << " - table = " << Brief(table());
698 os << "\n - index = " << Brief(index()); 702 os << "\n - index = " << Brief(index());
699 os << "\n - kind = " << Brief(kind()); 703 os << "\n - kind = " << Brief(kind());
700 os << "\n"; 704 os << "\n";
701 } 705 }
702 706
703 707
704 template void OrderedHashTableIterator< 708 template void OrderedHashTableIterator<
705 JSSetIterator, 709 JSSetIterator,
706 OrderedHashSet>::OrderedHashTableIteratorPrint(OStream& os); // NOLINT 710 OrderedHashSet>::OrderedHashTableIteratorPrint(std::ostream& os); // NOLINT
707 711
708 712
709 template void OrderedHashTableIterator< 713 template void OrderedHashTableIterator<
710 JSMapIterator, 714 JSMapIterator,
711 OrderedHashMap>::OrderedHashTableIteratorPrint(OStream& os); // NOLINT 715 OrderedHashMap>::OrderedHashTableIteratorPrint(std::ostream& os); // NOLINT
712 716
713 717
714 void JSSetIterator::JSSetIteratorPrint(OStream& os) { // NOLINT 718 void JSSetIterator::JSSetIteratorPrint(std::ostream& os) { // NOLINT
715 HeapObject::PrintHeader(os, "JSSetIterator"); 719 HeapObject::PrintHeader(os, "JSSetIterator");
716 OrderedHashTableIteratorPrint(os); 720 OrderedHashTableIteratorPrint(os);
717 } 721 }
718 722
719 723
720 void JSMapIterator::JSMapIteratorPrint(OStream& os) { // NOLINT 724 void JSMapIterator::JSMapIteratorPrint(std::ostream& os) { // NOLINT
721 HeapObject::PrintHeader(os, "JSMapIterator"); 725 HeapObject::PrintHeader(os, "JSMapIterator");
722 OrderedHashTableIteratorPrint(os); 726 OrderedHashTableIteratorPrint(os);
723 } 727 }
724 728
725 729
726 void JSWeakMap::JSWeakMapPrint(OStream& os) { // NOLINT 730 void JSWeakMap::JSWeakMapPrint(std::ostream& os) { // NOLINT
727 HeapObject::PrintHeader(os, "JSWeakMap"); 731 HeapObject::PrintHeader(os, "JSWeakMap");
728 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 732 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
729 os << " - table = " << Brief(table()); 733 os << " - table = " << Brief(table());
730 os << "\n"; 734 os << "\n";
731 } 735 }
732 736
733 737
734 void JSWeakSet::JSWeakSetPrint(OStream& os) { // NOLINT 738 void JSWeakSet::JSWeakSetPrint(std::ostream& os) { // NOLINT
735 HeapObject::PrintHeader(os, "JSWeakSet"); 739 HeapObject::PrintHeader(os, "JSWeakSet");
736 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 740 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
737 os << " - table = " << Brief(table()); 741 os << " - table = " << Brief(table());
738 os << "\n"; 742 os << "\n";
739 } 743 }
740 744
741 745
742 void JSArrayBuffer::JSArrayBufferPrint(OStream& os) { // NOLINT 746 void JSArrayBuffer::JSArrayBufferPrint(std::ostream& os) { // NOLINT
743 HeapObject::PrintHeader(os, "JSArrayBuffer"); 747 HeapObject::PrintHeader(os, "JSArrayBuffer");
744 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 748 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
745 os << " - backing_store = " << backing_store() << "\n"; 749 os << " - backing_store = " << backing_store() << "\n";
746 os << " - byte_length = " << Brief(byte_length()); 750 os << " - byte_length = " << Brief(byte_length());
747 os << "\n"; 751 os << "\n";
748 } 752 }
749 753
750 754
751 void JSTypedArray::JSTypedArrayPrint(OStream& os) { // NOLINT 755 void JSTypedArray::JSTypedArrayPrint(std::ostream& os) { // NOLINT
752 HeapObject::PrintHeader(os, "JSTypedArray"); 756 HeapObject::PrintHeader(os, "JSTypedArray");
753 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 757 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
754 os << " - buffer = " << Brief(buffer()); 758 os << " - buffer = " << Brief(buffer());
755 os << "\n - byte_offset = " << Brief(byte_offset()); 759 os << "\n - byte_offset = " << Brief(byte_offset());
756 os << "\n - byte_length = " << Brief(byte_length()); 760 os << "\n - byte_length = " << Brief(byte_length());
757 os << "\n - length = " << Brief(length()); 761 os << "\n - length = " << Brief(length());
758 os << "\n"; 762 os << "\n";
759 PrintElements(os); 763 PrintElements(os);
760 } 764 }
761 765
762 766
763 void JSDataView::JSDataViewPrint(OStream& os) { // NOLINT 767 void JSDataView::JSDataViewPrint(std::ostream& os) { // NOLINT
764 HeapObject::PrintHeader(os, "JSDataView"); 768 HeapObject::PrintHeader(os, "JSDataView");
765 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 769 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
766 os << " - buffer =" << Brief(buffer()); 770 os << " - buffer =" << Brief(buffer());
767 os << "\n - byte_offset = " << Brief(byte_offset()); 771 os << "\n - byte_offset = " << Brief(byte_offset());
768 os << "\n - byte_length = " << Brief(byte_length()); 772 os << "\n - byte_length = " << Brief(byte_length());
769 os << "\n"; 773 os << "\n";
770 } 774 }
771 775
772 776
773 void JSFunction::JSFunctionPrint(OStream& os) { // NOLINT 777 void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
774 HeapObject::PrintHeader(os, "Function"); 778 HeapObject::PrintHeader(os, "Function");
775 os << " - map = " << reinterpret_cast<void*>(map()) << "\n"; 779 os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
776 os << " - initial_map = "; 780 os << " - initial_map = ";
777 if (has_initial_map()) os << Brief(initial_map()); 781 if (has_initial_map()) os << Brief(initial_map());
778 os << "\n - shared_info = " << Brief(shared()); 782 os << "\n - shared_info = " << Brief(shared());
779 os << "\n - name = " << Brief(shared()->name()); 783 os << "\n - name = " << Brief(shared()->name());
780 os << "\n - context = " << Brief(context()); 784 os << "\n - context = " << Brief(context());
781 if (shared()->bound()) { 785 if (shared()->bound()) {
782 os << "\n - bindings = " << Brief(function_bindings()); 786 os << "\n - bindings = " << Brief(function_bindings());
783 } else { 787 } else {
784 os << "\n - literals = " << Brief(literals()); 788 os << "\n - literals = " << Brief(literals());
785 } 789 }
786 os << "\n - code = " << Brief(code()); 790 os << "\n - code = " << Brief(code());
787 os << "\n"; 791 os << "\n";
788 PrintProperties(os); 792 PrintProperties(os);
789 PrintElements(os); 793 PrintElements(os);
790 os << "\n"; 794 os << "\n";
791 } 795 }
792 796
793 797
794 void SharedFunctionInfo::SharedFunctionInfoPrint(OStream& os) { // NOLINT 798 void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
795 HeapObject::PrintHeader(os, "SharedFunctionInfo"); 799 HeapObject::PrintHeader(os, "SharedFunctionInfo");
796 os << " - name: " << Brief(name()); 800 os << " - name: " << Brief(name());
797 os << "\n - expected_nof_properties: " << expected_nof_properties(); 801 os << "\n - expected_nof_properties: " << expected_nof_properties();
798 os << "\n - ast_node_count: " << ast_node_count(); 802 os << "\n - ast_node_count: " << ast_node_count();
799 os << "\n - instance class name = "; 803 os << "\n - instance class name = ";
800 instance_class_name()->Print(os); 804 instance_class_name()->Print(os);
801 os << "\n - code = " << Brief(code()); 805 os << "\n - code = " << Brief(code());
802 if (HasSourceCode()) { 806 if (HasSourceCode()) {
803 os << "\n - source code = "; 807 os << "\n - source code = ";
804 String* source = String::cast(Script::cast(script())->source()); 808 String* source = String::cast(Script::cast(script())->source());
(...skipping 14 matching lines...) Expand all
819 os << "\n - is expression = " << is_expression(); 823 os << "\n - is expression = " << is_expression();
820 os << "\n - debug info = " << Brief(debug_info()); 824 os << "\n - debug info = " << Brief(debug_info());
821 os << "\n - length = " << length(); 825 os << "\n - length = " << length();
822 os << "\n - optimized_code_map = " << Brief(optimized_code_map()); 826 os << "\n - optimized_code_map = " << Brief(optimized_code_map());
823 os << "\n - feedback_vector = "; 827 os << "\n - feedback_vector = ";
824 feedback_vector()->FixedArrayPrint(os); 828 feedback_vector()->FixedArrayPrint(os);
825 os << "\n"; 829 os << "\n";
826 } 830 }
827 831
828 832
829 void JSGlobalProxy::JSGlobalProxyPrint(OStream& os) { // NOLINT 833 void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) { // NOLINT
830 os << "global_proxy "; 834 os << "global_proxy ";
831 JSObjectPrint(os); 835 JSObjectPrint(os);
832 os << "native context : " << Brief(native_context()); 836 os << "native context : " << Brief(native_context());
833 os << "\n"; 837 os << "\n";
834 } 838 }
835 839
836 840
837 void JSGlobalObject::JSGlobalObjectPrint(OStream& os) { // NOLINT 841 void JSGlobalObject::JSGlobalObjectPrint(std::ostream& os) { // NOLINT
838 os << "global "; 842 os << "global ";
839 JSObjectPrint(os); 843 JSObjectPrint(os);
840 os << "native context : " << Brief(native_context()); 844 os << "native context : " << Brief(native_context());
841 os << "\n"; 845 os << "\n";
842 } 846 }
843 847
844 848
845 void JSBuiltinsObject::JSBuiltinsObjectPrint(OStream& os) { // NOLINT 849 void JSBuiltinsObject::JSBuiltinsObjectPrint(std::ostream& os) { // NOLINT
846 os << "builtins "; 850 os << "builtins ";
847 JSObjectPrint(os); 851 JSObjectPrint(os);
848 } 852 }
849 853
850 854
851 void Cell::CellPrint(OStream& os) { // NOLINT 855 void Cell::CellPrint(std::ostream& os) { // NOLINT
852 HeapObject::PrintHeader(os, "Cell"); 856 HeapObject::PrintHeader(os, "Cell");
853 } 857 }
854 858
855 859
856 void PropertyCell::PropertyCellPrint(OStream& os) { // NOLINT 860 void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT
857 HeapObject::PrintHeader(os, "PropertyCell"); 861 HeapObject::PrintHeader(os, "PropertyCell");
858 } 862 }
859 863
860 864
861 void Code::CodePrint(OStream& os) { // NOLINT 865 void Code::CodePrint(std::ostream& os) { // NOLINT
862 HeapObject::PrintHeader(os, "Code"); 866 HeapObject::PrintHeader(os, "Code");
863 #ifdef ENABLE_DISASSEMBLER 867 #ifdef ENABLE_DISASSEMBLER
864 if (FLAG_use_verbose_printer) { 868 if (FLAG_use_verbose_printer) {
865 Disassemble(NULL, os); 869 Disassemble(NULL, os);
866 } 870 }
867 #endif 871 #endif
868 } 872 }
869 873
870 874
871 void Foreign::ForeignPrint(OStream& os) { // NOLINT 875 void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
872 os << "foreign address : " << foreign_address(); 876 os << "foreign address : " << foreign_address();
873 } 877 }
874 878
875 879
876 void ExecutableAccessorInfo::ExecutableAccessorInfoPrint( 880 void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(
877 OStream& os) { // NOLINT 881 std::ostream& os) { // NOLINT
878 HeapObject::PrintHeader(os, "ExecutableAccessorInfo"); 882 HeapObject::PrintHeader(os, "ExecutableAccessorInfo");
879 os << "\n - name: " << Brief(name()); 883 os << "\n - name: " << Brief(name());
880 os << "\n - flag: " << Brief(flag()); 884 os << "\n - flag: " << Brief(flag());
881 os << "\n - getter: " << Brief(getter()); 885 os << "\n - getter: " << Brief(getter());
882 os << "\n - setter: " << Brief(setter()); 886 os << "\n - setter: " << Brief(setter());
883 os << "\n - data: " << Brief(data()); 887 os << "\n - data: " << Brief(data());
884 os << "\n"; 888 os << "\n";
885 } 889 }
886 890
887 891
888 void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(OStream& os) { // NOLINT 892 void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(
893 std::ostream& os) { // NOLINT
889 HeapObject::PrintHeader(os, "DeclaredAccessorInfo"); 894 HeapObject::PrintHeader(os, "DeclaredAccessorInfo");
890 os << "\n - name: " << Brief(name()); 895 os << "\n - name: " << Brief(name());
891 os << "\n - flag: " << Brief(flag()); 896 os << "\n - flag: " << Brief(flag());
892 os << "\n - descriptor: " << Brief(descriptor()); 897 os << "\n - descriptor: " << Brief(descriptor());
893 os << "\n"; 898 os << "\n";
894 } 899 }
895 900
896 901
897 void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint( 902 void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(
898 OStream& os) { // NOLINT 903 std::ostream& os) { // NOLINT
899 HeapObject::PrintHeader(os, "DeclaredAccessorDescriptor"); 904 HeapObject::PrintHeader(os, "DeclaredAccessorDescriptor");
900 os << "\n - internal field: " << Brief(serialized_data()); 905 os << "\n - internal field: " << Brief(serialized_data());
901 os << "\n"; 906 os << "\n";
902 } 907 }
903 908
904 909
905 void Box::BoxPrint(OStream& os) { // NOLINT 910 void Box::BoxPrint(std::ostream& os) { // NOLINT
906 HeapObject::PrintHeader(os, "Box"); 911 HeapObject::PrintHeader(os, "Box");
907 os << "\n - value: " << Brief(value()); 912 os << "\n - value: " << Brief(value());
908 os << "\n"; 913 os << "\n";
909 } 914 }
910 915
911 916
912 void AccessorPair::AccessorPairPrint(OStream& os) { // NOLINT 917 void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT
913 HeapObject::PrintHeader(os, "AccessorPair"); 918 HeapObject::PrintHeader(os, "AccessorPair");
914 os << "\n - getter: " << Brief(getter()); 919 os << "\n - getter: " << Brief(getter());
915 os << "\n - setter: " << Brief(setter()); 920 os << "\n - setter: " << Brief(setter());
916 os << "\n"; 921 os << "\n";
917 } 922 }
918 923
919 924
920 void AccessCheckInfo::AccessCheckInfoPrint(OStream& os) { // NOLINT 925 void AccessCheckInfo::AccessCheckInfoPrint(std::ostream& os) { // NOLINT
921 HeapObject::PrintHeader(os, "AccessCheckInfo"); 926 HeapObject::PrintHeader(os, "AccessCheckInfo");
922 os << "\n - named_callback: " << Brief(named_callback()); 927 os << "\n - named_callback: " << Brief(named_callback());
923 os << "\n - indexed_callback: " << Brief(indexed_callback()); 928 os << "\n - indexed_callback: " << Brief(indexed_callback());
924 os << "\n - data: " << Brief(data()); 929 os << "\n - data: " << Brief(data());
925 os << "\n"; 930 os << "\n";
926 } 931 }
927 932
928 933
929 void InterceptorInfo::InterceptorInfoPrint(OStream& os) { // NOLINT 934 void InterceptorInfo::InterceptorInfoPrint(std::ostream& os) { // NOLINT
930 HeapObject::PrintHeader(os, "InterceptorInfo"); 935 HeapObject::PrintHeader(os, "InterceptorInfo");
931 os << "\n - getter: " << Brief(getter()); 936 os << "\n - getter: " << Brief(getter());
932 os << "\n - setter: " << Brief(setter()); 937 os << "\n - setter: " << Brief(setter());
933 os << "\n - query: " << Brief(query()); 938 os << "\n - query: " << Brief(query());
934 os << "\n - deleter: " << Brief(deleter()); 939 os << "\n - deleter: " << Brief(deleter());
935 os << "\n - enumerator: " << Brief(enumerator()); 940 os << "\n - enumerator: " << Brief(enumerator());
936 os << "\n - data: " << Brief(data()); 941 os << "\n - data: " << Brief(data());
937 os << "\n"; 942 os << "\n";
938 } 943 }
939 944
940 945
941 void CallHandlerInfo::CallHandlerInfoPrint(OStream& os) { // NOLINT 946 void CallHandlerInfo::CallHandlerInfoPrint(std::ostream& os) { // NOLINT
942 HeapObject::PrintHeader(os, "CallHandlerInfo"); 947 HeapObject::PrintHeader(os, "CallHandlerInfo");
943 os << "\n - callback: " << Brief(callback()); 948 os << "\n - callback: " << Brief(callback());
944 os << "\n - data: " << Brief(data()); 949 os << "\n - data: " << Brief(data());
945 os << "\n"; 950 os << "\n";
946 } 951 }
947 952
948 953
949 void FunctionTemplateInfo::FunctionTemplateInfoPrint(OStream& os) { // NOLINT 954 void FunctionTemplateInfo::FunctionTemplateInfoPrint(
955 std::ostream& os) { // NOLINT
950 HeapObject::PrintHeader(os, "FunctionTemplateInfo"); 956 HeapObject::PrintHeader(os, "FunctionTemplateInfo");
951 os << "\n - class name: " << Brief(class_name()); 957 os << "\n - class name: " << Brief(class_name());
952 os << "\n - tag: " << Brief(tag()); 958 os << "\n - tag: " << Brief(tag());
953 os << "\n - property_list: " << Brief(property_list()); 959 os << "\n - property_list: " << Brief(property_list());
954 os << "\n - serial_number: " << Brief(serial_number()); 960 os << "\n - serial_number: " << Brief(serial_number());
955 os << "\n - call_code: " << Brief(call_code()); 961 os << "\n - call_code: " << Brief(call_code());
956 os << "\n - property_accessors: " << Brief(property_accessors()); 962 os << "\n - property_accessors: " << Brief(property_accessors());
957 os << "\n - prototype_template: " << Brief(prototype_template()); 963 os << "\n - prototype_template: " << Brief(prototype_template());
958 os << "\n - parent_template: " << Brief(parent_template()); 964 os << "\n - parent_template: " << Brief(parent_template());
959 os << "\n - named_property_handler: " << Brief(named_property_handler()); 965 os << "\n - named_property_handler: " << Brief(named_property_handler());
960 os << "\n - indexed_property_handler: " << Brief(indexed_property_handler()); 966 os << "\n - indexed_property_handler: " << Brief(indexed_property_handler());
961 os << "\n - instance_template: " << Brief(instance_template()); 967 os << "\n - instance_template: " << Brief(instance_template());
962 os << "\n - signature: " << Brief(signature()); 968 os << "\n - signature: " << Brief(signature());
963 os << "\n - access_check_info: " << Brief(access_check_info()); 969 os << "\n - access_check_info: " << Brief(access_check_info());
964 os << "\n - hidden_prototype: " << (hidden_prototype() ? "true" : "false"); 970 os << "\n - hidden_prototype: " << (hidden_prototype() ? "true" : "false");
965 os << "\n - undetectable: " << (undetectable() ? "true" : "false"); 971 os << "\n - undetectable: " << (undetectable() ? "true" : "false");
966 os << "\n - need_access_check: " << (needs_access_check() ? "true" : "false"); 972 os << "\n - need_access_check: " << (needs_access_check() ? "true" : "false");
967 os << "\n"; 973 os << "\n";
968 } 974 }
969 975
970 976
971 void ObjectTemplateInfo::ObjectTemplateInfoPrint(OStream& os) { // NOLINT 977 void ObjectTemplateInfo::ObjectTemplateInfoPrint(std::ostream& os) { // NOLINT
972 HeapObject::PrintHeader(os, "ObjectTemplateInfo"); 978 HeapObject::PrintHeader(os, "ObjectTemplateInfo");
973 os << " - tag: " << Brief(tag()); 979 os << " - tag: " << Brief(tag());
974 os << "\n - property_list: " << Brief(property_list()); 980 os << "\n - property_list: " << Brief(property_list());
975 os << "\n - property_accessors: " << Brief(property_accessors()); 981 os << "\n - property_accessors: " << Brief(property_accessors());
976 os << "\n - constructor: " << Brief(constructor()); 982 os << "\n - constructor: " << Brief(constructor());
977 os << "\n - internal_field_count: " << Brief(internal_field_count()); 983 os << "\n - internal_field_count: " << Brief(internal_field_count());
978 os << "\n"; 984 os << "\n";
979 } 985 }
980 986
981 987
982 void SignatureInfo::SignatureInfoPrint(OStream& os) { // NOLINT 988 void SignatureInfo::SignatureInfoPrint(std::ostream& os) { // NOLINT
983 HeapObject::PrintHeader(os, "SignatureInfo"); 989 HeapObject::PrintHeader(os, "SignatureInfo");
984 os << "\n - receiver: " << Brief(receiver()); 990 os << "\n - receiver: " << Brief(receiver());
985 os << "\n - args: " << Brief(args()); 991 os << "\n - args: " << Brief(args());
986 os << "\n"; 992 os << "\n";
987 } 993 }
988 994
989 995
990 void TypeSwitchInfo::TypeSwitchInfoPrint(OStream& os) { // NOLINT 996 void TypeSwitchInfo::TypeSwitchInfoPrint(std::ostream& os) { // NOLINT
991 HeapObject::PrintHeader(os, "TypeSwitchInfo"); 997 HeapObject::PrintHeader(os, "TypeSwitchInfo");
992 os << "\n - types: " << Brief(types()); 998 os << "\n - types: " << Brief(types());
993 os << "\n"; 999 os << "\n";
994 } 1000 }
995 1001
996 1002
997 void AllocationSite::AllocationSitePrint(OStream& os) { // NOLINT 1003 void AllocationSite::AllocationSitePrint(std::ostream& os) { // NOLINT
998 HeapObject::PrintHeader(os, "AllocationSite"); 1004 HeapObject::PrintHeader(os, "AllocationSite");
999 os << " - weak_next: " << Brief(weak_next()); 1005 os << " - weak_next: " << Brief(weak_next());
1000 os << "\n - dependent code: " << Brief(dependent_code()); 1006 os << "\n - dependent code: " << Brief(dependent_code());
1001 os << "\n - nested site: " << Brief(nested_site()); 1007 os << "\n - nested site: " << Brief(nested_site());
1002 os << "\n - memento found count: " 1008 os << "\n - memento found count: "
1003 << Brief(Smi::FromInt(memento_found_count())); 1009 << Brief(Smi::FromInt(memento_found_count()));
1004 os << "\n - memento create count: " 1010 os << "\n - memento create count: "
1005 << Brief(Smi::FromInt(memento_create_count())); 1011 << Brief(Smi::FromInt(memento_create_count()));
1006 os << "\n - pretenure decision: " 1012 os << "\n - pretenure decision: "
1007 << Brief(Smi::FromInt(pretenure_decision())); 1013 << Brief(Smi::FromInt(pretenure_decision()));
1008 os << "\n - transition_info: "; 1014 os << "\n - transition_info: ";
1009 if (transition_info()->IsSmi()) { 1015 if (transition_info()->IsSmi()) {
1010 ElementsKind kind = GetElementsKind(); 1016 ElementsKind kind = GetElementsKind();
1011 os << "Array allocation with ElementsKind " << ElementsKindToString(kind); 1017 os << "Array allocation with ElementsKind " << ElementsKindToString(kind);
1012 } else if (transition_info()->IsJSArray()) { 1018 } else if (transition_info()->IsJSArray()) {
1013 os << "Array literal " << Brief(transition_info()); 1019 os << "Array literal " << Brief(transition_info());
1014 } else { 1020 } else {
1015 os << "unknown transition_info" << Brief(transition_info()); 1021 os << "unknown transition_info" << Brief(transition_info());
1016 } 1022 }
1017 os << "\n"; 1023 os << "\n";
1018 } 1024 }
1019 1025
1020 1026
1021 void AllocationMemento::AllocationMementoPrint(OStream& os) { // NOLINT 1027 void AllocationMemento::AllocationMementoPrint(std::ostream& os) { // NOLINT
1022 HeapObject::PrintHeader(os, "AllocationMemento"); 1028 HeapObject::PrintHeader(os, "AllocationMemento");
1023 os << " - allocation site: "; 1029 os << " - allocation site: ";
1024 if (IsValid()) { 1030 if (IsValid()) {
1025 GetAllocationSite()->Print(os); 1031 GetAllocationSite()->Print(os);
1026 } else { 1032 } else {
1027 os << "<invalid>\n"; 1033 os << "<invalid>\n";
1028 } 1034 }
1029 } 1035 }
1030 1036
1031 1037
1032 void Script::ScriptPrint(OStream& os) { // NOLINT 1038 void Script::ScriptPrint(std::ostream& os) { // NOLINT
1033 HeapObject::PrintHeader(os, "Script"); 1039 HeapObject::PrintHeader(os, "Script");
1034 os << "\n - source: " << Brief(source()); 1040 os << "\n - source: " << Brief(source());
1035 os << "\n - name: " << Brief(name()); 1041 os << "\n - name: " << Brief(name());
1036 os << "\n - line_offset: " << Brief(line_offset()); 1042 os << "\n - line_offset: " << Brief(line_offset());
1037 os << "\n - column_offset: " << Brief(column_offset()); 1043 os << "\n - column_offset: " << Brief(column_offset());
1038 os << "\n - type: " << Brief(type()); 1044 os << "\n - type: " << Brief(type());
1039 os << "\n - id: " << Brief(id()); 1045 os << "\n - id: " << Brief(id());
1040 os << "\n - context data: " << Brief(context_data()); 1046 os << "\n - context data: " << Brief(context_data());
1041 os << "\n - wrapper: " << Brief(wrapper()); 1047 os << "\n - wrapper: " << Brief(wrapper());
1042 os << "\n - compilation type: " << compilation_type(); 1048 os << "\n - compilation type: " << compilation_type();
1043 os << "\n - line ends: " << Brief(line_ends()); 1049 os << "\n - line ends: " << Brief(line_ends());
1044 os << "\n - eval from shared: " << Brief(eval_from_shared()); 1050 os << "\n - eval from shared: " << Brief(eval_from_shared());
1045 os << "\n - eval from instructions offset: " 1051 os << "\n - eval from instructions offset: "
1046 << Brief(eval_from_instructions_offset()); 1052 << Brief(eval_from_instructions_offset());
1047 os << "\n"; 1053 os << "\n";
1048 } 1054 }
1049 1055
1050 1056
1051 void DebugInfo::DebugInfoPrint(OStream& os) { // NOLINT 1057 void DebugInfo::DebugInfoPrint(std::ostream& os) { // NOLINT
1052 HeapObject::PrintHeader(os, "DebugInfo"); 1058 HeapObject::PrintHeader(os, "DebugInfo");
1053 os << "\n - shared: " << Brief(shared()); 1059 os << "\n - shared: " << Brief(shared());
1054 os << "\n - original_code: " << Brief(original_code()); 1060 os << "\n - original_code: " << Brief(original_code());
1055 os << "\n - code: " << Brief(code()); 1061 os << "\n - code: " << Brief(code());
1056 os << "\n - break_points: "; 1062 os << "\n - break_points: ";
1057 break_points()->Print(os); 1063 break_points()->Print(os);
1058 } 1064 }
1059 1065
1060 1066
1061 void BreakPointInfo::BreakPointInfoPrint(OStream& os) { // NOLINT 1067 void BreakPointInfo::BreakPointInfoPrint(std::ostream& os) { // NOLINT
1062 HeapObject::PrintHeader(os, "BreakPointInfo"); 1068 HeapObject::PrintHeader(os, "BreakPointInfo");
1063 os << "\n - code_position: " << code_position()->value(); 1069 os << "\n - code_position: " << code_position()->value();
1064 os << "\n - source_position: " << source_position()->value(); 1070 os << "\n - source_position: " << source_position()->value();
1065 os << "\n - statement_position: " << statement_position()->value(); 1071 os << "\n - statement_position: " << statement_position()->value();
1066 os << "\n - break_point_objects: " << Brief(break_point_objects()); 1072 os << "\n - break_point_objects: " << Brief(break_point_objects());
1067 os << "\n"; 1073 os << "\n";
1068 } 1074 }
1069 1075
1070 1076
1071 void DescriptorArray::PrintDescriptors(OStream& os) { // NOLINT 1077 void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
1072 os << "Descriptor array " << number_of_descriptors() << "\n"; 1078 os << "Descriptor array " << number_of_descriptors() << "\n";
1073 for (int i = 0; i < number_of_descriptors(); i++) { 1079 for (int i = 0; i < number_of_descriptors(); i++) {
1074 Descriptor desc; 1080 Descriptor desc;
1075 Get(i, &desc); 1081 Get(i, &desc);
1076 os << " " << i << ": " << desc; 1082 os << " " << i << ": " << desc;
1077 } 1083 }
1078 os << "\n"; 1084 os << "\n";
1079 } 1085 }
1080 1086
1081 1087
1082 void TransitionArray::PrintTransitions(OStream& os) { // NOLINT 1088 void TransitionArray::PrintTransitions(std::ostream& os) { // NOLINT
1083 os << "Transition array %d\n", number_of_transitions(); 1089 os << "Transition array %d\n", number_of_transitions();
1084 for (int i = 0; i < number_of_transitions(); i++) { 1090 for (int i = 0; i < number_of_transitions(); i++) {
1085 os << " " << i << ": "; 1091 os << " " << i << ": ";
1086 GetKey(i)->NamePrint(os); 1092 GetKey(i)->NamePrint(os);
1087 os << ": "; 1093 os << ": ";
1088 switch (GetTargetDetails(i).type()) { 1094 switch (GetTargetDetails(i).type()) {
1089 case FIELD: { 1095 case FIELD: {
1090 os << " (transition to field)\n"; 1096 os << " (transition to field)\n";
1091 break; 1097 break;
1092 } 1098 }
(...skipping 10 matching lines...) Expand all
1103 } 1109 }
1104 } 1110 }
1105 os << "\n"; 1111 os << "\n";
1106 } 1112 }
1107 1113
1108 1114
1109 #endif // OBJECT_PRINT 1115 #endif // OBJECT_PRINT
1110 1116
1111 1117
1112 } } // namespace v8::internal 1118 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/ostreams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698