summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-alloc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/test-alloc.cc')
-rw-r--r--deps/v8/test/cctest/test-alloc.cc30
1 files changed, 5 insertions, 25 deletions
diff --git a/deps/v8/test/cctest/test-alloc.cc b/deps/v8/test/cctest/test-alloc.cc
index 50e60da271..bbae5ebd3e 100644
--- a/deps/v8/test/cctest/test-alloc.cc
+++ b/deps/v8/test/cctest/test-alloc.cc
@@ -34,34 +34,13 @@
using namespace v8::internal;
-// Also used in test-heap.cc test cases.
-void SimulateFullSpace(PagedSpace* space) {
- int old_linear_size = static_cast<int>(space->limit() - space->top());
- space->Free(space->top(), old_linear_size);
- space->SetTop(space->limit(), space->limit());
- space->ResetFreeList();
- space->ClearStats();
-}
-
-
static MaybeObject* AllocateAfterFailures() {
static int attempts = 0;
if (++attempts < 3) return Failure::RetryAfterGC();
Heap* heap = Isolate::Current()->heap();
// New space.
- NewSpace* new_space = heap->new_space();
- static const int kNewSpaceFillerSize = ByteArray::SizeFor(0);
- while (new_space->Available() > kNewSpaceFillerSize) {
- int available_before = static_cast<int>(new_space->Available());
- CHECK(!heap->AllocateByteArray(0)->IsFailure());
- if (available_before == new_space->Available()) {
- // It seems that we are avoiding new space allocations when
- // allocation is forced, so no need to fill up new space
- // in order to make the test harder.
- break;
- }
- }
+ SimulateFullSpace(heap->new_space());
CHECK(!heap->AllocateByteArray(100)->IsFailure());
CHECK(!heap->AllocateFixedArray(100, NOT_TENURED)->IsFailure());
@@ -76,7 +55,7 @@ static MaybeObject* AllocateAfterFailures() {
// Old data space.
SimulateFullSpace(heap->old_data_space());
- CHECK(!heap->AllocateRawAsciiString(100, TENURED)->IsFailure());
+ CHECK(!heap->AllocateRawOneByteString(100, TENURED)->IsFailure());
// Old pointer space.
SimulateFullSpace(heap->old_pointer_space());
@@ -100,6 +79,7 @@ static MaybeObject* AllocateAfterFailures() {
CHECK(!heap->AllocateMap(JS_OBJECT_TYPE, instance_size)->IsFailure());
// Test that we can allocate in old pointer space and code space.
+ SimulateFullSpace(heap->code_space());
CHECK(!heap->AllocateFixedArray(100, TENURED)->IsFailure());
CHECK(!heap->CopyCode(Isolate::Current()->builtins()->builtin(
Builtins::kIllegal))->IsFailure());
@@ -155,10 +135,10 @@ TEST(StressJS) {
FACTORY->NewStringFromAscii(Vector<const char>("get", 3));
ASSERT(instance_descriptors->IsEmpty());
- Handle<DescriptorArray> new_descriptors = FACTORY->NewDescriptorArray(1);
+ Handle<DescriptorArray> new_descriptors = FACTORY->NewDescriptorArray(0, 1);
v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors);
- v8::internal::Map::SetDescriptors(map, new_descriptors);
+ map->set_instance_descriptors(*new_descriptors);
CallbacksDescriptor d(*name,
*foreign,