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

Side by Side Diff: src/objects.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 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3392 int new_instance_size = new_map->instance_size(); 3392 int new_instance_size = new_map->instance_size();
3393 int instance_size_delta = map_of_this->instance_size() - new_instance_size; 3393 int instance_size_delta = map_of_this->instance_size() - new_instance_size;
3394 ASSERT(instance_size_delta >= 0); 3394 ASSERT(instance_size_delta >= 0);
3395 current_heap->CreateFillerObjectAt(this->address() + new_instance_size, 3395 current_heap->CreateFillerObjectAt(this->address() + new_instance_size,
3396 instance_size_delta); 3396 instance_size_delta);
3397 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { 3397 if (Marking::IsBlack(Marking::MarkBitFrom(this))) {
3398 MemoryChunk::IncrementLiveBytesFromMutator(this->address(), 3398 MemoryChunk::IncrementLiveBytesFromMutator(this->address(),
3399 -instance_size_delta); 3399 -instance_size_delta);
3400 } 3400 }
3401 3401
3402
3403 set_map(new_map); 3402 set_map(new_map);
3404 new_map->clear_instance_descriptors();
3405 3403
3406 set_properties(dictionary); 3404 set_properties(dictionary);
3407 3405
3408 current_heap->isolate()->counters()->props_to_dictionary()->Increment(); 3406 current_heap->isolate()->counters()->props_to_dictionary()->Increment();
3409 3407
3410 #ifdef DEBUG 3408 #ifdef DEBUG
3411 if (FLAG_trace_normalization) { 3409 if (FLAG_trace_normalization) {
3412 PrintF("Object properties have been normalized:\n"); 3410 PrintF("Object properties have been normalized:\n");
3413 Print(); 3411 Print();
3414 } 3412 }
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
4908 4906
4909 MaybeObject* Map::CopyDropDescriptors() { 4907 MaybeObject* Map::CopyDropDescriptors() {
4910 Heap* heap = GetHeap(); 4908 Heap* heap = GetHeap();
4911 Object* result; 4909 Object* result;
4912 { MaybeObject* maybe_result = 4910 { MaybeObject* maybe_result =
4913 heap->AllocateMap(instance_type(), instance_size()); 4911 heap->AllocateMap(instance_type(), instance_size());
4914 if (!maybe_result->ToObject(&result)) return maybe_result; 4912 if (!maybe_result->ToObject(&result)) return maybe_result;
4915 } 4913 }
4916 Map::cast(result)->set_prototype(prototype()); 4914 Map::cast(result)->set_prototype(prototype());
4917 Map::cast(result)->set_constructor(constructor()); 4915 Map::cast(result)->set_constructor(constructor());
4918 // Don't copy descriptors, so map transitions always remain a forest. 4916
4919 // If we retained the same descriptors we would have two maps
4920 // pointing to the same transition which is bad because the garbage
4921 // collector relies on being able to reverse pointers from transitions
4922 // to maps. If properties need to be retained use CopyDropTransitions.
4923 Map::cast(result)->clear_instance_descriptors();
4924 // Please note instance_type and instance_size are set when allocated. 4917 // Please note instance_type and instance_size are set when allocated.
4925 Map::cast(result)->set_inobject_properties(inobject_properties()); 4918 Map::cast(result)->set_inobject_properties(inobject_properties());
4926 Map::cast(result)->set_unused_property_fields(unused_property_fields()); 4919 Map::cast(result)->set_unused_property_fields(unused_property_fields());
4927 4920
4928 // If the map has pre-allocated properties always start out with a descriptor 4921 // If the map has pre-allocated properties always start out with a descriptor
4929 // array describing these properties. 4922 // array describing these properties.
4930 if (pre_allocated_property_fields() > 0) { 4923 if (pre_allocated_property_fields() > 0) {
4931 ASSERT(constructor()->IsJSFunction()); 4924 ASSERT(constructor()->IsJSFunction());
4932 JSFunction* ctor = JSFunction::cast(constructor()); 4925 JSFunction* ctor = JSFunction::cast(constructor());
4933 Object* descriptors; 4926 Object* descriptors;
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
5805 FixedArray* result; 5798 FixedArray* result;
5806 if (number_of_descriptors == 0 && shared_mode == MAY_BE_SHARED) { 5799 if (number_of_descriptors == 0 && shared_mode == MAY_BE_SHARED) {
5807 return heap->empty_descriptor_array(); 5800 return heap->empty_descriptor_array();
5808 } 5801 }
5809 // Allocate the array of keys. 5802 // Allocate the array of keys.
5810 { MaybeObject* maybe_array = 5803 { MaybeObject* maybe_array =
5811 heap->AllocateFixedArray(ToKeyIndex(number_of_descriptors)); 5804 heap->AllocateFixedArray(ToKeyIndex(number_of_descriptors));
5812 if (!maybe_array->To(&result)) return maybe_array; 5805 if (!maybe_array->To(&result)) return maybe_array;
5813 } 5806 }
5814 5807
5815 result->set(kBitField3StorageIndex, Smi::FromInt(0));
5816 result->set(kEnumerationIndexIndex, 5808 result->set(kEnumerationIndexIndex,
5817 Smi::FromInt(PropertyDetails::kInitialIndex)); 5809 Smi::FromInt(PropertyDetails::kInitialIndex));
5818 result->set(kTransitionsIndex, Smi::FromInt(0)); 5810 result->set(kTransitionsIndex, Smi::FromInt(0));
5819 return result; 5811 return result;
5820 } 5812 }
5821 5813
5822 5814
5823 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage, 5815 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage,
5824 FixedArray* new_cache, 5816 FixedArray* new_cache,
5825 Object* new_index_cache) { 5817 Object* new_index_cache) {
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
7393 // TODO(verwaest) Should be an assert, otherwise back pointers are not 7385 // TODO(verwaest) Should be an assert, otherwise back pointers are not
7394 // properly cleared. 7386 // properly cleared.
7395 if (transition_index == t->number_of_transitions()) return; 7387 if (transition_index == t->number_of_transitions()) return;
7396 } 7388 }
7397 7389
7398 // If the final transition array does not contain any live transitions, remove 7390 // If the final transition array does not contain any live transitions, remove
7399 // the transition array from the map. 7391 // the transition array from the map.
7400 if (transition_index == 0 && 7392 if (transition_index == 0 &&
7401 !t->HasElementsTransition() && 7393 !t->HasElementsTransition() &&
7402 !t->HasPrototypeTransitions()) { 7394 !t->HasPrototypeTransitions()) {
7403 return ClearTransitions(); 7395 return ClearTransitions(heap);
7404 } 7396 }
7405 7397
7406 int trim = t->number_of_transitions() - transition_index; 7398 int trim = t->number_of_transitions() - transition_index;
7407 if (trim > 0) { 7399 if (trim > 0) {
7408 RightTrimFixedArray(heap, t, trim * TransitionArray::kTransitionSize); 7400 RightTrimFixedArray(heap, t, trim * TransitionArray::kTransitionSize);
7409 } 7401 }
7410 } 7402 }
7411 7403
7412 7404
7413 int Map::Hash() { 7405 int Map::Hash() {
(...skipping 5845 matching lines...) Expand 10 before | Expand all | Expand 10 after
13259 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13251 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13260 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13252 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13261 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13253 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13262 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13254 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13263 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13255 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13264 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13256 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13265 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13257 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13266 } 13258 }
13267 13259
13268 } } // namespace v8::internal 13260 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698