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 9067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9078 // Allocate a block of memory in NewSpace (filled with a filler). | 9078 // Allocate a block of memory in NewSpace (filled with a filler). |
9079 // Use as fallback for allocation in generated code when NewSpace | 9079 // Use as fallback for allocation in generated code when NewSpace |
9080 // is full. | 9080 // is full. |
9081 NoHandleAllocation ha(isolate); | 9081 NoHandleAllocation ha(isolate); |
9082 ASSERT(args.length() == 1); | 9082 ASSERT(args.length() == 1); |
9083 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); | 9083 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); |
9084 int size = size_smi->value(); | 9084 int size = size_smi->value(); |
9085 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); | 9085 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
9086 RUNTIME_ASSERT(size > 0); | 9086 RUNTIME_ASSERT(size > 0); |
9087 Heap* heap = isolate->heap(); | 9087 Heap* heap = isolate->heap(); |
9088 const int kMinFreeNewSpaceAfterGC = heap->InitialSemiSpaceSize() * 3/4; | 9088 RUNTIME_ASSERT(size <= heap->MaxNewSpaceAllocationSize()); |
9089 RUNTIME_ASSERT(size <= kMinFreeNewSpaceAfterGC); | |
9090 Object* allocation; | 9089 Object* allocation; |
9091 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); | 9090 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); |
9092 if (maybe_allocation->ToObject(&allocation)) { | 9091 if (maybe_allocation->ToObject(&allocation)) { |
9093 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); | 9092 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
9094 } | 9093 } |
9095 return maybe_allocation; | 9094 return maybe_allocation; |
9096 } | 9095 } |
9097 } | 9096 } |
9098 | 9097 |
9099 | 9098 |
(...skipping 4306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13406 // Handle last resort GC and make sure to allow future allocations | 13405 // Handle last resort GC and make sure to allow future allocations |
13407 // to grow the heap without causing GCs (if possible). | 13406 // to grow the heap without causing GCs (if possible). |
13408 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13407 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13409 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13408 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13410 "Runtime::PerformGC"); | 13409 "Runtime::PerformGC"); |
13411 } | 13410 } |
13412 } | 13411 } |
13413 | 13412 |
13414 | 13413 |
13415 } } // namespace v8::internal | 13414 } } // namespace v8::internal |
OLD | NEW |