| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 if (++attempts < 4) return AllocationResult::Retry(); | 43 if (++attempts < 4) return AllocationResult::Retry(); |
| 44 | 44 |
| 45 // Expose some private stuff on Heap. | 45 // Expose some private stuff on Heap. |
| 46 Heap* heap = CcTest::heap(); | 46 Heap* heap = CcTest::heap(); |
| 47 | 47 |
| 48 // Now that we have returned 'retry' 4 times, we are in a last-chance | 48 // Now that we have returned 'retry' 4 times, we are in a last-chance |
| 49 // scenario, with always_allocate. See CALL_AND_RETRY. Test that all | 49 // scenario, with always_allocate. See CALL_AND_RETRY. Test that all |
| 50 // allocations succeed. | 50 // allocations succeed. |
| 51 | 51 |
| 52 // New space. | 52 // New space. |
| 53 SimulateFullSpace(heap->new_space()); |
| 53 heap->AllocateByteArray(100).ToObjectChecked(); | 54 heap->AllocateByteArray(100).ToObjectChecked(); |
| 54 heap->AllocateFixedArray(100, NOT_TENURED).ToObjectChecked(); | 55 heap->AllocateFixedArray(100, NOT_TENURED).ToObjectChecked(); |
| 55 | 56 |
| 56 // Make sure we can allocate through optimized allocation functions | 57 // Make sure we can allocate through optimized allocation functions |
| 57 // for specific kinds. | 58 // for specific kinds. |
| 58 heap->AllocateFixedArray(100).ToObjectChecked(); | 59 heap->AllocateFixedArray(100).ToObjectChecked(); |
| 59 heap->AllocateHeapNumber(0.42).ToObjectChecked(); | 60 heap->AllocateHeapNumber(0.42).ToObjectChecked(); |
| 60 Object* object = heap->AllocateJSObject( | 61 Object* object = heap->AllocateJSObject( |
| 61 *CcTest::i_isolate()->object_function()).ToObjectChecked(); | 62 *CcTest::i_isolate()->object_function()).ToObjectChecked(); |
| 62 heap->CopyJSObject(JSObject::cast(object)).ToObjectChecked(); | 63 heap->CopyJSObject(JSObject::cast(object)).ToObjectChecked(); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 code_range.FreeRawMemory(blocks[index].base, blocks[index].size); | 240 code_range.FreeRawMemory(blocks[index].base, blocks[index].size); |
| 240 current_allocated -= blocks[index].size; | 241 current_allocated -= blocks[index].size; |
| 241 if (index < blocks.length() - 1) { | 242 if (index < blocks.length() - 1) { |
| 242 blocks[index] = blocks.RemoveLast(); | 243 blocks[index] = blocks.RemoveLast(); |
| 243 } else { | 244 } else { |
| 244 blocks.RemoveLast(); | 245 blocks.RemoveLast(); |
| 245 } | 246 } |
| 246 } | 247 } |
| 247 } | 248 } |
| 248 } | 249 } |
| OLD | NEW |