Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1319)

Unified Diff: test/cctest/test-heap.cc

Issue 259173003: Kiss goodbye to MaybeObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase + addressed comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 59b6e255c92dbca21f7587500fe9f6705e6d8891..e91a08047da2802e11e9a383b8bec25f6bbbaed5 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -235,11 +235,6 @@ TEST(Tagging) {
int request = 24;
CHECK_EQ(request, static_cast<int>(OBJECT_POINTER_ALIGN(request)));
CHECK(Smi::FromInt(42)->IsSmi());
- CHECK(Failure::RetryAfterGC(NEW_SPACE)->IsFailure());
- CHECK_EQ(NEW_SPACE,
- Failure::RetryAfterGC(NEW_SPACE)->allocation_space());
- CHECK_EQ(OLD_POINTER_SPACE,
- Failure::RetryAfterGC(OLD_POINTER_SPACE)->allocation_space());
CHECK(Smi::FromInt(Smi::kMinValue)->IsSmi());
CHECK(Smi::FromInt(Smi::kMaxValue)->IsSmi());
}
@@ -1017,8 +1012,7 @@ TEST(Regression39128) {
Address* limit_addr = new_space->allocation_limit_address();
while ((*limit_addr - *top_addr) > allocation_amount) {
CHECK(!heap->always_allocate());
- Object* array = heap->AllocateFixedArray(allocation_len)->ToObjectChecked();
- CHECK(!array->IsFailure());
+ Object* array = heap->AllocateFixedArray(allocation_len).ToObjectChecked();
CHECK(new_space->Contains(array));
}
@@ -1028,11 +1022,10 @@ TEST(Regression39128) {
CHECK(fixed_array_len < FixedArray::kMaxLength);
CHECK(!heap->always_allocate());
- Object* array = heap->AllocateFixedArray(fixed_array_len)->ToObjectChecked();
- CHECK(!array->IsFailure());
+ Object* array = heap->AllocateFixedArray(fixed_array_len).ToObjectChecked();
CHECK(new_space->Contains(array));
- Object* object = heap->AllocateJSObjectFromMap(*my_map)->ToObjectChecked();
+ Object* object = heap->AllocateJSObjectFromMap(*my_map).ToObjectChecked();
CHECK(new_space->Contains(object));
JSObject* jsobject = JSObject::cast(object);
CHECK_EQ(0, FixedArray::cast(jsobject->elements())->length());
@@ -1046,7 +1039,7 @@ TEST(Regression39128) {
// in old pointer space.
Address old_pointer_space_top = heap->old_pointer_space()->top();
AlwaysAllocateScope aa_scope(isolate);
- Object* clone_obj = heap->CopyJSObject(jsobject)->ToObjectChecked();
+ Object* clone_obj = heap->CopyJSObject(jsobject).ToObjectChecked();
JSObject* clone = JSObject::cast(clone_obj);
if (clone->address() != old_pointer_space_top) {
// Alas, got allocated from free list, we cannot do checks.
@@ -1624,7 +1617,7 @@ TEST(TestSizeOfObjects) {
AlwaysAllocateScope always_allocate(CcTest::i_isolate());
int filler_size = static_cast<int>(FixedArray::SizeFor(8192));
for (int i = 1; i <= 100; i++) {
- CcTest::test_heap()->AllocateFixedArray(8192, TENURED)->ToObjectChecked();
+ CcTest::test_heap()->AllocateFixedArray(8192, TENURED).ToObjectChecked();
CHECK_EQ(initial_size + i * filler_size,
static_cast<int>(CcTest::heap()->SizeOfObjects()));
}
@@ -3487,8 +3480,10 @@ static inline void AllocateAllButNBytes(v8::internal::NewSpace* space,
*space->allocation_limit_address() - *space->allocation_top_address());
CHECK(space_remaining >= extra_bytes);
int new_linear_size = space_remaining - extra_bytes;
- v8::internal::MaybeObject* maybe = space->AllocateRaw(new_linear_size);
- v8::internal::FreeListNode* node = v8::internal::FreeListNode::cast(maybe);
+ v8::internal::AllocationResult allocation =
+ space->AllocateRaw(new_linear_size);
+ v8::internal::FreeListNode* node =
+ v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
node->set_size(space->heap(), new_linear_size);
}
@@ -3546,14 +3541,13 @@ TEST(Regress169928) {
// We need filler the size of AllocationMemento object, plus an extra
// fill pointer value.
- MaybeObject* maybe_object = CcTest::heap()->new_space()->AllocateRaw(
+ HeapObject* obj = NULL;
+ AllocationResult allocation = CcTest::heap()->new_space()->AllocateRaw(
AllocationMemento::kSize + kPointerSize);
- Object* obj = NULL;
- CHECK(maybe_object->ToObject(&obj));
- Address addr_obj = reinterpret_cast<Address>(
- reinterpret_cast<byte*>(obj - kHeapObjectTag));
- CcTest::heap()->CreateFillerObjectAt(addr_obj,
- AllocationMemento::kSize + kPointerSize);
+ CHECK(allocation.To(&obj));
+ Address addr_obj = obj->address();
+ CcTest::heap()->CreateFillerObjectAt(
+ addr_obj, AllocationMemento::kSize + kPointerSize);
// Give the array a name, making sure not to allocate strings.
v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array);
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698