| 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 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 SealHandleScope shs(isolate); | 2426 SealHandleScope shs(isolate); |
| 2427 ASSERT(args.length() == 3); | 2427 ASSERT(args.length() == 3); |
| 2428 CONVERT_SMI_ARG_CHECKED(elements_count, 0); | 2428 CONVERT_SMI_ARG_CHECKED(elements_count, 0); |
| 2429 if (elements_count < 0 || | 2429 if (elements_count < 0 || |
| 2430 elements_count > FixedArray::kMaxLength || | 2430 elements_count > FixedArray::kMaxLength || |
| 2431 !Smi::IsValid(elements_count)) { | 2431 !Smi::IsValid(elements_count)) { |
| 2432 return isolate->ThrowIllegalOperation(); | 2432 return isolate->ThrowIllegalOperation(); |
| 2433 } | 2433 } |
| 2434 Object* new_object; | 2434 Object* new_object; |
| 2435 { MaybeObject* maybe_new_object = | 2435 { MaybeObject* maybe_new_object = |
| 2436 isolate->heap()->AllocateFixedArrayWithHoles(elements_count); | 2436 isolate->heap()->AllocateFixedArray(elements_count); |
| 2437 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; | 2437 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; |
| 2438 } | 2438 } |
| 2439 FixedArray* elements = FixedArray::cast(new_object); | 2439 FixedArray* elements = FixedArray::cast(new_object); |
| 2440 { MaybeObject* maybe_new_object = isolate->heap()->AllocateRaw( | 2440 { MaybeObject* maybe_new_object = isolate->heap()->AllocateRaw( |
| 2441 JSRegExpResult::kSize, NEW_SPACE, OLD_POINTER_SPACE); | 2441 JSRegExpResult::kSize, NEW_SPACE, OLD_POINTER_SPACE); |
| 2442 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; | 2442 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; |
| 2443 } | 2443 } |
| 2444 { | 2444 { |
| 2445 DisallowHeapAllocation no_gc; | 2445 DisallowHeapAllocation no_gc; |
| 2446 HandleScope scope(isolate); | 2446 HandleScope scope(isolate); |
| (...skipping 12044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14491 // Handle last resort GC and make sure to allow future allocations | 14491 // Handle last resort GC and make sure to allow future allocations |
| 14492 // to grow the heap without causing GCs (if possible). | 14492 // to grow the heap without causing GCs (if possible). |
| 14493 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14493 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14494 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14494 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14495 "Runtime::PerformGC"); | 14495 "Runtime::PerformGC"); |
| 14496 } | 14496 } |
| 14497 } | 14497 } |
| 14498 | 14498 |
| 14499 | 14499 |
| 14500 } } // namespace v8::internal | 14500 } } // namespace v8::internal |
| OLD | NEW |