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 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2309 if (function->HasFastProperties()) { | 2309 if (function->HasFastProperties()) { |
2310 // Construct a new field descriptor with updated attributes. | 2310 // Construct a new field descriptor with updated attributes. |
2311 DescriptorArray* instance_desc = function->map()->instance_descriptors(); | 2311 DescriptorArray* instance_desc = function->map()->instance_descriptors(); |
2312 | 2312 |
2313 int index = instance_desc->SearchWithCache(name, function->map()); | 2313 int index = instance_desc->SearchWithCache(name, function->map()); |
2314 ASSERT(index != DescriptorArray::kNotFound); | 2314 ASSERT(index != DescriptorArray::kNotFound); |
2315 PropertyDetails details = instance_desc->GetDetails(index); | 2315 PropertyDetails details = instance_desc->GetDetails(index); |
2316 | 2316 |
2317 CallbacksDescriptor new_desc(name, | 2317 CallbacksDescriptor new_desc(name, |
2318 instance_desc->GetValue(index), | 2318 instance_desc->GetValue(index), |
2319 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), | 2319 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY)); |
2320 details.descriptor_index()); | |
2321 | 2320 |
2322 // Create a new map featuring the new field descriptors array. | 2321 // Create a new map featuring the new field descriptors array. |
2323 Map* new_map; | 2322 Map* new_map; |
2324 MaybeObject* maybe_map = | 2323 MaybeObject* maybe_map = |
2325 function->map()->CopyReplaceDescriptor( | 2324 function->map()->CopyReplaceDescriptor( |
2326 instance_desc, &new_desc, index, OMIT_TRANSITION); | 2325 instance_desc, &new_desc, index, OMIT_TRANSITION); |
2327 if (!maybe_map->To(&new_map)) return maybe_map; | 2326 if (!maybe_map->To(&new_map)) return maybe_map; |
2328 | 2327 |
2329 function->set_map(new_map); | 2328 function->set_map(new_map); |
2330 } else { // Dictionary properties. | 2329 } else { // Dictionary properties. |
2331 // Directly manipulate the property details. | 2330 // Directly manipulate the property details. |
2332 int entry = function->property_dictionary()->FindEntry(name); | 2331 int entry = function->property_dictionary()->FindEntry(name); |
2333 ASSERT(entry != NameDictionary::kNotFound); | 2332 ASSERT(entry != NameDictionary::kNotFound); |
2334 PropertyDetails details = function->property_dictionary()->DetailsAt(entry); | 2333 PropertyDetails details = function->property_dictionary()->DetailsAt(entry); |
2335 PropertyDetails new_details( | 2334 PropertyDetails new_details( |
2336 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), | 2335 static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), |
2337 details.type(), | 2336 details.type(), |
2338 Representation::None(), | |
2339 details.dictionary_index()); | 2337 details.dictionary_index()); |
2340 function->property_dictionary()->DetailsAtPut(entry, new_details); | 2338 function->property_dictionary()->DetailsAtPut(entry, new_details); |
2341 } | 2339 } |
2342 return function; | 2340 return function; |
2343 } | 2341 } |
2344 | 2342 |
2345 | 2343 |
2346 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) { | 2344 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsAPIFunction) { |
2347 NoHandleAllocation ha(isolate); | 2345 NoHandleAllocation ha(isolate); |
2348 ASSERT(args.length() == 1); | 2346 ASSERT(args.length() == 1); |
(...skipping 11045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13394 // Handle last resort GC and make sure to allow future allocations | 13392 // Handle last resort GC and make sure to allow future allocations |
13395 // to grow the heap without causing GCs (if possible). | 13393 // to grow the heap without causing GCs (if possible). |
13396 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13394 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13397 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13395 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13398 "Runtime::PerformGC"); | 13396 "Runtime::PerformGC"); |
13399 } | 13397 } |
13400 } | 13398 } |
13401 | 13399 |
13402 | 13400 |
13403 } } // namespace v8::internal | 13401 } } // namespace v8::internal |
OLD | NEW |