| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 #include "accessors.h" | 29 #include "accessors.h" |
| 30 | 30 |
| 31 #include "cctest.h" | 31 #include "cctest.h" |
| 32 | 32 |
| 33 | 33 |
| 34 using namespace v8::internal; | 34 using namespace v8::internal; |
| 35 | 35 |
| 36 | 36 |
| 37 // Also used in test-heap.cc test cases. | |
| 38 void SimulateFullSpace(PagedSpace* space) { | |
| 39 int old_linear_size = static_cast<int>(space->limit() - space->top()); | |
| 40 space->Free(space->top(), old_linear_size); | |
| 41 space->SetTop(space->limit(), space->limit()); | |
| 42 space->ResetFreeList(); | |
| 43 space->ClearStats(); | |
| 44 } | |
| 45 | |
| 46 | |
| 47 static MaybeObject* AllocateAfterFailures() { | 37 static MaybeObject* AllocateAfterFailures() { |
| 48 static int attempts = 0; | 38 static int attempts = 0; |
| 49 if (++attempts < 3) return Failure::RetryAfterGC(); | 39 if (++attempts < 3) return Failure::RetryAfterGC(); |
| 50 Heap* heap = Isolate::Current()->heap(); | 40 Heap* heap = Isolate::Current()->heap(); |
| 51 | 41 |
| 52 // New space. | 42 // New space. |
| 53 NewSpace* new_space = heap->new_space(); | 43 NewSpace* new_space = heap->new_space(); |
| 54 static const int kNewSpaceFillerSize = ByteArray::SizeFor(0); | 44 static const int kNewSpaceFillerSize = ByteArray::SizeFor(0); |
| 55 while (new_space->Available() > kNewSpaceFillerSize) { | 45 while (new_space->Available() > kNewSpaceFillerSize) { |
| 56 int available_before = static_cast<int>(new_space->Available()); | 46 int available_before = static_cast<int>(new_space->Available()); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 blocks[index] = blocks.RemoveLast(); | 228 blocks[index] = blocks.RemoveLast(); |
| 239 } else { | 229 } else { |
| 240 blocks.RemoveLast(); | 230 blocks.RemoveLast(); |
| 241 } | 231 } |
| 242 } | 232 } |
| 243 } | 233 } |
| 244 | 234 |
| 245 code_range->TearDown(); | 235 code_range->TearDown(); |
| 246 delete code_range; | 236 delete code_range; |
| 247 } | 237 } |
| OLD | NEW |