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 5004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5015 TransitionArray* transitions; | 5015 TransitionArray* transitions; |
5016 MaybeObject* maybe_transitions = AddTransition(name, result); | 5016 MaybeObject* maybe_transitions = AddTransition(name, result); |
5017 if (!maybe_transitions->To(&transitions)) return maybe_transitions; | 5017 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
5018 | 5018 |
5019 DescriptorArray* descriptors = instance_descriptors(); | 5019 DescriptorArray* descriptors = instance_descriptors(); |
5020 int old_size = descriptors->number_of_descriptors(); | 5020 int old_size = descriptors->number_of_descriptors(); |
5021 | 5021 |
5022 DescriptorArray* new_descriptors; | 5022 DescriptorArray* new_descriptors; |
5023 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); | 5023 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); |
5024 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 5024 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
5025 FixedArray::WhitenessWitness witness(new_descriptors); | 5025 DescriptorArray::WhitenessWitness witness(new_descriptors); |
5026 | 5026 |
5027 for (int i = 0; i < old_size; ++i) { | 5027 for (int i = 0; i < old_size; ++i) { |
5028 new_descriptors->CopyFrom(i, descriptors, i, witness); | 5028 new_descriptors->CopyFrom(i, descriptors, i, witness); |
5029 } | 5029 } |
5030 new_descriptors->Append(descriptor, witness, old_size); | 5030 new_descriptors->Append(descriptor, witness, old_size); |
5031 | 5031 |
5032 // If the source descriptors had an enum cache we copy it. This ensures that | 5032 // If the source descriptors had an enum cache we copy it. This ensures that |
5033 // the maps to which we push the new descriptor array back can rely on a | 5033 // the maps to which we push the new descriptor array back can rely on a |
5034 // cache always being available once it is set. If the map has more | 5034 // cache always being available once it is set. If the map has more |
5035 // enumerated descriptors than available in the original cache, the cache | 5035 // enumerated descriptors than available in the original cache, the cache |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5205 if (flag == INSERT_TRANSITION && | 5205 if (flag == INSERT_TRANSITION && |
5206 owns_descriptors() && | 5206 owns_descriptors() && |
5207 CanHaveMoreTransitions()) { | 5207 CanHaveMoreTransitions()) { |
5208 return ShareDescriptor(descriptor); | 5208 return ShareDescriptor(descriptor); |
5209 } | 5209 } |
5210 | 5210 |
5211 DescriptorArray* new_descriptors; | 5211 DescriptorArray* new_descriptors; |
5212 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); | 5212 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size + 1); |
5213 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 5213 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
5214 | 5214 |
5215 FixedArray::WhitenessWitness witness(new_descriptors); | 5215 DescriptorArray::WhitenessWitness witness(new_descriptors); |
5216 | 5216 |
5217 // Copy the descriptors, inserting a descriptor. | 5217 // Copy the descriptors, inserting a descriptor. |
5218 for (int i = 0; i < old_size; ++i) { | 5218 for (int i = 0; i < old_size; ++i) { |
5219 new_descriptors->CopyFrom(i, descriptors, i, witness); | 5219 new_descriptors->CopyFrom(i, descriptors, i, witness); |
5220 } | 5220 } |
5221 | 5221 |
5222 new_descriptors->Set(old_size, descriptor, witness); | 5222 new_descriptors->Set(old_size, descriptor, witness); |
5223 new_descriptors->Sort(); | 5223 new_descriptors->Sort(); |
5224 | 5224 |
5225 return CopyReplaceDescriptors(new_descriptors, descriptor->GetKey(), flag); | 5225 return CopyReplaceDescriptors(new_descriptors, descriptor->GetKey(), flag); |
(...skipping 7678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12904 } | 12904 } |
12905 | 12905 |
12906 // Allocate the instance descriptor. | 12906 // Allocate the instance descriptor. |
12907 DescriptorArray* descriptors; | 12907 DescriptorArray* descriptors; |
12908 MaybeObject* maybe_descriptors = | 12908 MaybeObject* maybe_descriptors = |
12909 DescriptorArray::Allocate(instance_descriptor_length); | 12909 DescriptorArray::Allocate(instance_descriptor_length); |
12910 if (!maybe_descriptors->To(&descriptors)) { | 12910 if (!maybe_descriptors->To(&descriptors)) { |
12911 return maybe_descriptors; | 12911 return maybe_descriptors; |
12912 } | 12912 } |
12913 | 12913 |
12914 FixedArray::WhitenessWitness witness(descriptors); | 12914 DescriptorArray::WhitenessWitness witness(descriptors); |
12915 | 12915 |
12916 int number_of_allocated_fields = | 12916 int number_of_allocated_fields = |
12917 number_of_fields + unused_property_fields - inobject_props; | 12917 number_of_fields + unused_property_fields - inobject_props; |
12918 if (number_of_allocated_fields < 0) { | 12918 if (number_of_allocated_fields < 0) { |
12919 // There is enough inobject space for all fields (including unused). | 12919 // There is enough inobject space for all fields (including unused). |
12920 number_of_allocated_fields = 0; | 12920 number_of_allocated_fields = 0; |
12921 unused_property_fields = inobject_props - number_of_fields; | 12921 unused_property_fields = inobject_props - number_of_fields; |
12922 } | 12922 } |
12923 | 12923 |
12924 // Allocate the fixed array for the fields. | 12924 // Allocate the fixed array for the fields. |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13492 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13492 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13493 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13493 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13494 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13494 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13495 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13495 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13496 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13496 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13497 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13497 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13498 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13498 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13499 } | 13499 } |
13500 | 13500 |
13501 } } // namespace v8::internal | 13501 } } // namespace v8::internal |
OLD | NEW |