| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Return success. | 85 // Return success. |
| 86 return heap->true_value(); | 86 return heap->true_value(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 Handle<Object> v8::internal::HeapTester::TestAllocateAfterFailures() { | 90 Handle<Object> v8::internal::HeapTester::TestAllocateAfterFailures() { |
| 91 // Similar to what the CALL_AND_RETRY macro does in the last-resort case, we | 91 // Similar to what the CALL_AND_RETRY macro does in the last-resort case, we |
| 92 // are wrapping the allocator function in an AlwaysAllocateScope. Test that | 92 // are wrapping the allocator function in an AlwaysAllocateScope. Test that |
| 93 // all allocations succeed immediately without any retry. | 93 // all allocations succeed immediately without any retry. |
| 94 CcTest::heap()->CollectAllAvailableGarbage("panic"); | 94 CcTest::CollectAllAvailableGarbage(); |
| 95 AlwaysAllocateScope scope(CcTest::i_isolate()); | 95 AlwaysAllocateScope scope(CcTest::i_isolate()); |
| 96 return handle(AllocateAfterFailures().ToObjectChecked(), CcTest::i_isolate()); | 96 return handle(AllocateAfterFailures().ToObjectChecked(), CcTest::i_isolate()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 HEAP_TEST(StressHandles) { | 100 HEAP_TEST(StressHandles) { |
| 101 v8::HandleScope scope(CcTest::isolate()); | 101 v8::HandleScope scope(CcTest::isolate()); |
| 102 v8::Local<v8::Context> env = v8::Context::New(CcTest::isolate()); | 102 v8::Local<v8::Context> env = v8::Context::New(CcTest::isolate()); |
| 103 env->Enter(); | 103 env->Enter(); |
| 104 Handle<Object> o = TestAllocateAfterFailures(); | 104 Handle<Object> o = TestAllocateAfterFailures(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 code_range.FreeRawMemory(blocks[index].base, blocks[index].size); | 242 code_range.FreeRawMemory(blocks[index].base, blocks[index].size); |
| 243 current_allocated -= blocks[index].size; | 243 current_allocated -= blocks[index].size; |
| 244 if (index < blocks.length() - 1) { | 244 if (index < blocks.length() - 1) { |
| 245 blocks[index] = blocks.RemoveLast(); | 245 blocks[index] = blocks.RemoveLast(); |
| 246 } else { | 246 } else { |
| 247 blocks.RemoveLast(); | 247 blocks.RemoveLast(); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 } | 251 } |
| OLD | NEW |