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

Side by Side Diff: src/heap.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/heap.h ('k') | src/ia32/full-codegen-ia32.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 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); 2057 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map());
2058 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); 2058 reinterpret_cast<Map*>(result)->set_instance_type(instance_type);
2059 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); 2059 reinterpret_cast<Map*>(result)->set_instance_size(instance_size);
2060 reinterpret_cast<Map*>(result)->set_visitor_id( 2060 reinterpret_cast<Map*>(result)->set_visitor_id(
2061 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 2061 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2062 reinterpret_cast<Map*>(result)->set_inobject_properties(0); 2062 reinterpret_cast<Map*>(result)->set_inobject_properties(0);
2063 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); 2063 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0);
2064 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); 2064 reinterpret_cast<Map*>(result)->set_unused_property_fields(0);
2065 reinterpret_cast<Map*>(result)->set_bit_field(0); 2065 reinterpret_cast<Map*>(result)->set_bit_field(0);
2066 reinterpret_cast<Map*>(result)->set_bit_field2(0); 2066 reinterpret_cast<Map*>(result)->set_bit_field2(0);
2067 reinterpret_cast<Map*>(result)->set_bit_field3(0); 2067 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) |
2068 Map::OwnsDescriptors::encode(true);
2069 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3);
2068 return result; 2070 return result;
2069 } 2071 }
2070 2072
2071 2073
2072 MaybeObject* Heap::AllocateMap(InstanceType instance_type, 2074 MaybeObject* Heap::AllocateMap(InstanceType instance_type,
2073 int instance_size, 2075 int instance_size,
2074 ElementsKind elements_kind) { 2076 ElementsKind elements_kind) {
2075 Object* result; 2077 Object* result;
2076 MaybeObject* maybe_result = AllocateRawMap(); 2078 MaybeObject* maybe_result = AllocateRawMap();
2077 if (!maybe_result->To(&result)) return maybe_result; 2079 if (!maybe_result->To(&result)) return maybe_result;
2078 2080
2079 Map* map = reinterpret_cast<Map*>(result); 2081 Map* map = reinterpret_cast<Map*>(result);
2080 map->set_map_no_write_barrier(meta_map()); 2082 map->set_map_no_write_barrier(meta_map());
2081 map->set_instance_type(instance_type); 2083 map->set_instance_type(instance_type);
2082 map->set_visitor_id( 2084 map->set_visitor_id(
2083 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 2085 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2084 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); 2086 map->set_prototype(null_value(), SKIP_WRITE_BARRIER);
2085 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); 2087 map->set_constructor(null_value(), SKIP_WRITE_BARRIER);
2086 map->set_instance_size(instance_size); 2088 map->set_instance_size(instance_size);
2087 map->set_inobject_properties(0); 2089 map->set_inobject_properties(0);
2088 map->set_pre_allocated_property_fields(0); 2090 map->set_pre_allocated_property_fields(0);
2089 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); 2091 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER);
2090 map->init_back_pointer(undefined_value()); 2092 map->init_back_pointer(undefined_value());
2091 map->set_unused_property_fields(0); 2093 map->set_unused_property_fields(0);
2092 map->set_bit_field(0); 2094 map->set_bit_field(0);
2093 map->set_bit_field2(1 << Map::kIsExtensible); 2095 map->set_bit_field2(1 << Map::kIsExtensible);
2094 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache); 2096 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) |
2097 Map::OwnsDescriptors::encode(true);
2095 map->set_bit_field3(bit_field3); 2098 map->set_bit_field3(bit_field3);
2096 map->set_elements_kind(elements_kind); 2099 map->set_elements_kind(elements_kind);
2097 2100
2098 // If the map object is aligned fill the padding area with Smi 0 objects. 2101 // If the map object is aligned fill the padding area with Smi 0 objects.
2099 if (Map::kPadStart < Map::kSize) { 2102 if (Map::kPadStart < Map::kSize) {
2100 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, 2103 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag,
2101 0, 2104 0,
2102 Map::kSize - Map::kPadStart); 2105 Map::kSize - Map::kPadStart);
2103 } 2106 }
2104 return map; 2107 return map;
(...skipping 5017 matching lines...) Expand 10 before | Expand all | Expand 10 after
7122 } 7125 }
7123 } 7126 }
7124 7127
7125 7128
7126 void KeyedLookupCache::Clear() { 7129 void KeyedLookupCache::Clear() {
7127 for (int index = 0; index < kLength; index++) keys_[index].map = NULL; 7130 for (int index = 0; index < kLength; index++) keys_[index].map = NULL;
7128 } 7131 }
7129 7132
7130 7133
7131 void DescriptorLookupCache::Clear() { 7134 void DescriptorLookupCache::Clear() {
7132 for (int index = 0; index < kLength; index++) keys_[index].array = NULL; 7135 for (int index = 0; index < kLength; index++) keys_[index].source = NULL;
7133 } 7136 }
7134 7137
7135 7138
7136 #ifdef DEBUG 7139 #ifdef DEBUG
7137 void Heap::GarbageCollectionGreedyCheck() { 7140 void Heap::GarbageCollectionGreedyCheck() {
7138 ASSERT(FLAG_gc_greedy); 7141 ASSERT(FLAG_gc_greedy);
7139 if (isolate_->bootstrapper()->IsActive()) return; 7142 if (isolate_->bootstrapper()->IsActive()) return;
7140 if (disallow_allocation_failure()) return; 7143 if (disallow_allocation_failure()) return;
7141 CollectGarbage(NEW_SPACE); 7144 CollectGarbage(NEW_SPACE);
7142 } 7145 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
7321 static_cast<int>(object_sizes_last_time_[index])); 7324 static_cast<int>(object_sizes_last_time_[index]));
7322 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7325 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7323 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7326 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7324 7327
7325 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7328 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7326 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7329 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7327 ClearObjectStats(); 7330 ClearObjectStats();
7328 } 7331 }
7329 7332
7330 } } // namespace v8::internal 7333 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698