OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 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 int real_size = map->NumberOfOwnDescriptors(); | 351 int real_size = map->NumberOfOwnDescriptors(); |
352 DescriptorArray* descs = map->instance_descriptors(); | 352 DescriptorArray* descs = map->instance_descriptors(); |
353 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 353 for (int i = 0; i < real_size; i++) { |
354 PropertyDetails details = descs->GetDetails(i); | 354 PropertyDetails details = descs->GetDetails(i); |
355 if (details.descriptor_index() > real_size) continue; | |
356 if (details.type() == FIELD) { | 355 if (details.type() == FIELD) { |
357 Object* key = descs->GetKey(i); | 356 Object* key = descs->GetKey(i); |
358 if (key->IsString() || key->IsNumber()) { | 357 if (key->IsString() || key->IsNumber()) { |
359 int len = 3; | 358 int len = 3; |
360 if (key->IsString()) { | 359 if (key->IsString()) { |
361 len = String::cast(key)->length(); | 360 len = String::cast(key)->length(); |
362 } | 361 } |
363 for (; len < 18; len++) | 362 for (; len < 18; len++) |
364 Put(' '); | 363 Put(' '); |
365 if (key->IsString()) { | 364 if (key->IsString()) { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 584 |
586 // Only grow once to the maximum allowable size. | 585 // Only grow once to the maximum allowable size. |
587 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 586 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
588 ASSERT(size_ >= *bytes); | 587 ASSERT(size_ >= *bytes); |
589 *bytes = size_; | 588 *bytes = size_; |
590 return space_; | 589 return space_; |
591 } | 590 } |
592 | 591 |
593 | 592 |
594 } } // namespace v8::internal | 593 } } // namespace v8::internal |
OLD | NEW |