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 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 Object* descriptors_unchecked; | 2183 Object* descriptors_unchecked; |
2184 { MaybeObject* maybe_descriptors_unchecked = | 2184 { MaybeObject* maybe_descriptors_unchecked = |
2185 instance_desc->CopyInsert(&new_desc); | 2185 instance_desc->CopyInsert(&new_desc); |
2186 if (!maybe_descriptors_unchecked->ToObject(&descriptors_unchecked)) { | 2186 if (!maybe_descriptors_unchecked->ToObject(&descriptors_unchecked)) { |
2187 return maybe_descriptors_unchecked; | 2187 return maybe_descriptors_unchecked; |
2188 } | 2188 } |
2189 } | 2189 } |
2190 DescriptorArray* new_descriptors = | 2190 DescriptorArray* new_descriptors = |
2191 DescriptorArray::cast(descriptors_unchecked); | 2191 DescriptorArray::cast(descriptors_unchecked); |
2192 // Create a new map featuring the new field descriptors array. | 2192 // Create a new map featuring the new field descriptors array. |
2193 Object* map_unchecked; | 2193 Map* new_map; |
2194 { MaybeObject* maybe_map_unchecked = function->map()->CopyDropDescriptors(); | 2194 { MaybeObject* maybe_map_unchecked = |
2195 if (!maybe_map_unchecked->ToObject(&map_unchecked)) { | 2195 function->map()->CopyDropDescriptors(); |
| 2196 if (!maybe_map_unchecked->To(&new_map)) { |
2196 return maybe_map_unchecked; | 2197 return maybe_map_unchecked; |
2197 } | 2198 } |
2198 } | 2199 } |
2199 Map* new_map = Map::cast(map_unchecked); | |
2200 new_map->set_instance_descriptors(new_descriptors); | 2200 new_map->set_instance_descriptors(new_descriptors); |
2201 function->set_map(new_map); | 2201 function->set_map(new_map); |
2202 } else { // Dictionary properties. | 2202 } else { // Dictionary properties. |
2203 // Directly manipulate the property details. | 2203 // Directly manipulate the property details. |
2204 int entry = function->property_dictionary()->FindEntry(name); | 2204 int entry = function->property_dictionary()->FindEntry(name); |
2205 ASSERT(entry != StringDictionary::kNotFound); | 2205 ASSERT(entry != StringDictionary::kNotFound); |
2206 PropertyDetails details = function->property_dictionary()->DetailsAt(entry); | 2206 PropertyDetails details = function->property_dictionary()->DetailsAt(entry); |
2207 PropertyDetails new_details( | 2207 PropertyDetails new_details( |
2208 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), | 2208 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), |
2209 details.type(), | 2209 details.type(), |
(...skipping 11494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13704 // Handle last resort GC and make sure to allow future allocations | 13704 // Handle last resort GC and make sure to allow future allocations |
13705 // to grow the heap without causing GCs (if possible). | 13705 // to grow the heap without causing GCs (if possible). |
13706 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13706 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13707 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13707 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13708 "Runtime::PerformGC"); | 13708 "Runtime::PerformGC"); |
13709 } | 13709 } |
13710 } | 13710 } |
13711 | 13711 |
13712 | 13712 |
13713 } } // namespace v8::internal | 13713 } } // namespace v8::internal |
OLD | NEW |