| 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 9097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9108 // Allocate a block of memory in NewSpace (filled with a filler). | 9108 // Allocate a block of memory in NewSpace (filled with a filler). |
| 9109 // Use as fallback for allocation in generated code when NewSpace | 9109 // Use as fallback for allocation in generated code when NewSpace |
| 9110 // is full. | 9110 // is full. |
| 9111 NoHandleAllocation ha(isolate); | 9111 NoHandleAllocation ha(isolate); |
| 9112 ASSERT(args.length() == 1); | 9112 ASSERT(args.length() == 1); |
| 9113 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); | 9113 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); |
| 9114 int size = size_smi->value(); | 9114 int size = size_smi->value(); |
| 9115 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); | 9115 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
| 9116 RUNTIME_ASSERT(size > 0); | 9116 RUNTIME_ASSERT(size > 0); |
| 9117 Heap* heap = isolate->heap(); | 9117 Heap* heap = isolate->heap(); |
| 9118 const int kMinFreeNewSpaceAfterGC = heap->InitialSemiSpaceSize() * 3/4; | 9118 RUNTIME_ASSERT(size <= heap->MaxNewSpaceAllocationSize()); |
| 9119 RUNTIME_ASSERT(size <= kMinFreeNewSpaceAfterGC); | |
| 9120 Object* allocation; | 9119 Object* allocation; |
| 9121 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); | 9120 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); |
| 9122 if (maybe_allocation->ToObject(&allocation)) { | 9121 if (maybe_allocation->ToObject(&allocation)) { |
| 9123 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); | 9122 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
| 9124 } | 9123 } |
| 9125 return maybe_allocation; | 9124 return maybe_allocation; |
| 9126 } | 9125 } |
| 9127 } | 9126 } |
| 9128 | 9127 |
| 9129 | 9128 |
| (...skipping 4285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13415 // Handle last resort GC and make sure to allow future allocations | 13414 // Handle last resort GC and make sure to allow future allocations |
| 13416 // to grow the heap without causing GCs (if possible). | 13415 // to grow the heap without causing GCs (if possible). |
| 13417 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13416 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13418 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13417 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13419 "Runtime::PerformGC"); | 13418 "Runtime::PerformGC"); |
| 13420 } | 13419 } |
| 13421 } | 13420 } |
| 13422 | 13421 |
| 13423 | 13422 |
| 13424 } } // namespace v8::internal | 13423 } } // namespace v8::internal |
| OLD | NEW |