| 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 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2159 NoHandleAllocation ha; | 2159 NoHandleAllocation ha; |
| 2160 RUNTIME_ASSERT(args.length() == 1); | 2160 RUNTIME_ASSERT(args.length() == 1); |
| 2161 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 2161 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 2162 | 2162 |
| 2163 String* name = isolate->heap()->prototype_symbol(); | 2163 String* name = isolate->heap()->prototype_symbol(); |
| 2164 | 2164 |
| 2165 if (function->HasFastProperties()) { | 2165 if (function->HasFastProperties()) { |
| 2166 // Construct a new field descriptor with updated attributes. | 2166 // Construct a new field descriptor with updated attributes. |
| 2167 DescriptorArray* instance_desc = function->map()->instance_descriptors(); | 2167 DescriptorArray* instance_desc = function->map()->instance_descriptors(); |
| 2168 | 2168 |
| 2169 int index = instance_desc->SearchWithCache(name); | 2169 int index = instance_desc->SearchWithCache(name, function->map()); |
| 2170 ASSERT(index != DescriptorArray::kNotFound); | 2170 ASSERT(index != DescriptorArray::kNotFound); |
| 2171 PropertyDetails details = instance_desc->GetDetails(index); | 2171 PropertyDetails details = instance_desc->GetDetails(index); |
| 2172 | 2172 |
| 2173 CallbacksDescriptor new_desc(name, | 2173 CallbacksDescriptor new_desc(name, |
| 2174 instance_desc->GetValue(index), | 2174 instance_desc->GetValue(index), |
| 2175 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), | 2175 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), |
| 2176 details.descriptor_index()); | 2176 details.descriptor_index()); |
| 2177 | 2177 |
| 2178 // Create a new map featuring the new field descriptors array. | 2178 // Create a new map featuring the new field descriptors array. |
| 2179 Map* new_map; | 2179 Map* new_map; |
| (...skipping 11108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13288 // Handle last resort GC and make sure to allow future allocations | 13288 // Handle last resort GC and make sure to allow future allocations |
| 13289 // to grow the heap without causing GCs (if possible). | 13289 // to grow the heap without causing GCs (if possible). |
| 13290 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13290 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13291 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13291 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13292 "Runtime::PerformGC"); | 13292 "Runtime::PerformGC"); |
| 13293 } | 13293 } |
| 13294 } | 13294 } |
| 13295 | 13295 |
| 13296 | 13296 |
| 13297 } } // namespace v8::internal | 13297 } } // namespace v8::internal |
| OLD | NEW |