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 9058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9069 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) { | 9069 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) { |
9070 // Allocate a block of memory in NewSpace (filled with a filler). | 9070 // Allocate a block of memory in NewSpace (filled with a filler). |
9071 // Use as fallback for allocation in generated code when NewSpace | 9071 // Use as fallback for allocation in generated code when NewSpace |
9072 // is full. | 9072 // is full. |
9073 ASSERT(args.length() == 1); | 9073 ASSERT(args.length() == 1); |
9074 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); | 9074 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); |
9075 int size = size_smi->value(); | 9075 int size = size_smi->value(); |
9076 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); | 9076 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
9077 RUNTIME_ASSERT(size > 0); | 9077 RUNTIME_ASSERT(size > 0); |
9078 Heap* heap = isolate->heap(); | 9078 Heap* heap = isolate->heap(); |
9079 const int kMinFreeNewSpaceAfterGC = heap->InitialSemiSpaceSize() * 3/4; | 9079 RUNTIME_ASSERT(size <= heap->MaxNewSpaceAllocationSize()); |
9080 RUNTIME_ASSERT(size <= kMinFreeNewSpaceAfterGC); | |
9081 Object* allocation; | 9080 Object* allocation; |
9082 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); | 9081 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); |
9083 if (maybe_allocation->ToObject(&allocation)) { | 9082 if (maybe_allocation->ToObject(&allocation)) { |
9084 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); | 9083 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
9085 } | 9084 } |
9086 return maybe_allocation; | 9085 return maybe_allocation; |
9087 } | 9086 } |
9088 } | 9087 } |
9089 | 9088 |
9090 | 9089 |
(...skipping 4254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13345 // Handle last resort GC and make sure to allow future allocations | 13344 // Handle last resort GC and make sure to allow future allocations |
13346 // to grow the heap without causing GCs (if possible). | 13345 // to grow the heap without causing GCs (if possible). |
13347 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13346 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13348 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13347 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13349 "Runtime::PerformGC"); | 13348 "Runtime::PerformGC"); |
13350 } | 13349 } |
13351 } | 13350 } |
13352 | 13351 |
13353 | 13352 |
13354 } } // namespace v8::internal | 13353 } } // namespace v8::internal |
OLD | NEW |