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

Side by Side Diff: src/heap.cc

Issue 11188031: Move DescriptorArray into the map (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remove padding area Created 8 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/bootstrapper.cc ('k') | src/heap-inl.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 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 map->set_visitor_id( 2095 map->set_visitor_id(
2096 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 2096 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2097 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); 2097 map->set_prototype(null_value(), SKIP_WRITE_BARRIER);
2098 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); 2098 map->set_constructor(null_value(), SKIP_WRITE_BARRIER);
2099 map->set_instance_size(instance_size); 2099 map->set_instance_size(instance_size);
2100 map->set_inobject_properties(0); 2100 map->set_inobject_properties(0);
2101 map->set_pre_allocated_property_fields(0); 2101 map->set_pre_allocated_property_fields(0);
2102 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); 2102 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER);
2103 map->init_back_pointer(undefined_value()); 2103 map->init_back_pointer(undefined_value());
2104 map->set_unused_property_fields(0); 2104 map->set_unused_property_fields(0);
2105 map->set_instance_descriptors(empty_descriptor_array());
2105 map->set_bit_field(0); 2106 map->set_bit_field(0);
2106 map->set_bit_field2(1 << Map::kIsExtensible); 2107 map->set_bit_field2(1 << Map::kIsExtensible);
2107 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) | 2108 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) |
2108 Map::OwnsDescriptors::encode(true); 2109 Map::OwnsDescriptors::encode(true);
2109 map->set_bit_field3(bit_field3); 2110 map->set_bit_field3(bit_field3);
2110 map->set_elements_kind(elements_kind); 2111 map->set_elements_kind(elements_kind);
2111 2112
2112 // If the map object is aligned fill the padding area with Smi 0 objects.
2113 if (Map::kPadStart < Map::kSize) {
2114 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag,
2115 0,
2116 Map::kSize - Map::kPadStart);
2117 }
2118 return map; 2113 return map;
2119 } 2114 }
2120 2115
2121 2116
2122 MaybeObject* Heap::AllocateCodeCache() { 2117 MaybeObject* Heap::AllocateCodeCache() {
2123 CodeCache* code_cache; 2118 CodeCache* code_cache;
2124 { MaybeObject* maybe_code_cache = AllocateStruct(CODE_CACHE_TYPE); 2119 { MaybeObject* maybe_code_cache = AllocateStruct(CODE_CACHE_TYPE);
2125 if (!maybe_code_cache->To(&code_cache)) return maybe_code_cache; 2120 if (!maybe_code_cache->To(&code_cache)) return maybe_code_cache;
2126 } 2121 }
2127 code_cache->set_default_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); 2122 code_cache->set_default_cache(empty_fixed_array(), SKIP_WRITE_BARRIER);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 2229
2235 // Allocate the empty descriptor array. 2230 // Allocate the empty descriptor array.
2236 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); 2231 { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
2237 if (!maybe_obj->ToObject(&obj)) return false; 2232 if (!maybe_obj->ToObject(&obj)) return false;
2238 } 2233 }
2239 set_empty_descriptor_array(DescriptorArray::cast(obj)); 2234 set_empty_descriptor_array(DescriptorArray::cast(obj));
2240 2235
2241 // Fix the instance_descriptors for the existing maps. 2236 // Fix the instance_descriptors for the existing maps.
2242 meta_map()->set_code_cache(empty_fixed_array()); 2237 meta_map()->set_code_cache(empty_fixed_array());
2243 meta_map()->init_back_pointer(undefined_value()); 2238 meta_map()->init_back_pointer(undefined_value());
2239 meta_map()->set_instance_descriptors(empty_descriptor_array());
2244 2240
2245 fixed_array_map()->set_code_cache(empty_fixed_array()); 2241 fixed_array_map()->set_code_cache(empty_fixed_array());
2246 fixed_array_map()->init_back_pointer(undefined_value()); 2242 fixed_array_map()->init_back_pointer(undefined_value());
2243 fixed_array_map()->set_instance_descriptors(empty_descriptor_array());
2247 2244
2248 oddball_map()->set_code_cache(empty_fixed_array()); 2245 oddball_map()->set_code_cache(empty_fixed_array());
2249 oddball_map()->init_back_pointer(undefined_value()); 2246 oddball_map()->init_back_pointer(undefined_value());
2247 oddball_map()->set_instance_descriptors(empty_descriptor_array());
2250 2248
2251 // Fix prototype object for existing maps. 2249 // Fix prototype object for existing maps.
2252 meta_map()->set_prototype(null_value()); 2250 meta_map()->set_prototype(null_value());
2253 meta_map()->set_constructor(null_value()); 2251 meta_map()->set_constructor(null_value());
2254 2252
2255 fixed_array_map()->set_prototype(null_value()); 2253 fixed_array_map()->set_prototype(null_value());
2256 fixed_array_map()->set_constructor(null_value()); 2254 fixed_array_map()->set_constructor(null_value());
2257 2255
2258 oddball_map()->set_prototype(null_value()); 2256 oddball_map()->set_prototype(null_value());
2259 oddball_map()->set_constructor(null_value()); 2257 oddball_map()->set_constructor(null_value());
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
3949 } 3947 }
3950 descriptors->Sort(); 3948 descriptors->Sort();
3951 3949
3952 // The descriptors may contain duplicates because the compiler does not 3950 // The descriptors may contain duplicates because the compiler does not
3953 // guarantee the uniqueness of property names (it would have required 3951 // guarantee the uniqueness of property names (it would have required
3954 // quadratic time). Once the descriptors are sorted we can check for 3952 // quadratic time). Once the descriptors are sorted we can check for
3955 // duplicates in linear time. 3953 // duplicates in linear time.
3956 if (HasDuplicates(descriptors)) { 3954 if (HasDuplicates(descriptors)) {
3957 fun->shared()->ForbidInlineConstructor(); 3955 fun->shared()->ForbidInlineConstructor();
3958 } else { 3956 } else {
3959 MaybeObject* maybe_failure = map->InitializeDescriptors(descriptors); 3957 map->InitializeDescriptors(descriptors);
3960 if (maybe_failure->IsFailure()) return maybe_failure;
3961 map->set_pre_allocated_property_fields(count); 3958 map->set_pre_allocated_property_fields(count);
3962 map->set_unused_property_fields(in_object_properties - count); 3959 map->set_unused_property_fields(in_object_properties - count);
3963 } 3960 }
3964 } 3961 }
3965 } 3962 }
3966 3963
3967 fun->shared()->StartInobjectSlackTracking(map); 3964 fun->shared()->StartInobjectSlackTracking(map);
3968 3965
3969 return map; 3966 return map;
3970 } 3967 }
(...skipping 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after
7340 static_cast<int>(object_sizes_last_time_[index])); 7337 static_cast<int>(object_sizes_last_time_[index]));
7341 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7338 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7342 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7339 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7343 7340
7344 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7341 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7345 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7342 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7346 ClearObjectStats(); 7343 ClearObjectStats();
7347 } 7344 }
7348 7345
7349 } } // namespace v8::internal 7346 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698