| OLD | NEW |
| 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 4990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5001 TransitionArray* transitions; | 5001 TransitionArray* transitions; |
| 5002 MaybeObject* maybe_transitions = AddTransition(name, result); | 5002 MaybeObject* maybe_transitions = AddTransition(name, result); |
| 5003 if (!maybe_transitions->To(&transitions)) return maybe_transitions; | 5003 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
| 5004 | 5004 |
| 5005 DescriptorArray* descriptors = instance_descriptors(); | 5005 DescriptorArray* descriptors = instance_descriptors(); |
| 5006 int old_size = descriptors->number_of_descriptors(); | 5006 int old_size = descriptors->number_of_descriptors(); |
| 5007 | 5007 |
| 5008 DescriptorArray* new_descriptors; | 5008 DescriptorArray* new_descriptors; |
| 5009 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); | 5009 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); |
| 5010 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 5010 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
| 5011 FixedArray::WhitenessWitness witness(new_descriptors); | 5011 DescriptorArray::WhitenessWitness witness(new_descriptors); |
| 5012 | 5012 |
| 5013 for (int i = 0; i < old_size; ++i) { | 5013 for (int i = 0; i < old_size; ++i) { |
| 5014 new_descriptors->CopyFrom(i, descriptors, i, witness); | 5014 new_descriptors->CopyFrom(i, descriptors, i, witness); |
| 5015 } | 5015 } |
| 5016 new_descriptors->Append(descriptor, witness, old_size); | 5016 new_descriptors->Append(descriptor, witness, old_size); |
| 5017 | 5017 |
| 5018 // If the source descriptors had an enum cache we copy it. This ensures that | 5018 // If the source descriptors had an enum cache we copy it. This ensures that |
| 5019 // the maps to which we push the new descriptor array back can rely on a | 5019 // the maps to which we push the new descriptor array back can rely on a |
| 5020 // cache always being available once it is set. If the map has more | 5020 // cache always being available once it is set. If the map has more |
| 5021 // enumerated descriptors than available in the original cache, the cache | 5021 // enumerated descriptors than available in the original cache, the cache |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5191 if (flag == INSERT_TRANSITION && | 5191 if (flag == INSERT_TRANSITION && |
| 5192 owns_descriptors() && | 5192 owns_descriptors() && |
| 5193 CanHaveMoreTransitions()) { | 5193 CanHaveMoreTransitions()) { |
| 5194 return ShareDescriptor(descriptor); | 5194 return ShareDescriptor(descriptor); |
| 5195 } | 5195 } |
| 5196 | 5196 |
| 5197 DescriptorArray* new_descriptors; | 5197 DescriptorArray* new_descriptors; |
| 5198 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); | 5198 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); |
| 5199 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 5199 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
| 5200 | 5200 |
| 5201 FixedArray::WhitenessWitness witness(new_descriptors); | 5201 DescriptorArray::WhitenessWitness witness(new_descriptors); |
| 5202 | 5202 |
| 5203 // Copy the descriptors, inserting a descriptor. | 5203 // Copy the descriptors, inserting a descriptor. |
| 5204 for (int i = 0; i < old_size; ++i) { | 5204 for (int i = 0; i < old_size; ++i) { |
| 5205 new_descriptors->CopyFrom(i, descriptors, i, witness); | 5205 new_descriptors->CopyFrom(i, descriptors, i, witness); |
| 5206 } | 5206 } |
| 5207 | 5207 |
| 5208 new_descriptors->Set(old_size, descriptor, witness); | 5208 new_descriptors->Set(old_size, descriptor, witness); |
| 5209 new_descriptors->Sort(); | 5209 new_descriptors->Sort(); |
| 5210 | 5210 |
| 5211 return CopyReplaceDescriptors(new_descriptors, descriptor->GetKey(), flag); | 5211 return CopyReplaceDescriptors(new_descriptors, descriptor->GetKey(), flag); |
| (...skipping 7678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12890 } | 12890 } |
| 12891 | 12891 |
| 12892 // Allocate the instance descriptor. | 12892 // Allocate the instance descriptor. |
| 12893 DescriptorArray* descriptors; | 12893 DescriptorArray* descriptors; |
| 12894 MaybeObject* maybe_descriptors = | 12894 MaybeObject* maybe_descriptors = |
| 12895 DescriptorArray::Allocate(instance_descriptor_length); | 12895 DescriptorArray::Allocate(instance_descriptor_length); |
| 12896 if (!maybe_descriptors->To(&descriptors)) { | 12896 if (!maybe_descriptors->To(&descriptors)) { |
| 12897 return maybe_descriptors; | 12897 return maybe_descriptors; |
| 12898 } | 12898 } |
| 12899 | 12899 |
| 12900 FixedArray::WhitenessWitness witness(descriptors); | 12900 DescriptorArray::WhitenessWitness witness(descriptors); |
| 12901 | 12901 |
| 12902 int number_of_allocated_fields = | 12902 int number_of_allocated_fields = |
| 12903 number_of_fields + unused_property_fields - inobject_props; | 12903 number_of_fields + unused_property_fields - inobject_props; |
| 12904 if (number_of_allocated_fields < 0) { | 12904 if (number_of_allocated_fields < 0) { |
| 12905 // There is enough inobject space for all fields (including unused). | 12905 // There is enough inobject space for all fields (including unused). |
| 12906 number_of_allocated_fields = 0; | 12906 number_of_allocated_fields = 0; |
| 12907 unused_property_fields = inobject_props - number_of_fields; | 12907 unused_property_fields = inobject_props - number_of_fields; |
| 12908 } | 12908 } |
| 12909 | 12909 |
| 12910 // Allocate the fixed array for the fields. | 12910 // Allocate the fixed array for the fields. |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13478 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13478 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 13479 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13479 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 13480 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13480 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 13481 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13481 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 13482 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13482 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 13483 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13483 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 13484 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13484 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 13485 } | 13485 } |
| 13486 | 13486 |
| 13487 } } // namespace v8::internal | 13487 } } // namespace v8::internal |
| OLD | NEW |