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

Side by Side Diff: src/string-stream.cc

Issue 10909007: Sharing of descriptor arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 3 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/runtime.cc ('k') | src/transitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 342
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 DescriptorArray* descs = map->instance_descriptors(); 352 DescriptorArray* descs = map->instance_descriptors();
352 for (int i = 0; i < descs->number_of_descriptors(); i++) { 353 for (int i = 0; i < descs->number_of_descriptors(); i++) {
353 if (descs->GetType(i) == FIELD) { 354 PropertyDetails details = descs->GetDetails(i);
355 if (details.descriptor_index() > real_size) continue;
356 if (details.type() == FIELD) {
354 Object* key = descs->GetKey(i); 357 Object* key = descs->GetKey(i);
355 if (key->IsString() || key->IsNumber()) { 358 if (key->IsString() || key->IsNumber()) {
356 int len = 3; 359 int len = 3;
357 if (key->IsString()) { 360 if (key->IsString()) {
358 len = String::cast(key)->length(); 361 len = String::cast(key)->length();
359 } 362 }
360 for (; len < 18; len++) 363 for (; len < 18; len++)
361 Put(' '); 364 Put(' ');
362 if (key->IsString()) { 365 if (key->IsString()) {
363 Put(String::cast(key)); 366 Put(String::cast(key));
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 583
581 // Only grow once to the maximum allowable size. 584 // Only grow once to the maximum allowable size.
582 char* NoAllocationStringAllocator::grow(unsigned* bytes) { 585 char* NoAllocationStringAllocator::grow(unsigned* bytes) {
583 ASSERT(size_ >= *bytes); 586 ASSERT(size_ >= *bytes);
584 *bytes = size_; 587 *bytes = size_;
585 return space_; 588 return space_;
586 } 589 }
587 590
588 591
589 } } // namespace v8::internal 592 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/transitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698