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 9110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9121 Object* allocation; | 9121 Object* allocation; |
9122 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); | 9122 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); |
9123 if (maybe_allocation->ToObject(&allocation)) { | 9123 if (maybe_allocation->ToObject(&allocation)) { |
9124 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); | 9124 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
9125 } | 9125 } |
9126 return maybe_allocation; | 9126 return maybe_allocation; |
9127 } | 9127 } |
9128 } | 9128 } |
9129 | 9129 |
9130 | 9130 |
| 9131 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInOldPointerSpace) { |
| 9132 // Allocate a block of memory in old pointer space (filled with a filler). |
| 9133 // Use as fallback for allocation in generated code when old pointer space |
| 9134 // is full. |
| 9135 ASSERT(args.length() == 1); |
| 9136 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); |
| 9137 int size = size_smi->value(); |
| 9138 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
| 9139 RUNTIME_ASSERT(size > 0); |
| 9140 Heap* heap = isolate->heap(); |
| 9141 Object* allocation; |
| 9142 { MaybeObject* maybe_allocation = |
| 9143 heap->old_pointer_space()->AllocateRaw(size); |
| 9144 if (maybe_allocation->ToObject(&allocation)) { |
| 9145 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
| 9146 } |
| 9147 return maybe_allocation; |
| 9148 } |
| 9149 } |
| 9150 |
| 9151 |
9131 // Push an object unto an array of objects if it is not already in the | 9152 // Push an object unto an array of objects if it is not already in the |
9132 // array. Returns true if the element was pushed on the stack and | 9153 // array. Returns true if the element was pushed on the stack and |
9133 // false otherwise. | 9154 // false otherwise. |
9134 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { | 9155 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { |
9135 NoHandleAllocation ha(isolate); | 9156 NoHandleAllocation ha(isolate); |
9136 ASSERT(args.length() == 2); | 9157 ASSERT(args.length() == 2); |
9137 CONVERT_ARG_CHECKED(JSArray, array, 0); | 9158 CONVERT_ARG_CHECKED(JSArray, array, 0); |
9138 CONVERT_ARG_CHECKED(JSReceiver, element, 1); | 9159 CONVERT_ARG_CHECKED(JSReceiver, element, 1); |
9139 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); | 9160 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); |
9140 int length = Smi::cast(array->length())->value(); | 9161 int length = Smi::cast(array->length())->value(); |
(...skipping 4275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13416 // Handle last resort GC and make sure to allow future allocations | 13437 // Handle last resort GC and make sure to allow future allocations |
13417 // to grow the heap without causing GCs (if possible). | 13438 // to grow the heap without causing GCs (if possible). |
13418 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13439 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13419 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13440 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13420 "Runtime::PerformGC"); | 13441 "Runtime::PerformGC"); |
13421 } | 13442 } |
13422 } | 13443 } |
13423 | 13444 |
13424 | 13445 |
13425 } } // namespace v8::internal | 13446 } } // namespace v8::internal |
OLD | NEW |