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

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

Issue 3274008: Get gcc to check that we don't ignore return values of functions that can... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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
Index: test/cctest/test-heap.cc
===================================================================
--- test/cctest/test-heap.cc (revision 5365)
+++ test/cctest/test-heap.cc (working copy)
@@ -637,22 +637,27 @@
// Allocate the object.
Handle<JSObject> object = Factory::NewJSObject(function);
Handle<JSArray> array = Handle<JSArray>::cast(object);
- array->Initialize(0);
+ Object* ok = array->Initialize(0);
+ // We just initialized the VM, no heap allocation failure yet.
+ CHECK(!ok->IsFailure());
// Set array length to 0.
- array->SetElementsLength(Smi::FromInt(0));
+ ok = array->SetElementsLength(Smi::FromInt(0));
+ CHECK(!ok->IsFailure());
CHECK_EQ(Smi::FromInt(0), array->length());
CHECK(array->HasFastElements()); // Must be in fast mode.
// array[length] = name.
- array->SetElement(0, *name);
+ ok = array->SetElement(0, *name);
+ CHECK(!ok->IsFailure());
CHECK_EQ(Smi::FromInt(1), array->length());
CHECK_EQ(array->GetElement(0), *name);
// Set array length with larger than smi value.
Handle<Object> length =
Factory::NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1);
- array->SetElementsLength(*length);
+ ok = array->SetElementsLength(*length);
+ CHECK(!ok->IsFailure());
uint32_t int_length = 0;
CHECK(length->ToArrayIndex(&int_length));
@@ -660,7 +665,8 @@
CHECK(array->HasDictionaryElements()); // Must be in slow mode.
// array[length] = name.
- array->SetElement(int_length, *name);
+ ok = array->SetElement(int_length, *name);
+ CHECK(!ok->IsFailure());
uint32_t new_int_length = 0;
CHECK(array->length()->ToArrayIndex(&new_int_length));
CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
@@ -684,9 +690,12 @@
obj->SetProperty(*first, Smi::FromInt(1), NONE);
obj->SetProperty(*second, Smi::FromInt(2), NONE);
- obj->SetElement(0, *first);
- obj->SetElement(1, *second);
+ Object* ok = obj->SetElement(0, *first);
+ CHECK(!ok->IsFailure());
+ ok = obj->SetElement(1, *second);
+ CHECK(!ok->IsFailure());
+
// Make the clone.
Handle<JSObject> clone = Copy(obj);
CHECK(!clone.is_identical_to(obj));
@@ -701,8 +710,10 @@
clone->SetProperty(*first, Smi::FromInt(2), NONE);
clone->SetProperty(*second, Smi::FromInt(1), NONE);
- clone->SetElement(0, *second);
- clone->SetElement(1, *first);
+ ok = clone->SetElement(0, *second);
+ CHECK(!ok->IsFailure());
+ ok = clone->SetElement(1, *first);
+ CHECK(!ok->IsFailure());
CHECK_EQ(obj->GetElement(1), clone->GetElement(0));
CHECK_EQ(obj->GetElement(0), clone->GetElement(1));
« src/utils.h ('K') | « src/utils.h ('k') | test/mjsunit/const-eval-init.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698