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

Unified Diff: test/cctest/test-mark-compact.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-heap.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-mark-compact.cc
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc
index 1a0e94f0a32f59a97dead296708120df9fb72991..5f13bd25ab4b3e2f5f76b1f49e391a4833b994d9 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -85,7 +85,7 @@ TEST(Promotion) {
int array_length =
(Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) /
(4 * kPointerSize);
- Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked();
+ Object* obj = heap->AllocateFixedArray(array_length).ToObjectChecked();
Handle<FixedArray> array(FixedArray::cast(obj));
// Array should be in the new space.
@@ -110,7 +110,7 @@ TEST(NoPromotion) {
int array_length =
(Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) /
(2 * kPointerSize);
- Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked();
+ Object* obj = heap->AllocateFixedArray(array_length).ToObjectChecked();
Handle<FixedArray> array(FixedArray::cast(obj));
// Array should be in the new space.
@@ -139,22 +139,19 @@ TEST(MarkCompactCollector) {
// keep allocating garbage in new space until it fails
const int ARRAY_SIZE = 100;
- Object* array;
- MaybeObject* maybe_array;
+ AllocationResult allocation;
do {
- maybe_array = heap->AllocateFixedArray(ARRAY_SIZE);
- } while (maybe_array->ToObject(&array));
+ allocation = heap->AllocateFixedArray(ARRAY_SIZE);
+ } while (!allocation.IsRetry());
heap->CollectGarbage(NEW_SPACE, "trigger 2");
- heap->AllocateFixedArray(ARRAY_SIZE)->ToObjectChecked();
+ heap->AllocateFixedArray(ARRAY_SIZE).ToObjectChecked();
// keep allocating maps until it fails
- Object* map;
- MaybeObject* maybe_map;
do {
- maybe_map = heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
- } while (maybe_map->ToObject(&map));
+ allocation = heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
+ } while (!allocation.IsRetry());
heap->CollectGarbage(MAP_SPACE, "trigger 3");
- heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize)->ToObjectChecked();
+ heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize).ToObjectChecked();
{ HandleScope scope(isolate);
// allocate a garbage
@@ -258,11 +255,11 @@ TEST(ObjectGroups) {
v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> g1s1 =
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
+ global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked());
Handle<Object> g1s2 =
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
+ global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked());
Handle<Object> g1c1 =
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
+ global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked());
std::pair<Handle<Object>*, int> g1s1_and_id(&g1s1, 1234);
GlobalHandles::MakeWeak(g1s1.location(),
reinterpret_cast<void*>(&g1s1_and_id),
@@ -277,11 +274,11 @@ TEST(ObjectGroups) {
&WeakPointerCallback);
Handle<Object> g2s1 =
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
+ global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked());
Handle<Object> g2s2 =
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
+ global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked());
Handle<Object> g2c1 =
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
+ global_handles->Create(heap->AllocateFixedArray(1).ToObjectChecked());
std::pair<Handle<Object>*, int> g2s1_and_id(&g2s1, 1234);
GlobalHandles::MakeWeak(g2s1.location(),
reinterpret_cast<void*>(&g2s1_and_id),
@@ -392,7 +389,7 @@ TEST(EmptyObjectGroups) {
v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> object = global_handles->Create(
- CcTest::test_heap()->AllocateFixedArray(1)->ToObjectChecked());
+ CcTest::test_heap()->AllocateFixedArray(1).ToObjectChecked());
TestRetainedObjectInfo info;
global_handles->AddObjectGroup(NULL, 0, &info);
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698