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

Side by Side Diff: src/heap.cc

Issue 10950023: Use NumberOfOwnDescriptors/EnumLength for counting properties on fast objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | src/objects.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 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 4171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4182 4182
4183 // Initial size of the backing store to avoid resize of the storage during 4183 // Initial size of the backing store to avoid resize of the storage during
4184 // bootstrapping. The size differs between the JS global object ad the 4184 // bootstrapping. The size differs between the JS global object ad the
4185 // builtins object. 4185 // builtins object.
4186 int initial_size = map->instance_type() == JS_GLOBAL_OBJECT_TYPE ? 64 : 512; 4186 int initial_size = map->instance_type() == JS_GLOBAL_OBJECT_TYPE ? 64 : 512;
4187 4187
4188 // Allocate a dictionary object for backing storage. 4188 // Allocate a dictionary object for backing storage.
4189 StringDictionary* dictionary; 4189 StringDictionary* dictionary;
4190 MaybeObject* maybe_dictionary = 4190 MaybeObject* maybe_dictionary =
4191 StringDictionary::Allocate( 4191 StringDictionary::Allocate(
4192 map->NumberOfDescribedProperties() * 2 + initial_size); 4192 map->NumberOfOwnDescriptors() * 2 + initial_size);
4193 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; 4193 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary;
4194 4194
4195 // The global object might be created from an object template with accessors. 4195 // The global object might be created from an object template with accessors.
4196 // Fill these accessors into the dictionary. 4196 // Fill these accessors into the dictionary.
4197 DescriptorArray* descs = map->instance_descriptors(); 4197 DescriptorArray* descs = map->instance_descriptors();
4198 for (int i = 0; i < descs->number_of_descriptors(); i++) { 4198 for (int i = 0; i < descs->number_of_descriptors(); i++) {
4199 PropertyDetails details = descs->GetDetails(i); 4199 PropertyDetails details = descs->GetDetails(i);
4200 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. 4200 ASSERT(details.type() == CALLBACKS); // Only accessors are expected.
4201 PropertyDetails d = PropertyDetails(details.attributes(), 4201 PropertyDetails d = PropertyDetails(details.attributes(),
4202 CALLBACKS, 4202 CALLBACKS,
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after
7320 static_cast<int>(object_sizes_last_time_[index])); 7320 static_cast<int>(object_sizes_last_time_[index]));
7321 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7321 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7322 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7322 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7323 7323
7324 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7324 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7325 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7325 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7326 ClearObjectStats(); 7326 ClearObjectStats();
7327 } 7327 }
7328 7328
7329 } } // namespace v8::internal 7329 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698