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

Side by Side Diff: src/objects.cc

Issue 10833033: Set LastAdded to kNoneAdded in RawCopy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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.cc ('k') | src/objects-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 4787 matching lines...) Expand 10 before | Expand all | Expand 10 after
4798 } 4798 }
4799 return GetHeap()->undefined_value(); 4799 return GetHeap()->undefined_value();
4800 } else { 4800 } else {
4801 return property_dictionary()->SlowReverseLookup(value); 4801 return property_dictionary()->SlowReverseLookup(value);
4802 } 4802 }
4803 } 4803 }
4804 4804
4805 4805
4806 MaybeObject* Map::RawCopy(int instance_size) { 4806 MaybeObject* Map::RawCopy(int instance_size) {
4807 Map* result; 4807 Map* result;
4808 { MaybeObject* maybe_result = 4808 MaybeObject* maybe_result =
4809 GetHeap()->AllocateMap(instance_type(), instance_size); 4809 GetHeap()->AllocateMap(instance_type(), instance_size);
4810 if (!maybe_result->To(&result)) return maybe_result; 4810 if (!maybe_result->To(&result)) return maybe_result;
4811 }
4812 4811
4813 result->set_prototype(prototype()); 4812 result->set_prototype(prototype());
4814 result->set_constructor(constructor()); 4813 result->set_constructor(constructor());
4815 result->set_bit_field(bit_field()); 4814 result->set_bit_field(bit_field());
4816 result->set_bit_field2(bit_field2()); 4815 result->set_bit_field2(bit_field2());
4817 result->set_bit_field3(bit_field3()); 4816 result->set_bit_field3(bit_field3());
4817 result->SetLastAdded(kNoneAdded);
4818 return result; 4818 return result;
4819 } 4819 }
4820 4820
4821 4821
4822 MaybeObject* Map::CopyNormalized(PropertyNormalizationMode mode, 4822 MaybeObject* Map::CopyNormalized(PropertyNormalizationMode mode,
4823 NormalizedMapSharingMode sharing) { 4823 NormalizedMapSharingMode sharing) {
4824 int new_instance_size = instance_size(); 4824 int new_instance_size = instance_size();
4825 if (mode == CLEAR_INOBJECT_PROPERTIES) { 4825 if (mode == CLEAR_INOBJECT_PROPERTIES) {
4826 new_instance_size -= inobject_properties() * kPointerSize; 4826 new_instance_size -= inobject_properties() * kPointerSize;
4827 } 4827 }
4828 4828
4829 Map* result; 4829 Map* result;
4830 MaybeObject* maybe_result = RawCopy(new_instance_size); 4830 MaybeObject* maybe_result = RawCopy(new_instance_size);
4831 if (!maybe_result->To(&result)) return maybe_result; 4831 if (!maybe_result->To(&result)) return maybe_result;
4832 4832
4833 if (mode != CLEAR_INOBJECT_PROPERTIES) { 4833 if (mode != CLEAR_INOBJECT_PROPERTIES) {
4834 result->set_inobject_properties(inobject_properties()); 4834 result->set_inobject_properties(inobject_properties());
4835 } 4835 }
4836 4836
4837 result->SetLastAdded(kNoneAdded);
4838 result->set_code_cache(code_cache()); 4837 result->set_code_cache(code_cache());
4839 result->set_is_shared(sharing == SHARED_NORMALIZED_MAP); 4838 result->set_is_shared(sharing == SHARED_NORMALIZED_MAP);
4840 4839
4841 #ifdef DEBUG 4840 #ifdef DEBUG
4842 if (FLAG_verify_heap && Map::cast(result)->is_shared()) { 4841 if (FLAG_verify_heap && result->is_shared()) {
4843 result->SharedMapVerify(); 4842 result->SharedMapVerify();
4844 } 4843 }
4845 #endif 4844 #endif
4846 4845
4847 return result; 4846 return result;
4848 } 4847 }
4849 4848
4850 4849
4851 MaybeObject* Map::CopyDropDescriptors() { 4850 MaybeObject* Map::CopyDropDescriptors() {
4852 Map* result; 4851 Map* result;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
4931 // array describing these properties. 4930 // array describing these properties.
4932 ASSERT(constructor()->IsJSFunction()); 4931 ASSERT(constructor()->IsJSFunction());
4933 JSFunction* ctor = JSFunction::cast(constructor()); 4932 JSFunction* ctor = JSFunction::cast(constructor());
4934 Map* initial_map = ctor->initial_map(); 4933 Map* initial_map = ctor->initial_map();
4935 DescriptorArray* initial_descriptors = initial_map->instance_descriptors(); 4934 DescriptorArray* initial_descriptors = initial_map->instance_descriptors();
4936 DescriptorArray* descriptors; 4935 DescriptorArray* descriptors;
4937 MaybeObject* maybe_descriptors = 4936 MaybeObject* maybe_descriptors =
4938 initial_descriptors->Copy(DescriptorArray::MAY_BE_SHARED); 4937 initial_descriptors->Copy(DescriptorArray::MAY_BE_SHARED);
4939 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; 4938 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors;
4940 4939
4941 int last_added = initial_descriptors->IsEmpty() 4940 int last_added = initial_map->LastAdded();
4942 ? kNoneAdded
4943 : initial_map->LastAdded();
4944 4941
4945 return CopyReplaceDescriptors(descriptors, NULL, last_added, OMIT_TRANSITION); 4942 return CopyReplaceDescriptors(descriptors, NULL, last_added, OMIT_TRANSITION);
4946 } 4943 }
4947 4944
4948 4945
4949 MaybeObject* Map::Copy(DescriptorArray::SharedMode shared_mode) { 4946 MaybeObject* Map::Copy(DescriptorArray::SharedMode shared_mode) {
4950 DescriptorArray* source_descriptors = instance_descriptors(); 4947 DescriptorArray* source_descriptors = instance_descriptors();
4951 DescriptorArray* descriptors; 4948 DescriptorArray* descriptors;
4952 MaybeObject* maybe_descriptors = source_descriptors->Copy(shared_mode); 4949 MaybeObject* maybe_descriptors = source_descriptors->Copy(shared_mode);
4953 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; 4950 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors;
4954 4951
4955 int last_added = source_descriptors->IsEmpty() ? kNoneAdded : LastAdded(); 4952 int last_added = LastAdded();
4956 4953
4957 return CopyReplaceDescriptors(descriptors, NULL, last_added, OMIT_TRANSITION); 4954 return CopyReplaceDescriptors(descriptors, NULL, last_added, OMIT_TRANSITION);
4958 } 4955 }
4959 4956
4960 4957
4961 static bool InsertionPointFound(String* key1, String* key2) { 4958 static bool InsertionPointFound(String* key1, String* key2) {
4962 return key1->Hash() > key2->Hash() || key1 == key2; 4959 return key1->Hash() > key2->Hash() || key1 == key2;
4963 } 4960 }
4964 4961
4965 4962
(...skipping 8159 matching lines...) Expand 10 before | Expand all | Expand 10 after
13125 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13122 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13126 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13123 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13127 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13124 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13128 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13125 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13129 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13126 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13130 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13127 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13131 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13128 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13132 } 13129 }
13133 13130
13134 } } // namespace v8::internal 13131 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698