Index: test/cctest/test-mark-compact.cc |
=================================================================== |
--- test/cctest/test-mark-compact.cc (revision 5696) |
+++ test/cctest/test-mark-compact.cc (working copy) |
@@ -85,8 +85,7 @@ |
int array_size = |
(Heap::MaxObjectSizeInPagedSpace() - FixedArray::kHeaderSize) / |
(kPointerSize * 4); |
- Object* obj = Heap::AllocateFixedArray(array_size); |
- CHECK(!obj->IsFailure()); |
+ Object* obj = Heap::AllocateFixedArray(array_size)->ToObjectChecked(); |
Handle<FixedArray> array(FixedArray::cast(obj)); |
@@ -116,7 +115,7 @@ |
// Allocate a big Fixed array in the new space. |
int size = (Heap::MaxObjectSizeInPagedSpace() - FixedArray::kHeaderSize) / |
kPointerSize; |
- Object* obj = Heap::AllocateFixedArray(size); |
+ Object* obj = Heap::AllocateFixedArray(size)->ToObjectChecked(); |
Handle<FixedArray> array(FixedArray::cast(obj)); |
@@ -126,8 +125,10 @@ |
// Allocate objects in the old space until out of memory. |
FixedArray* host = *array; |
while (true) { |
- Object* obj = Heap::AllocateFixedArray(100, TENURED); |
- if (obj->IsFailure()) break; |
+ Object* obj; |
+ { MaybeObject* maybe_obj = Heap::AllocateFixedArray(100, TENURED); |
+ if (!maybe_obj->ToObject(&obj)) break; |
+ } |
host->set(0, obj); |
host = FixedArray::cast(obj); |
@@ -151,59 +152,75 @@ |
// keep allocating garbage in new space until it fails |
const int ARRAY_SIZE = 100; |
Object* array; |
+ MaybeObject* maybe_array; |
do { |
- array = Heap::AllocateFixedArray(ARRAY_SIZE); |
- } while (!array->IsFailure()); |
+ maybe_array = Heap::AllocateFixedArray(ARRAY_SIZE); |
+ } while (maybe_array->ToObject(&array)); |
Heap::CollectGarbage(NEW_SPACE); |
- array = Heap::AllocateFixedArray(ARRAY_SIZE); |
- CHECK(!array->IsFailure()); |
+ array = Heap::AllocateFixedArray(ARRAY_SIZE)->ToObjectChecked(); |
// keep allocating maps until it fails |
Object* mapp; |
+ MaybeObject* maybe_mapp; |
do { |
- mapp = Heap::AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
- } while (!mapp->IsFailure()); |
+ maybe_mapp = Heap::AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
+ } while (maybe_mapp->ToObject(&mapp)); |
Heap::CollectGarbage(MAP_SPACE); |
- mapp = Heap::AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
- CHECK(!mapp->IsFailure()); |
+ mapp = Heap::AllocateMap(JS_OBJECT_TYPE, |
+ JSObject::kHeaderSize)->ToObjectChecked(); |
// allocate a garbage |
- String* func_name = String::cast(Heap::LookupAsciiSymbol("theFunction")); |
- SharedFunctionInfo* function_share = |
- SharedFunctionInfo::cast(Heap::AllocateSharedFunctionInfo(func_name)); |
- JSFunction* function = |
- JSFunction::cast(Heap::AllocateFunction(*Top::function_map(), |
- function_share, |
- Heap::undefined_value())); |
+ String* func_name = |
+ String::cast(Heap::LookupAsciiSymbol("theFunction")->ToObjectChecked()); |
+ SharedFunctionInfo* function_share = SharedFunctionInfo::cast( |
+ Heap::AllocateSharedFunctionInfo(func_name)->ToObjectChecked()); |
+ JSFunction* function = JSFunction::cast( |
+ Heap::AllocateFunction(*Top::function_map(), |
+ function_share, |
+ Heap::undefined_value())->ToObjectChecked()); |
Map* initial_map = |
- Map::cast(Heap::AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize)); |
+ Map::cast(Heap::AllocateMap(JS_OBJECT_TYPE, |
+ JSObject::kHeaderSize)->ToObjectChecked()); |
function->set_initial_map(initial_map); |
- Top::context()->global()->SetProperty(func_name, function, NONE); |
+ Top::context()->global()->SetProperty(func_name, |
+ function, |
+ NONE)->ToObjectChecked(); |
- JSObject* obj = JSObject::cast(Heap::AllocateJSObject(function)); |
+ JSObject* obj = |
+ JSObject::cast(Heap::AllocateJSObject(function)->ToObjectChecked()); |
Heap::CollectGarbage(OLD_POINTER_SPACE); |
- func_name = String::cast(Heap::LookupAsciiSymbol("theFunction")); |
+ func_name = |
+ String::cast(Heap::LookupAsciiSymbol("theFunction")->ToObjectChecked()); |
CHECK(Top::context()->global()->HasLocalProperty(func_name)); |
- Object* func_value = Top::context()->global()->GetProperty(func_name); |
+ Object* func_value = |
+ Top::context()->global()->GetProperty(func_name)->ToObjectChecked(); |
CHECK(func_value->IsJSFunction()); |
function = JSFunction::cast(func_value); |
- obj = JSObject::cast(Heap::AllocateJSObject(function)); |
- String* obj_name = String::cast(Heap::LookupAsciiSymbol("theObject")); |
- Top::context()->global()->SetProperty(obj_name, obj, NONE); |
- String* prop_name = String::cast(Heap::LookupAsciiSymbol("theSlot")); |
- obj->SetProperty(prop_name, Smi::FromInt(23), NONE); |
+ obj = JSObject::cast(Heap::AllocateJSObject(function)->ToObjectChecked()); |
+ String* obj_name = |
+ String::cast(Heap::LookupAsciiSymbol("theObject")->ToObjectChecked()); |
+ Top::context()->global()->SetProperty(obj_name, |
+ obj, |
+ NONE)->ToObjectChecked(); |
+ String* prop_name = |
+ String::cast(Heap::LookupAsciiSymbol("theSlot")->ToObjectChecked()); |
+ obj->SetProperty(prop_name, Smi::FromInt(23), NONE)->ToObjectChecked(); |
Heap::CollectGarbage(OLD_POINTER_SPACE); |
- obj_name = String::cast(Heap::LookupAsciiSymbol("theObject")); |
+ obj_name = |
+ String::cast(Heap::LookupAsciiSymbol("theObject")->ToObjectChecked()); |
CHECK(Top::context()->global()->HasLocalProperty(obj_name)); |
- CHECK(Top::context()->global()->GetProperty(obj_name)->IsJSObject()); |
- obj = JSObject::cast(Top::context()->global()->GetProperty(obj_name)); |
- prop_name = String::cast(Heap::LookupAsciiSymbol("theSlot")); |
- CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23)); |
+ CHECK(Top::context()->global()-> |
+ GetProperty(obj_name)->ToObjectChecked()->IsJSObject()); |
+ obj = JSObject::cast( |
+ Top::context()->global()->GetProperty(obj_name)->ToObjectChecked()); |
+ prop_name = |
+ String::cast(Heap::LookupAsciiSymbol("theSlot")->ToObjectChecked()); |
+ CHECK(obj->GetProperty(prop_name)->ToObjectChecked() == Smi::FromInt(23)); |
} |
@@ -283,9 +300,9 @@ |
v8::HandleScope handle_scope; |
Handle<Object> g1s1 = |
- GlobalHandles::Create(Heap::AllocateFixedArray(1)); |
+ GlobalHandles::Create(Heap::AllocateFixedArray(1)->ToObjectChecked()); |
Handle<Object> g1s2 = |
- GlobalHandles::Create(Heap::AllocateFixedArray(1)); |
+ GlobalHandles::Create(Heap::AllocateFixedArray(1)->ToObjectChecked()); |
GlobalHandles::MakeWeak(g1s1.location(), |
reinterpret_cast<void*>(1234), |
&WeakPointerCallback); |
@@ -294,9 +311,9 @@ |
&WeakPointerCallback); |
Handle<Object> g2s1 = |
- GlobalHandles::Create(Heap::AllocateFixedArray(1)); |
+ GlobalHandles::Create(Heap::AllocateFixedArray(1)->ToObjectChecked()); |
Handle<Object> g2s2 = |
- GlobalHandles::Create(Heap::AllocateFixedArray(1)); |
+ GlobalHandles::Create(Heap::AllocateFixedArray(1)->ToObjectChecked()); |
GlobalHandles::MakeWeak(g2s1.location(), |
reinterpret_cast<void*>(1234), |
&WeakPointerCallback); |