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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 DescriptorArray* instance_desc = function->map()->instance_descriptors(); | 2174 DescriptorArray* instance_desc = function->map()->instance_descriptors(); |
2175 int index = instance_desc->Search(name); | 2175 int index = instance_desc->Search(name); |
2176 ASSERT(index != DescriptorArray::kNotFound); | 2176 ASSERT(index != DescriptorArray::kNotFound); |
2177 PropertyDetails details = instance_desc->GetDetails(index); | 2177 PropertyDetails details = instance_desc->GetDetails(index); |
2178 CallbacksDescriptor new_desc(name, | 2178 CallbacksDescriptor new_desc(name, |
2179 instance_desc->GetValue(index), | 2179 instance_desc->GetValue(index), |
2180 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), | 2180 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), |
2181 details.index()); | 2181 details.index()); |
2182 // Construct a new field descriptors array containing the new descriptor. | 2182 // Construct a new field descriptors array containing the new descriptor. |
2183 DescriptorArray* new_descriptors; | 2183 DescriptorArray* new_descriptors; |
2184 { MaybeObject* maybe_descriptors = instance_desc->CopyInsert(&new_desc); | 2184 { MaybeObject* maybe_descriptors = |
| 2185 instance_desc->CopyReplace(&new_desc, index); |
2185 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; | 2186 if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
2186 } | 2187 } |
2187 // Create a new map featuring the new field descriptors array. | 2188 // Create a new map featuring the new field descriptors array. |
2188 Map* new_map; | 2189 Map* new_map; |
2189 { MaybeObject* maybe_map = | 2190 { MaybeObject* maybe_map = |
2190 function->map()->CopyReplaceDescriptors(new_descriptors); | 2191 function->map()->CopyReplaceDescriptors(new_descriptors); |
2191 if (!maybe_map->To(&new_map)) return maybe_map; | 2192 if (!maybe_map->To(&new_map)) return maybe_map; |
2192 } | 2193 } |
2193 function->set_map(new_map); | 2194 function->set_map(new_map); |
2194 } else { // Dictionary properties. | 2195 } else { // Dictionary properties. |
(...skipping 11516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13711 // Handle last resort GC and make sure to allow future allocations | 13712 // Handle last resort GC and make sure to allow future allocations |
13712 // to grow the heap without causing GCs (if possible). | 13713 // to grow the heap without causing GCs (if possible). |
13713 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13714 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13714 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13715 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13715 "Runtime::PerformGC"); | 13716 "Runtime::PerformGC"); |
13716 } | 13717 } |
13717 } | 13718 } |
13718 | 13719 |
13719 | 13720 |
13720 } } // namespace v8::internal | 13721 } } // namespace v8::internal |
OLD | NEW |