| 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 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 MaybeObject* maybe_name = | 2087 MaybeObject* maybe_name = |
| 2088 isolate->heap()->AllocateStringFromAscii(CStrVector("prototype")); | 2088 isolate->heap()->AllocateStringFromAscii(CStrVector("prototype")); |
| 2089 String* name; | 2089 String* name; |
| 2090 if (!maybe_name->To(&name)) return maybe_name; | 2090 if (!maybe_name->To(&name)) return maybe_name; |
| 2091 | 2091 |
| 2092 if (function->HasFastProperties()) { | 2092 if (function->HasFastProperties()) { |
| 2093 // Construct a new field descriptor with updated attributes. | 2093 // Construct a new field descriptor with updated attributes. |
| 2094 DescriptorArray* instance_desc = function->map()->instance_descriptors(); | 2094 DescriptorArray* instance_desc = function->map()->instance_descriptors(); |
| 2095 int index = instance_desc->Search(name); | 2095 int index = instance_desc->Search(name); |
| 2096 ASSERT(index != DescriptorArray::kNotFound); | 2096 ASSERT(index != DescriptorArray::kNotFound); |
| 2097 PropertyDetails details(instance_desc->GetDetails(index)); | 2097 PropertyDetails details = instance_desc->GetDetails(index); |
| 2098 CallbacksDescriptor new_desc(name, | 2098 CallbacksDescriptor new_desc(name, |
| 2099 instance_desc->GetValue(index), | 2099 instance_desc->GetValue(index), |
| 2100 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), | 2100 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), |
| 2101 details.index()); | 2101 details.index()); |
| 2102 // Construct a new field descriptors array containing the new descriptor. | 2102 // Construct a new field descriptors array containing the new descriptor. |
| 2103 Object* descriptors_unchecked; | 2103 Object* descriptors_unchecked; |
| 2104 { MaybeObject* maybe_descriptors_unchecked = | 2104 { MaybeObject* maybe_descriptors_unchecked = |
| 2105 instance_desc->CopyInsert(&new_desc, REMOVE_TRANSITIONS); | 2105 instance_desc->CopyInsert(&new_desc, REMOVE_TRANSITIONS); |
| 2106 if (!maybe_descriptors_unchecked->ToObject(&descriptors_unchecked)) { | 2106 if (!maybe_descriptors_unchecked->ToObject(&descriptors_unchecked)) { |
| 2107 return maybe_descriptors_unchecked; | 2107 return maybe_descriptors_unchecked; |
| (...skipping 11258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13366 // Handle last resort GC and make sure to allow future allocations | 13366 // Handle last resort GC and make sure to allow future allocations |
| 13367 // to grow the heap without causing GCs (if possible). | 13367 // to grow the heap without causing GCs (if possible). |
| 13368 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13368 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13369 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13369 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13370 "Runtime::PerformGC"); | 13370 "Runtime::PerformGC"); |
| 13371 } | 13371 } |
| 13372 } | 13372 } |
| 13373 | 13373 |
| 13374 | 13374 |
| 13375 } } // namespace v8::internal | 13375 } } // namespace v8::internal |
| OLD | NEW |