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

Side by Side Diff: src/heap.cc

Issue 10692130: Swap bitfield3 and backpointer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: u Created 8 years, 5 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
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 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); 2051 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map());
2052 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); 2052 reinterpret_cast<Map*>(result)->set_instance_type(instance_type);
2053 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); 2053 reinterpret_cast<Map*>(result)->set_instance_size(instance_size);
2054 reinterpret_cast<Map*>(result)->set_visitor_id( 2054 reinterpret_cast<Map*>(result)->set_visitor_id(
2055 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 2055 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2056 reinterpret_cast<Map*>(result)->set_inobject_properties(0); 2056 reinterpret_cast<Map*>(result)->set_inobject_properties(0);
2057 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); 2057 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0);
2058 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); 2058 reinterpret_cast<Map*>(result)->set_unused_property_fields(0);
2059 reinterpret_cast<Map*>(result)->set_bit_field(0); 2059 reinterpret_cast<Map*>(result)->set_bit_field(0);
2060 reinterpret_cast<Map*>(result)->set_bit_field2(0); 2060 reinterpret_cast<Map*>(result)->set_bit_field2(0);
2061 reinterpret_cast<Map*>(result)->set_bit_field3(0);
2061 return result; 2062 return result;
2062 } 2063 }
2063 2064
2064 2065
2065 MaybeObject* Heap::AllocateMap(InstanceType instance_type, 2066 MaybeObject* Heap::AllocateMap(InstanceType instance_type,
2066 int instance_size, 2067 int instance_size,
2067 ElementsKind elements_kind) { 2068 ElementsKind elements_kind) {
2068 Object* result; 2069 Object* result;
2069 { MaybeObject* maybe_result = AllocateRawMap(); 2070 { MaybeObject* maybe_result = AllocateRawMap();
2070 if (!maybe_result->ToObject(&result)) return maybe_result; 2071 if (!maybe_result->ToObject(&result)) return maybe_result;
2071 } 2072 }
2072 2073
2073 Map* map = reinterpret_cast<Map*>(result); 2074 Map* map = reinterpret_cast<Map*>(result);
2074 map->set_map_no_write_barrier(meta_map()); 2075 map->set_map_no_write_barrier(meta_map());
2075 map->set_instance_type(instance_type); 2076 map->set_instance_type(instance_type);
2076 map->set_visitor_id( 2077 map->set_visitor_id(
2077 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 2078 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2078 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); 2079 map->set_prototype(null_value(), SKIP_WRITE_BARRIER);
2079 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); 2080 map->set_constructor(null_value(), SKIP_WRITE_BARRIER);
2080 map->set_instance_size(instance_size); 2081 map->set_instance_size(instance_size);
2081 map->set_inobject_properties(0); 2082 map->set_inobject_properties(0);
2082 map->set_pre_allocated_property_fields(0); 2083 map->set_pre_allocated_property_fields(0);
2083 map->init_instance_descriptors();
2084 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); 2084 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER);
2085 map->init_back_pointer(undefined_value()); 2085 map->init_back_pointer(undefined_value());
2086 map->set_unused_property_fields(0); 2086 map->set_unused_property_fields(0);
2087 map->set_bit_field(0); 2087 map->set_bit_field(0);
2088 map->set_bit_field2(1 << Map::kIsExtensible); 2088 map->set_bit_field2(1 << Map::kIsExtensible);
2089 map->set_bit_field3(0);
2089 map->set_elements_kind(elements_kind); 2090 map->set_elements_kind(elements_kind);
2090 2091
2091 // If the map object is aligned fill the padding area with Smi 0 objects. 2092 // If the map object is aligned fill the padding area with Smi 0 objects.
2092 if (Map::kPadStart < Map::kSize) { 2093 if (Map::kPadStart < Map::kSize) {
2093 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, 2094 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag,
2094 0, 2095 0,
2095 Map::kSize - Map::kPadStart); 2096 Map::kSize - Map::kPadStart);
2096 } 2097 }
2097 return map; 2098 return map;
2098 } 2099 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 Oddball::cast(obj)->set_kind(Oddball::kUndefined); 2213 Oddball::cast(obj)->set_kind(Oddball::kUndefined);
2213 ASSERT(!InNewSpace(undefined_value())); 2214 ASSERT(!InNewSpace(undefined_value()));
2214 2215
2215 // Allocate the empty descriptor array. 2216 // Allocate the empty descriptor array.
2216 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); 2217 { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
2217 if (!maybe_obj->ToObject(&obj)) return false; 2218 if (!maybe_obj->ToObject(&obj)) return false;
2218 } 2219 }
2219 set_empty_descriptor_array(DescriptorArray::cast(obj)); 2220 set_empty_descriptor_array(DescriptorArray::cast(obj));
2220 2221
2221 // Fix the instance_descriptors for the existing maps. 2222 // Fix the instance_descriptors for the existing maps.
2222 meta_map()->init_instance_descriptors();
2223 meta_map()->set_code_cache(empty_fixed_array()); 2223 meta_map()->set_code_cache(empty_fixed_array());
2224 meta_map()->init_back_pointer(undefined_value()); 2224 meta_map()->init_back_pointer(undefined_value());
2225 2225
2226 fixed_array_map()->init_instance_descriptors();
2227 fixed_array_map()->set_code_cache(empty_fixed_array()); 2226 fixed_array_map()->set_code_cache(empty_fixed_array());
2228 fixed_array_map()->init_back_pointer(undefined_value()); 2227 fixed_array_map()->init_back_pointer(undefined_value());
2229 2228
2230 oddball_map()->init_instance_descriptors();
2231 oddball_map()->set_code_cache(empty_fixed_array()); 2229 oddball_map()->set_code_cache(empty_fixed_array());
2232 oddball_map()->init_back_pointer(undefined_value()); 2230 oddball_map()->init_back_pointer(undefined_value());
2233 2231
2234 // Fix prototype object for existing maps. 2232 // Fix prototype object for existing maps.
2235 meta_map()->set_prototype(null_value()); 2233 meta_map()->set_prototype(null_value());
2236 meta_map()->set_constructor(null_value()); 2234 meta_map()->set_constructor(null_value());
2237 2235
2238 fixed_array_map()->set_prototype(null_value()); 2236 fixed_array_map()->set_prototype(null_value());
2239 fixed_array_map()->set_constructor(null_value()); 2237 fixed_array_map()->set_constructor(null_value());
2240 2238
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
4179 InitializeJSObjectFromMap(global, dictionary, map); 4177 InitializeJSObjectFromMap(global, dictionary, map);
4180 4178
4181 // Create a new map for the global object. 4179 // Create a new map for the global object.
4182 { MaybeObject* maybe_obj = map->CopyDropDescriptors(); 4180 { MaybeObject* maybe_obj = map->CopyDropDescriptors();
4183 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 4181 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
4184 } 4182 }
4185 Map* new_map = Map::cast(obj); 4183 Map* new_map = Map::cast(obj);
4186 4184
4187 // Set up the global object as a normalized object. 4185 // Set up the global object as a normalized object.
4188 global->set_map(new_map); 4186 global->set_map(new_map);
4189 global->map()->clear_instance_descriptors();
4190 global->set_properties(dictionary); 4187 global->set_properties(dictionary);
4191 4188
4192 // Make sure result is a global object with properties in dictionary. 4189 // Make sure result is a global object with properties in dictionary.
4193 ASSERT(global->IsGlobalObject()); 4190 ASSERT(global->IsGlobalObject());
4194 ASSERT(!global->HasFastProperties()); 4191 ASSERT(!global->HasFastProperties());
4195 return global; 4192 return global;
4196 } 4193 }
4197 4194
4198 4195
4199 MaybeObject* Heap::CopyJSObject(JSObject* source) { 4196 MaybeObject* Heap::CopyJSObject(JSObject* source) {
(...skipping 3021 matching lines...) Expand 10 before | Expand all | Expand 10 after
7221 } else { 7218 } else {
7222 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. 7219 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died.
7223 } 7220 }
7224 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = 7221 remembered_unmapped_pages_[remembered_unmapped_pages_index_] =
7225 reinterpret_cast<Address>(p); 7222 reinterpret_cast<Address>(p);
7226 remembered_unmapped_pages_index_++; 7223 remembered_unmapped_pages_index_++;
7227 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; 7224 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages;
7228 } 7225 }
7229 7226
7230 } } // namespace v8::internal 7227 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698