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 2451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2462 SealHandleScope shs(isolate); | 2462 SealHandleScope shs(isolate); |
2463 ASSERT(args.length() == 3); | 2463 ASSERT(args.length() == 3); |
2464 CONVERT_SMI_ARG_CHECKED(elements_count, 0); | 2464 CONVERT_SMI_ARG_CHECKED(elements_count, 0); |
2465 if (elements_count < 0 || | 2465 if (elements_count < 0 || |
2466 elements_count > FixedArray::kMaxLength || | 2466 elements_count > FixedArray::kMaxLength || |
2467 !Smi::IsValid(elements_count)) { | 2467 !Smi::IsValid(elements_count)) { |
2468 return isolate->ThrowIllegalOperation(); | 2468 return isolate->ThrowIllegalOperation(); |
2469 } | 2469 } |
2470 Object* new_object; | 2470 Object* new_object; |
2471 { MaybeObject* maybe_new_object = | 2471 { MaybeObject* maybe_new_object = |
2472 isolate->heap()->AllocateFixedArrayWithHoles(elements_count); | 2472 isolate->heap()->AllocateFixedArray(elements_count); |
2473 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; | 2473 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; |
2474 } | 2474 } |
2475 FixedArray* elements = FixedArray::cast(new_object); | 2475 FixedArray* elements = FixedArray::cast(new_object); |
2476 { MaybeObject* maybe_new_object = isolate->heap()->AllocateRaw( | 2476 { MaybeObject* maybe_new_object = isolate->heap()->AllocateRaw( |
2477 JSRegExpResult::kSize, NEW_SPACE, OLD_POINTER_SPACE); | 2477 JSRegExpResult::kSize, NEW_SPACE, OLD_POINTER_SPACE); |
2478 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; | 2478 if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object; |
2479 } | 2479 } |
2480 { | 2480 { |
2481 DisallowHeapAllocation no_gc; | 2481 DisallowHeapAllocation no_gc; |
2482 HandleScope scope(isolate); | 2482 HandleScope scope(isolate); |
(...skipping 12176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14659 // Handle last resort GC and make sure to allow future allocations | 14659 // Handle last resort GC and make sure to allow future allocations |
14660 // to grow the heap without causing GCs (if possible). | 14660 // to grow the heap without causing GCs (if possible). |
14661 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14661 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14662 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14662 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14663 "Runtime::PerformGC"); | 14663 "Runtime::PerformGC"); |
14664 } | 14664 } |
14665 } | 14665 } |
14666 | 14666 |
14667 | 14667 |
14668 } } // namespace v8::internal | 14668 } } // namespace v8::internal |
OLD | NEW |