| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 void StringStream::PrintUsingMap(JSObject* js_object) { | 343 void StringStream::PrintUsingMap(JSObject* js_object) { |
| 344 Map* map = js_object->map(); | 344 Map* map = js_object->map(); |
| 345 if (!HEAP->Contains(map) || | 345 if (!HEAP->Contains(map) || |
| 346 !map->IsHeapObject() || | 346 !map->IsHeapObject() || |
| 347 !map->IsMap()) { | 347 !map->IsMap()) { |
| 348 Add("<Invalid map>\n"); | 348 Add("<Invalid map>\n"); |
| 349 return; | 349 return; |
| 350 } | 350 } |
| 351 DescriptorArray* descs = map->instance_descriptors(); | 351 DescriptorArray* descs = map->instance_descriptors(); |
| 352 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 352 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| 353 switch (descs->GetType(i)) { | 353 if (descs->GetType(i) == FIELD) { |
| 354 case FIELD: { | 354 Object* key = descs->GetKey(i); |
| 355 Object* key = descs->GetKey(i); | 355 if (key->IsString() || key->IsNumber()) { |
| 356 if (key->IsString() || key->IsNumber()) { | 356 int len = 3; |
| 357 int len = 3; | 357 if (key->IsString()) { |
| 358 if (key->IsString()) { | 358 len = String::cast(key)->length(); |
| 359 len = String::cast(key)->length(); | |
| 360 } | |
| 361 for (; len < 18; len++) | |
| 362 Put(' '); | |
| 363 if (key->IsString()) { | |
| 364 Put(String::cast(key)); | |
| 365 } else { | |
| 366 key->ShortPrint(); | |
| 367 } | |
| 368 Add(": "); | |
| 369 Object* value = js_object->FastPropertyAt(descs->GetFieldIndex(i)); | |
| 370 Add("%o\n", value); | |
| 371 } | 359 } |
| 360 for (; len < 18; len++) |
| 361 Put(' '); |
| 362 if (key->IsString()) { |
| 363 Put(String::cast(key)); |
| 364 } else { |
| 365 key->ShortPrint(); |
| 366 } |
| 367 Add(": "); |
| 368 Object* value = js_object->FastPropertyAt(descs->GetFieldIndex(i)); |
| 369 Add("%o\n", value); |
| 372 } | 370 } |
| 373 break; | |
| 374 default: | |
| 375 break; | |
| 376 } | 371 } |
| 377 } | 372 } |
| 378 } | 373 } |
| 379 | 374 |
| 380 | 375 |
| 381 void StringStream::PrintFixedArray(FixedArray* array, unsigned int limit) { | 376 void StringStream::PrintFixedArray(FixedArray* array, unsigned int limit) { |
| 382 Heap* heap = HEAP; | 377 Heap* heap = HEAP; |
| 383 for (unsigned int i = 0; i < 10 && i < limit; i++) { | 378 for (unsigned int i = 0; i < 10 && i < limit; i++) { |
| 384 Object* element = array->get(i); | 379 Object* element = array->get(i); |
| 385 if (element != heap->the_hole_value()) { | 380 if (element != heap->the_hole_value()) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 580 |
| 586 // Only grow once to the maximum allowable size. | 581 // Only grow once to the maximum allowable size. |
| 587 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 582 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
| 588 ASSERT(size_ >= *bytes); | 583 ASSERT(size_ >= *bytes); |
| 589 *bytes = size_; | 584 *bytes = size_; |
| 590 return space_; | 585 return space_; |
| 591 } | 586 } |
| 592 | 587 |
| 593 | 588 |
| 594 } } // namespace v8::internal | 589 } } // namespace v8::internal |
| OLD | NEW |