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 9026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9037 Object* allocation; | 9037 Object* allocation; |
9038 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); | 9038 { MaybeObject* maybe_allocation = heap->new_space()->AllocateRaw(size); |
9039 if (maybe_allocation->ToObject(&allocation)) { | 9039 if (maybe_allocation->ToObject(&allocation)) { |
9040 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); | 9040 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
9041 } | 9041 } |
9042 return maybe_allocation; | 9042 return maybe_allocation; |
9043 } | 9043 } |
9044 } | 9044 } |
9045 | 9045 |
9046 | 9046 |
| 9047 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInOldPointerSpace) { |
| 9048 // Allocate a block of memory in old pointer space (filled with a filler). |
| 9049 // Use as fallback for allocation in generated code when old pointer space |
| 9050 // is full. |
| 9051 ASSERT(args.length() == 1); |
| 9052 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); |
| 9053 int size = size_smi->value(); |
| 9054 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
| 9055 RUNTIME_ASSERT(size > 0); |
| 9056 Heap* heap = isolate->heap(); |
| 9057 Object* allocation; |
| 9058 { MaybeObject* maybe_allocation = |
| 9059 heap->old_pointer_space()->AllocateRaw(size); |
| 9060 if (maybe_allocation->ToObject(&allocation)) { |
| 9061 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
| 9062 } |
| 9063 return maybe_allocation; |
| 9064 } |
| 9065 } |
| 9066 |
| 9067 |
9047 // Push an object unto an array of objects if it is not already in the | 9068 // Push an object unto an array of objects if it is not already in the |
9048 // array. Returns true if the element was pushed on the stack and | 9069 // array. Returns true if the element was pushed on the stack and |
9049 // false otherwise. | 9070 // false otherwise. |
9050 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { | 9071 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { |
9051 ASSERT(args.length() == 2); | 9072 ASSERT(args.length() == 2); |
9052 CONVERT_ARG_CHECKED(JSArray, array, 0); | 9073 CONVERT_ARG_CHECKED(JSArray, array, 0); |
9053 CONVERT_ARG_CHECKED(JSReceiver, element, 1); | 9074 CONVERT_ARG_CHECKED(JSReceiver, element, 1); |
9054 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); | 9075 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); |
9055 int length = Smi::cast(array->length())->value(); | 9076 int length = Smi::cast(array->length())->value(); |
9056 FixedArray* elements = FixedArray::cast(array->elements()); | 9077 FixedArray* elements = FixedArray::cast(array->elements()); |
(...skipping 4244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13301 // Handle last resort GC and make sure to allow future allocations | 13322 // Handle last resort GC and make sure to allow future allocations |
13302 // to grow the heap without causing GCs (if possible). | 13323 // to grow the heap without causing GCs (if possible). |
13303 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13324 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13304 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13325 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13305 "Runtime::PerformGC"); | 13326 "Runtime::PerformGC"); |
13306 } | 13327 } |
13307 } | 13328 } |
13308 | 13329 |
13309 | 13330 |
13310 } } // namespace v8::internal | 13331 } } // namespace v8::internal |
OLD | NEW |