| Index: test/cctest/test-heap.cc
|
| diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
|
| index 7f0a25bde137bfa15e134173c914059dfc61b4c5..5f844b5d039997c27cd7a88bdf6d156c3708a3a6 100644
|
| --- a/test/cctest/test-heap.cc
|
| +++ b/test/cctest/test-heap.cc
|
| @@ -42,8 +42,8 @@ using namespace v8::internal;
|
|
|
| // Go through all incremental marking steps in one swoop.
|
| static void SimulateIncrementalMarking() {
|
| - MarkCompactCollector* collector = HEAP->mark_compact_collector();
|
| - IncrementalMarking* marking = HEAP->incremental_marking();
|
| + MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
|
| + IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| if (collector->IsConcurrentSweepingInProgress()) {
|
| collector->WaitUntilSweepingCompleted();
|
| }
|
| @@ -62,9 +62,9 @@ static void SimulateIncrementalMarking() {
|
| static void CheckMap(Map* map, int type, int instance_size) {
|
| CHECK(map->IsHeapObject());
|
| #ifdef DEBUG
|
| - CHECK(HEAP->Contains(map));
|
| + CHECK(CcTest::heap()->Contains(map));
|
| #endif
|
| - CHECK_EQ(HEAP->meta_map(), map->map());
|
| + CHECK_EQ(CcTest::heap()->meta_map(), map->map());
|
| CHECK_EQ(type, map->instance_type());
|
| CHECK_EQ(instance_size, map->instance_size());
|
| }
|
| @@ -72,10 +72,11 @@ static void CheckMap(Map* map, int type, int instance_size) {
|
|
|
| TEST(HeapMaps) {
|
| CcTest::InitializeVM();
|
| - CheckMap(HEAP->meta_map(), MAP_TYPE, Map::kSize);
|
| - CheckMap(HEAP->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize);
|
| - CheckMap(HEAP->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel);
|
| - CheckMap(HEAP->string_map(), STRING_TYPE, kVariableSizeSentinel);
|
| + Heap* heap = CcTest::heap();
|
| + CheckMap(heap->meta_map(), MAP_TYPE, Map::kSize);
|
| + CheckMap(heap->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize);
|
| + CheckMap(heap->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel);
|
| + CheckMap(heap->string_map(), STRING_TYPE, kVariableSizeSentinel);
|
| }
|
|
|
|
|
| @@ -99,7 +100,7 @@ static void CheckSmi(Isolate* isolate, int value, const char* string) {
|
|
|
|
|
| static void CheckNumber(Isolate* isolate, double value, const char* string) {
|
| - Object* obj = HEAP->NumberFromDouble(value)->ToObjectChecked();
|
| + Object* obj = CcTest::heap()->NumberFromDouble(value)->ToObjectChecked();
|
| CHECK(obj->IsNumber());
|
| bool exc;
|
| Handle<Object> handle(obj, isolate);
|
| @@ -148,7 +149,7 @@ static void CheckFindCodeObject(Isolate* isolate) {
|
|
|
| TEST(HeapObjects) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| Heap* heap = isolate->heap();
|
|
|
| @@ -209,10 +210,9 @@ TEST(HeapObjects) {
|
| CHECK(s->IsString());
|
| CHECK_EQ(10, s->length());
|
|
|
| - String* object_string = String::cast(heap->Object_string());
|
| - CHECK(
|
| - Isolate::Current()->context()->global_object()->HasLocalProperty(
|
| - object_string));
|
| + Handle<String> object_string = Handle<String>::cast(factory->Object_string());
|
| + Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object());
|
| + CHECK(JSReceiver::HasLocalProperty(global, object_string));
|
|
|
| // Check ToString for oddballs
|
| CheckOddball(isolate, heap->true_value(), "true");
|
| @@ -250,7 +250,7 @@ TEST(Tagging) {
|
|
|
| TEST(GarbageCollection) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
|
|
| @@ -258,10 +258,13 @@ TEST(GarbageCollection) {
|
| // Check GC.
|
| heap->CollectGarbage(NEW_SPACE);
|
|
|
| + Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object());
|
| Handle<String> name = factory->InternalizeUtf8String("theFunction");
|
| Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
|
| Handle<String> prop_namex = factory->InternalizeUtf8String("theSlotx");
|
| Handle<String> obj_name = factory->InternalizeUtf8String("theObject");
|
| + Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
|
| + Handle<Smi> twenty_four(Smi::FromInt(24), isolate);
|
|
|
| {
|
| HandleScope inner_scope(isolate);
|
| @@ -271,14 +274,11 @@ TEST(GarbageCollection) {
|
| Handle<Map> initial_map =
|
| factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
| function->set_initial_map(*initial_map);
|
| - Isolate::Current()->context()->global_object()->SetProperty(
|
| - *name, *function, NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(global, name, function, NONE, kNonStrictMode);
|
| // Allocate an object. Unrooted after leaving the scope.
|
| Handle<JSObject> obj = factory->NewJSObject(function);
|
| - obj->SetProperty(
|
| - *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
|
| - obj->SetProperty(
|
| - *prop_namex, Smi::FromInt(24), NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
| + JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, kNonStrictMode);
|
|
|
| CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
|
| CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex));
|
| @@ -287,10 +287,9 @@ TEST(GarbageCollection) {
|
| heap->CollectGarbage(NEW_SPACE);
|
|
|
| // Function should be alive.
|
| - CHECK(Isolate::Current()->context()->global_object()->
|
| - HasLocalProperty(*name));
|
| + CHECK(JSReceiver::HasLocalProperty(global, name));
|
| // Check function is retained.
|
| - Object* func_value = Isolate::Current()->context()->global_object()->
|
| + Object* func_value = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*name)->ToObjectChecked();
|
| CHECK(func_value->IsJSFunction());
|
| Handle<JSFunction> function(JSFunction::cast(func_value));
|
| @@ -299,20 +298,17 @@ TEST(GarbageCollection) {
|
| HandleScope inner_scope(isolate);
|
| // Allocate another object, make it reachable from global.
|
| Handle<JSObject> obj = factory->NewJSObject(function);
|
| - Isolate::Current()->context()->global_object()->SetProperty(
|
| - *obj_name, *obj, NONE, kNonStrictMode)->ToObjectChecked();
|
| - obj->SetProperty(
|
| - *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(global, obj_name, obj, NONE, kNonStrictMode);
|
| + JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
| }
|
|
|
| // After gc, it should survive.
|
| heap->CollectGarbage(NEW_SPACE);
|
|
|
| - CHECK(Isolate::Current()->context()->global_object()->
|
| - HasLocalProperty(*obj_name));
|
| - CHECK(Isolate::Current()->context()->global_object()->
|
| + CHECK(JSReceiver::HasLocalProperty(global, obj_name));
|
| + CHECK(CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*obj_name)->ToObjectChecked()->IsJSObject());
|
| - Object* obj = Isolate::Current()->context()->global_object()->
|
| + Object* obj = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*obj_name)->ToObjectChecked();
|
| JSObject* js_obj = JSObject::cast(obj);
|
| CHECK_EQ(Smi::FromInt(23), js_obj->GetProperty(*prop_name));
|
| @@ -343,7 +339,7 @@ TEST(String) {
|
|
|
| TEST(LocalHandles) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
|
|
| v8::HandleScope scope(CcTest::isolate());
|
| @@ -355,7 +351,7 @@ TEST(LocalHandles) {
|
|
|
| TEST(GlobalHandles) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| GlobalHandles* global_handles = isolate->global_handles();
|
| @@ -408,7 +404,7 @@ static void TestWeakGlobalHandleCallback(v8::Isolate* isolate,
|
| TEST(WeakGlobalHandlesScavenge) {
|
| i::FLAG_stress_compaction = false;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| GlobalHandles* global_handles = isolate->global_handles();
|
| @@ -449,7 +445,7 @@ TEST(WeakGlobalHandlesScavenge) {
|
|
|
| TEST(WeakGlobalHandlesMark) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| GlobalHandles* global_handles = isolate->global_handles();
|
| @@ -495,7 +491,7 @@ TEST(WeakGlobalHandlesMark) {
|
| TEST(DeleteWeakGlobalHandle) {
|
| i::FLAG_stress_compaction = false;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| GlobalHandles* global_handles = isolate->global_handles();
|
| @@ -594,12 +590,12 @@ static const char* not_so_random_string_table[] = {
|
| static void CheckInternalizedStrings(const char** strings) {
|
| for (const char* string = *strings; *strings != 0; string = *strings++) {
|
| Object* a;
|
| - MaybeObject* maybe_a = HEAP->InternalizeUtf8String(string);
|
| + MaybeObject* maybe_a = CcTest::heap()->InternalizeUtf8String(string);
|
| // InternalizeUtf8String may return a failure if a GC is needed.
|
| if (!maybe_a->ToObject(&a)) continue;
|
| CHECK(a->IsInternalizedString());
|
| Object* b;
|
| - MaybeObject* maybe_b = HEAP->InternalizeUtf8String(string);
|
| + MaybeObject* maybe_b = CcTest::heap()->InternalizeUtf8String(string);
|
| if (!maybe_b->ToObject(&b)) continue;
|
| CHECK_EQ(b, a);
|
| CHECK(String::cast(b)->IsUtf8EqualTo(CStrVector(string)));
|
| @@ -617,7 +613,7 @@ TEST(StringTable) {
|
|
|
| TEST(FunctionAllocation) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
|
|
| v8::HandleScope sc(CcTest::isolate());
|
| @@ -628,26 +624,28 @@ TEST(FunctionAllocation) {
|
| factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
| function->set_initial_map(*initial_map);
|
|
|
| + Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
|
| + Handle<Smi> twenty_four(Smi::FromInt(24), isolate);
|
| +
|
| Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
|
| Handle<JSObject> obj = factory->NewJSObject(function);
|
| - obj->SetProperty(
|
| - *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
| CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
|
| // Check that we can add properties to function objects.
|
| - function->SetProperty(
|
| - *prop_name, Smi::FromInt(24), NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(function, prop_name, twenty_four, NONE,
|
| + kNonStrictMode);
|
| CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
|
| }
|
|
|
|
|
| TEST(ObjectProperties) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
|
|
| v8::HandleScope sc(CcTest::isolate());
|
| - String* object_string = String::cast(HEAP->Object_string());
|
| - Object* raw_object = Isolate::Current()->context()->global_object()->
|
| + String* object_string = String::cast(CcTest::heap()->Object_string());
|
| + Object* raw_object = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(object_string)->ToObjectChecked();
|
| JSFunction* object_function = JSFunction::cast(raw_object);
|
| Handle<JSFunction> constructor(object_function);
|
| @@ -655,69 +653,65 @@ TEST(ObjectProperties) {
|
| Handle<String> first = factory->InternalizeUtf8String("first");
|
| Handle<String> second = factory->InternalizeUtf8String("second");
|
|
|
| + Handle<Smi> one(Smi::FromInt(1), isolate);
|
| + Handle<Smi> two(Smi::FromInt(2), isolate);
|
| +
|
| // check for empty
|
| - CHECK(!obj->HasLocalProperty(*first));
|
| + CHECK(!JSReceiver::HasLocalProperty(obj, first));
|
|
|
| // add first
|
| - obj->SetProperty(
|
| - *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
| - CHECK(obj->HasLocalProperty(*first));
|
| + JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
| + CHECK(JSReceiver::HasLocalProperty(obj, first));
|
|
|
| // delete first
|
| JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
|
| - CHECK(!obj->HasLocalProperty(*first));
|
| + CHECK(!JSReceiver::HasLocalProperty(obj, first));
|
|
|
| // add first and then second
|
| - obj->SetProperty(
|
| - *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
| - obj->SetProperty(
|
| - *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
|
| - CHECK(obj->HasLocalProperty(*first));
|
| - CHECK(obj->HasLocalProperty(*second));
|
| + JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
| + JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode);
|
| + CHECK(JSReceiver::HasLocalProperty(obj, first));
|
| + CHECK(JSReceiver::HasLocalProperty(obj, second));
|
|
|
| // delete first and then second
|
| JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
|
| - CHECK(obj->HasLocalProperty(*second));
|
| + CHECK(JSReceiver::HasLocalProperty(obj, second));
|
| JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
|
| - CHECK(!obj->HasLocalProperty(*first));
|
| - CHECK(!obj->HasLocalProperty(*second));
|
| + CHECK(!JSReceiver::HasLocalProperty(obj, first));
|
| + CHECK(!JSReceiver::HasLocalProperty(obj, second));
|
|
|
| // add first and then second
|
| - obj->SetProperty(
|
| - *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
| - obj->SetProperty(
|
| - *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
|
| - CHECK(obj->HasLocalProperty(*first));
|
| - CHECK(obj->HasLocalProperty(*second));
|
| + JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
| + JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode);
|
| + CHECK(JSReceiver::HasLocalProperty(obj, first));
|
| + CHECK(JSReceiver::HasLocalProperty(obj, second));
|
|
|
| // delete second and then first
|
| JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION);
|
| - CHECK(obj->HasLocalProperty(*first));
|
| + CHECK(JSReceiver::HasLocalProperty(obj, first));
|
| JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION);
|
| - CHECK(!obj->HasLocalProperty(*first));
|
| - CHECK(!obj->HasLocalProperty(*second));
|
| + CHECK(!JSReceiver::HasLocalProperty(obj, first));
|
| + CHECK(!JSReceiver::HasLocalProperty(obj, second));
|
|
|
| // check string and internalized string match
|
| const char* string1 = "fisk";
|
| Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1));
|
| - obj->SetProperty(
|
| - *s1, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(obj, s1, one, NONE, kNonStrictMode);
|
| Handle<String> s1_string = factory->InternalizeUtf8String(string1);
|
| - CHECK(obj->HasLocalProperty(*s1_string));
|
| + CHECK(JSReceiver::HasLocalProperty(obj, s1_string));
|
|
|
| // check internalized string and string match
|
| const char* string2 = "fugl";
|
| Handle<String> s2_string = factory->InternalizeUtf8String(string2);
|
| - obj->SetProperty(
|
| - *s2_string, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(obj, s2_string, one, NONE, kNonStrictMode);
|
| Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2));
|
| - CHECK(obj->HasLocalProperty(*s2));
|
| + CHECK(JSReceiver::HasLocalProperty(obj, s2));
|
| }
|
|
|
|
|
| TEST(JSObjectMaps) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
|
|
| v8::HandleScope sc(CcTest::isolate());
|
| @@ -732,8 +726,8 @@ TEST(JSObjectMaps) {
|
| Handle<JSObject> obj = factory->NewJSObject(function);
|
|
|
| // Set a propery
|
| - obj->SetProperty(
|
| - *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
|
| + Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
|
| + JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
| CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
|
|
|
| // Check the map has changed
|
| @@ -743,12 +737,12 @@ TEST(JSObjectMaps) {
|
|
|
| TEST(JSArray) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
|
|
| v8::HandleScope sc(CcTest::isolate());
|
| Handle<String> name = factory->InternalizeUtf8String("Array");
|
| - Object* raw_object = Isolate::Current()->context()->global_object()->
|
| + Object* raw_object = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*name)->ToObjectChecked();
|
| Handle<JSFunction> function = Handle<JSFunction>(
|
| JSFunction::cast(raw_object));
|
| @@ -792,12 +786,12 @@ TEST(JSArray) {
|
|
|
| TEST(JSObjectCopy) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
|
|
| v8::HandleScope sc(CcTest::isolate());
|
| - String* object_string = String::cast(HEAP->Object_string());
|
| - Object* raw_object = Isolate::Current()->context()->global_object()->
|
| + String* object_string = String::cast(CcTest::heap()->Object_string());
|
| + Object* raw_object = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(object_string)->ToObjectChecked();
|
| JSFunction* object_function = JSFunction::cast(raw_object);
|
| Handle<JSFunction> constructor(object_function);
|
| @@ -805,10 +799,11 @@ TEST(JSObjectCopy) {
|
| Handle<String> first = factory->InternalizeUtf8String("first");
|
| Handle<String> second = factory->InternalizeUtf8String("second");
|
|
|
| - obj->SetProperty(
|
| - *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
| - obj->SetProperty(
|
| - *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
|
| + Handle<Smi> one(Smi::FromInt(1), isolate);
|
| + Handle<Smi> two(Smi::FromInt(2), isolate);
|
| +
|
| + JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
| + JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode);
|
|
|
| obj->SetElement(0, *first, NONE, kNonStrictMode)->ToObjectChecked();
|
| obj->SetElement(1, *second, NONE, kNonStrictMode)->ToObjectChecked();
|
| @@ -824,10 +819,8 @@ TEST(JSObjectCopy) {
|
| CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
|
|
|
| // Flip the values.
|
| - clone->SetProperty(
|
| - *first, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
|
| - clone->SetProperty(
|
| - *second, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
|
| + JSReceiver::SetProperty(clone, first, two, NONE, kNonStrictMode);
|
| + JSReceiver::SetProperty(clone, second, one, NONE, kNonStrictMode);
|
|
|
| clone->SetElement(0, *second, NONE, kNonStrictMode)->ToObjectChecked();
|
| clone->SetElement(1, *first, NONE, kNonStrictMode)->ToObjectChecked();
|
| @@ -842,7 +835,7 @@ TEST(JSObjectCopy) {
|
|
|
| TEST(StringAllocation) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
|
|
| const unsigned char chars[] = { 0xe5, 0xa4, 0xa7 };
|
| @@ -897,7 +890,7 @@ static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) {
|
|
|
| TEST(Iteration) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
|
|
| @@ -931,7 +924,7 @@ TEST(Iteration) {
|
| objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map());
|
|
|
| CHECK_EQ(objs_count, next_objs_index);
|
| - CHECK_EQ(objs_count, ObjectsFoundInHeap(HEAP, objs, objs_count));
|
| + CHECK_EQ(objs_count, ObjectsFoundInHeap(CcTest::heap(), objs, objs_count));
|
| }
|
|
|
|
|
| @@ -959,11 +952,12 @@ static int LenFromSize(int size) {
|
| TEST(Regression39128) {
|
| // Test case for crbug.com/39128.
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| + Heap* heap = isolate->heap();
|
|
|
| // Increase the chance of 'bump-the-pointer' allocation in old space.
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
|
|
| v8::HandleScope scope(CcTest::isolate());
|
|
|
| @@ -973,7 +967,7 @@ TEST(Regression39128) {
|
|
|
| // Step 1: prepare a map for the object. We add 1 inobject property to it.
|
| Handle<JSFunction> object_ctor(
|
| - Isolate::Current()->native_context()->object_function());
|
| + CcTest::i_isolate()->native_context()->object_function());
|
| CHECK(object_ctor->has_initial_map());
|
| Handle<Map> object_map(object_ctor->initial_map());
|
| // Create a map with single inobject property.
|
| @@ -989,12 +983,12 @@ TEST(Regression39128) {
|
| int allocation_amount = Min(FixedArray::kMaxSize,
|
| Page::kMaxNonCodeHeapObjectSize + kPointerSize);
|
| int allocation_len = LenFromSize(allocation_amount);
|
| - NewSpace* new_space = HEAP->new_space();
|
| + NewSpace* new_space = heap->new_space();
|
| Address* top_addr = new_space->allocation_top_address();
|
| 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(!heap->always_allocate());
|
| + Object* array = heap->AllocateFixedArray(allocation_len)->ToObjectChecked();
|
| CHECK(!array->IsFailure());
|
| CHECK(new_space->Contains(array));
|
| }
|
| @@ -1004,12 +998,12 @@ TEST(Regression39128) {
|
| int fixed_array_len = LenFromSize(to_fill);
|
| CHECK(fixed_array_len < FixedArray::kMaxLength);
|
|
|
| - CHECK(!HEAP->always_allocate());
|
| - Object* array = HEAP->AllocateFixedArray(fixed_array_len)->ToObjectChecked();
|
| + CHECK(!heap->always_allocate());
|
| + Object* array = heap->AllocateFixedArray(fixed_array_len)->ToObjectChecked();
|
| CHECK(!array->IsFailure());
|
| 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());
|
| @@ -1021,15 +1015,15 @@ TEST(Regression39128) {
|
|
|
| // Step 4: clone jsobject, but force always allocate first to create a clone
|
| // in old pointer space.
|
| - Address old_pointer_space_top = HEAP->old_pointer_space()->top();
|
| + Address old_pointer_space_top = heap->old_pointer_space()->top();
|
| AlwaysAllocateScope aa_scope;
|
| - 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.
|
| return;
|
| }
|
| - CHECK(HEAP->old_pointer_space()->Contains(clone->address()));
|
| + CHECK(heap->old_pointer_space()->Contains(clone->address()));
|
| }
|
|
|
|
|
| @@ -1038,7 +1032,7 @@ TEST(TestCodeFlushing) {
|
| if (!FLAG_flush_code) return;
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
| const char* source = "function foo() {"
|
| @@ -1055,21 +1049,21 @@ TEST(TestCodeFlushing) {
|
| }
|
|
|
| // Check function is compiled.
|
| - Object* func_value = Isolate::Current()->context()->global_object()->
|
| + Object* func_value = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*foo_name)->ToObjectChecked();
|
| CHECK(func_value->IsJSFunction());
|
| Handle<JSFunction> function(JSFunction::cast(func_value));
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // The code will survive at least two GCs.
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // Simulate several GCs that use full marking.
|
| const int kAgingThreshold = 6;
|
| for (int i = 0; i < kAgingThreshold; i++) {
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| }
|
|
|
| // foo should no longer be in the compilation cache
|
| @@ -1087,7 +1081,7 @@ TEST(TestCodeFlushingIncremental) {
|
| if (!FLAG_flush_code || !FLAG_flush_code_incrementally) return;
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
| const char* source = "function foo() {"
|
| @@ -1104,22 +1098,22 @@ TEST(TestCodeFlushingIncremental) {
|
| }
|
|
|
| // Check function is compiled.
|
| - Object* func_value = Isolate::Current()->context()->global_object()->
|
| + Object* func_value = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*foo_name)->ToObjectChecked();
|
| CHECK(func_value->IsJSFunction());
|
| Handle<JSFunction> function(JSFunction::cast(func_value));
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // The code will survive at least two GCs.
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // Simulate several GCs that use incremental marking.
|
| const int kAgingThreshold = 6;
|
| for (int i = 0; i < kAgingThreshold; i++) {
|
| SimulateIncrementalMarking();
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| }
|
| CHECK(!function->shared()->is_compiled() || function->IsOptimized());
|
| CHECK(!function->is_compiled() || function->IsOptimized());
|
| @@ -1134,7 +1128,7 @@ TEST(TestCodeFlushingIncremental) {
|
| for (int i = 0; i < kAgingThreshold; i++) {
|
| SimulateIncrementalMarking();
|
| if (!function->next_function_link()->IsUndefined()) break;
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| }
|
|
|
| // Force optimization while incremental marking is active and while
|
| @@ -1144,7 +1138,7 @@ TEST(TestCodeFlushingIncremental) {
|
| }
|
|
|
| // Simulate one final GC to make sure the candidate queue is sane.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| CHECK(function->shared()->is_compiled() || !function->IsOptimized());
|
| CHECK(function->is_compiled() || !function->IsOptimized());
|
| }
|
| @@ -1155,7 +1149,7 @@ TEST(TestCodeFlushingIncrementalScavenge) {
|
| if (!FLAG_flush_code || !FLAG_flush_code_incrementally) return;
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
| const char* source = "var foo = function() {"
|
| @@ -1172,7 +1166,7 @@ TEST(TestCodeFlushingIncrementalScavenge) {
|
| Handle<String> bar_name = factory->InternalizeUtf8String("bar");
|
|
|
| // Perfrom one initial GC to enable code flushing.
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
|
|
| // This compile will add the code to the compilation cache.
|
| { v8::HandleScope scope(CcTest::isolate());
|
| @@ -1180,12 +1174,12 @@ TEST(TestCodeFlushingIncrementalScavenge) {
|
| }
|
|
|
| // Check functions are compiled.
|
| - Object* func_value = Isolate::Current()->context()->global_object()->
|
| + Object* func_value = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*foo_name)->ToObjectChecked();
|
| CHECK(func_value->IsJSFunction());
|
| Handle<JSFunction> function(JSFunction::cast(func_value));
|
| CHECK(function->shared()->is_compiled());
|
| - Object* func_value2 = Isolate::Current()->context()->global_object()->
|
| + Object* func_value2 = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*bar_name)->ToObjectChecked();
|
| CHECK(func_value2->IsJSFunction());
|
| Handle<JSFunction> function2(JSFunction::cast(func_value2));
|
| @@ -1209,10 +1203,10 @@ TEST(TestCodeFlushingIncrementalScavenge) {
|
| // perform a scavenge while incremental marking is still running.
|
| SimulateIncrementalMarking();
|
| *function2.location() = NULL;
|
| - HEAP->CollectGarbage(NEW_SPACE, "test scavenge while marking");
|
| + CcTest::heap()->CollectGarbage(NEW_SPACE, "test scavenge while marking");
|
|
|
| // Simulate one final GC to make sure the candidate queue is sane.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| CHECK(!function->shared()->is_compiled() || function->IsOptimized());
|
| CHECK(!function->is_compiled() || function->IsOptimized());
|
| }
|
| @@ -1223,7 +1217,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
| if (!FLAG_flush_code || !FLAG_flush_code_incrementally) return;
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| Heap* heap = isolate->heap();
|
| v8::HandleScope scope(CcTest::isolate());
|
| @@ -1241,7 +1235,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
| }
|
|
|
| // Check function is compiled.
|
| - Object* func_value = Isolate::Current()->context()->global_object()->
|
| + Object* func_value = CcTest::i_isolate()->context()->global_object()->
|
| GetProperty(*foo_name)->ToObjectChecked();
|
| CHECK(func_value->IsJSFunction());
|
| Handle<JSFunction> function(JSFunction::cast(func_value));
|
| @@ -1287,7 +1281,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
| // Count the number of native contexts in the weak list of native contexts.
|
| int CountNativeContexts() {
|
| int count = 0;
|
| - Object* object = HEAP->native_contexts_list();
|
| + Object* object = CcTest::heap()->native_contexts_list();
|
| while (!object->IsUndefined()) {
|
| count++;
|
| object = Context::cast(object)->get(Context::NEXT_CONTEXT_LINK);
|
| @@ -1319,7 +1313,7 @@ TEST(TestInternalWeakLists) {
|
|
|
| static const int kNumTestContexts = 10;
|
|
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
| v8::Handle<v8::Context> ctx[kNumTestContexts];
|
| @@ -1328,7 +1322,7 @@ TEST(TestInternalWeakLists) {
|
|
|
| // Create a number of global contests which gets linked together.
|
| for (int i = 0; i < kNumTestContexts; i++) {
|
| - ctx[i] = v8::Context::New(v8::Isolate::GetCurrent());
|
| + ctx[i] = v8::Context::New(CcTest::isolate());
|
|
|
| // Collect garbage that might have been created by one of the
|
| // installed extensions.
|
| @@ -1367,7 +1361,7 @@ TEST(TestInternalWeakLists) {
|
|
|
| // Scavenge treats these references as strong.
|
| for (int j = 0; j < 10; j++) {
|
| - HEAP->PerformScavenge();
|
| + CcTest::heap()->PerformScavenge();
|
| CHECK_EQ(opt ? 5 : 0, CountOptimizedUserFunctions(ctx[i]));
|
| }
|
|
|
| @@ -1379,41 +1373,41 @@ TEST(TestInternalWeakLists) {
|
| // Get rid of f3 and f5 in the same way.
|
| CompileRun("f3=null");
|
| for (int j = 0; j < 10; j++) {
|
| - HEAP->PerformScavenge();
|
| + CcTest::heap()->PerformScavenge();
|
| CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i]));
|
| }
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
|
| CompileRun("f5=null");
|
| for (int j = 0; j < 10; j++) {
|
| - HEAP->PerformScavenge();
|
| + CcTest::heap()->PerformScavenge();
|
| CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
|
| }
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctions(ctx[i]));
|
|
|
| ctx[i]->Exit();
|
| }
|
|
|
| // Force compilation cache cleanup.
|
| - HEAP->NotifyContextDisposed();
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->NotifyContextDisposed();
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| // Dispose the native contexts one by one.
|
| for (int i = 0; i < kNumTestContexts; i++) {
|
| // TODO(dcarney): is there a better way to do this?
|
| i::Object** unsafe = reinterpret_cast<i::Object**>(*ctx[i]);
|
| - *unsafe = HEAP->undefined_value();
|
| + *unsafe = CcTest::heap()->undefined_value();
|
| ctx[i].Clear();
|
|
|
| // Scavenge treats these references as strong.
|
| for (int j = 0; j < 10; j++) {
|
| - HEAP->PerformScavenge();
|
| + CcTest::heap()->PerformScavenge();
|
| CHECK_EQ(kNumTestContexts - i, CountNativeContexts());
|
| }
|
|
|
| // Mark compact handles the weak references.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| CHECK_EQ(kNumTestContexts - i - 1, CountNativeContexts());
|
| }
|
|
|
| @@ -1462,7 +1456,7 @@ static int CountOptimizedUserFunctionsWithGC(v8::Handle<v8::Context> context,
|
|
|
| TEST(TestInternalWeakListsTraverseWithGC) {
|
| v8::V8::Initialize();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
|
|
| static const int kNumTestContexts = 10;
|
|
|
| @@ -1474,7 +1468,7 @@ TEST(TestInternalWeakListsTraverseWithGC) {
|
| // Create an number of contexts and check the length of the weak list both
|
| // with and without GCs while iterating the list.
|
| for (int i = 0; i < kNumTestContexts; i++) {
|
| - ctx[i] = v8::Context::New(v8::Isolate::GetCurrent());
|
| + ctx[i] = v8::Context::New(CcTest::isolate());
|
| CHECK_EQ(i + 1, CountNativeContexts());
|
| CHECK_EQ(i + 1, CountNativeContextsWithGC(isolate, i / 2 + 1));
|
| }
|
| @@ -1516,13 +1510,13 @@ TEST(TestSizeOfObjects) {
|
|
|
| // Get initial heap size after several full GCs, which will stabilize
|
| // the heap size and return with sweeping finished completely.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| - CHECK(HEAP->old_pointer_space()->IsLazySweepingComplete());
|
| - int initial_size = static_cast<int>(HEAP->SizeOfObjects());
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CHECK(CcTest::heap()->old_pointer_space()->IsLazySweepingComplete());
|
| + int initial_size = static_cast<int>(CcTest::heap()->SizeOfObjects());
|
|
|
| {
|
| // Allocate objects on several different old-space pages so that
|
| @@ -1530,33 +1524,33 @@ TEST(TestSizeOfObjects) {
|
| AlwaysAllocateScope always_allocate;
|
| int filler_size = static_cast<int>(FixedArray::SizeFor(8192));
|
| for (int i = 1; i <= 100; i++) {
|
| - HEAP->AllocateFixedArray(8192, TENURED)->ToObjectChecked();
|
| + CcTest::heap()->AllocateFixedArray(8192, TENURED)->ToObjectChecked();
|
| CHECK_EQ(initial_size + i * filler_size,
|
| - static_cast<int>(HEAP->SizeOfObjects()));
|
| + static_cast<int>(CcTest::heap()->SizeOfObjects()));
|
| }
|
| }
|
|
|
| // The heap size should go back to initial size after a full GC, even
|
| // though sweeping didn't finish yet.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| // Normally sweeping would not be complete here, but no guarantees.
|
|
|
| - CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects()));
|
| + CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects()));
|
|
|
| // Advancing the sweeper step-wise should not change the heap size.
|
| - while (!HEAP->old_pointer_space()->IsLazySweepingComplete()) {
|
| - HEAP->old_pointer_space()->AdvanceSweeper(KB);
|
| - CHECK_EQ(initial_size, static_cast<int>(HEAP->SizeOfObjects()));
|
| + while (!CcTest::heap()->old_pointer_space()->IsLazySweepingComplete()) {
|
| + CcTest::heap()->old_pointer_space()->AdvanceSweeper(KB);
|
| + CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects()));
|
| }
|
| }
|
|
|
|
|
| TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
|
| CcTest::InitializeVM();
|
| - HEAP->EnsureHeapIsIterable();
|
| - intptr_t size_of_objects_1 = HEAP->SizeOfObjects();
|
| - HeapIterator iterator(HEAP);
|
| + CcTest::heap()->EnsureHeapIsIterable();
|
| + intptr_t size_of_objects_1 = CcTest::heap()->SizeOfObjects();
|
| + HeapIterator iterator(CcTest::heap());
|
| intptr_t size_of_objects_2 = 0;
|
| for (HeapObject* obj = iterator.next();
|
| obj != NULL;
|
| @@ -1605,10 +1599,11 @@ static void FillUpNewSpace(NewSpace* new_space) {
|
|
|
| TEST(GrowAndShrinkNewSpace) {
|
| CcTest::InitializeVM();
|
| - NewSpace* new_space = HEAP->new_space();
|
| + Heap* heap = CcTest::heap();
|
| + NewSpace* new_space = heap->new_space();
|
|
|
| - if (HEAP->ReservedSemiSpaceSize() == HEAP->InitialSemiSpaceSize() ||
|
| - HEAP->MaxSemiSpaceSize() == HEAP->InitialSemiSpaceSize()) {
|
| + if (heap->ReservedSemiSpaceSize() == heap->InitialSemiSpaceSize() ||
|
| + heap->MaxSemiSpaceSize() == heap->InitialSemiSpaceSize()) {
|
| // The max size cannot exceed the reserved size, since semispaces must be
|
| // always within the reserved space. We can't test new space growing and
|
| // shrinking if the reserved size is the same as the minimum (initial) size.
|
| @@ -1634,7 +1629,7 @@ TEST(GrowAndShrinkNewSpace) {
|
| CHECK(old_capacity == new_capacity);
|
|
|
| // Let the scavenger empty the new space.
|
| - HEAP->CollectGarbage(NEW_SPACE);
|
| + heap->CollectGarbage(NEW_SPACE);
|
| CHECK_LE(new_space->Size(), old_capacity);
|
|
|
| // Explicitly shrinking should halve the space capacity.
|
| @@ -1655,9 +1650,9 @@ TEST(GrowAndShrinkNewSpace) {
|
|
|
| TEST(CollectingAllAvailableGarbageShrinksNewSpace) {
|
| CcTest::InitializeVM();
|
| -
|
| - if (HEAP->ReservedSemiSpaceSize() == HEAP->InitialSemiSpaceSize() ||
|
| - HEAP->MaxSemiSpaceSize() == HEAP->InitialSemiSpaceSize()) {
|
| + Heap* heap = CcTest::heap();
|
| + if (heap->ReservedSemiSpaceSize() == heap->InitialSemiSpaceSize() ||
|
| + heap->MaxSemiSpaceSize() == heap->InitialSemiSpaceSize()) {
|
| // The max size cannot exceed the reserved size, since semispaces must be
|
| // always within the reserved space. We can't test new space growing and
|
| // shrinking if the reserved size is the same as the minimum (initial) size.
|
| @@ -1665,14 +1660,14 @@ TEST(CollectingAllAvailableGarbageShrinksNewSpace) {
|
| }
|
|
|
| v8::HandleScope scope(CcTest::isolate());
|
| - NewSpace* new_space = HEAP->new_space();
|
| + NewSpace* new_space = heap->new_space();
|
| intptr_t old_capacity, new_capacity;
|
| old_capacity = new_space->Capacity();
|
| new_space->Grow();
|
| new_capacity = new_space->Capacity();
|
| CHECK(2 * old_capacity == new_capacity);
|
| FillUpNewSpace(new_space);
|
| - HEAP->CollectAllAvailableGarbage();
|
| + heap->CollectAllAvailableGarbage();
|
| new_capacity = new_space->Capacity();
|
| CHECK(old_capacity == new_capacity);
|
| }
|
| @@ -1680,7 +1675,7 @@ TEST(CollectingAllAvailableGarbageShrinksNewSpace) {
|
|
|
| static int NumberOfGlobalObjects() {
|
| int count = 0;
|
| - HeapIterator iterator(HEAP);
|
| + HeapIterator iterator(CcTest::heap());
|
| for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
|
| if (obj->IsGlobalObject()) count++;
|
| }
|
| @@ -1692,7 +1687,7 @@ static int NumberOfGlobalObjects() {
|
| // optimized code.
|
| TEST(LeakNativeContextViaMap) {
|
| i::FLAG_allow_natives_syntax = true;
|
| - v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| v8::HandleScope outer_scope(isolate);
|
| v8::Persistent<v8::Context> ctx1p;
|
| v8::Persistent<v8::Context> ctx2p;
|
| @@ -1703,7 +1698,7 @@ TEST(LeakNativeContextViaMap) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(4, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -1726,10 +1721,10 @@ TEST(LeakNativeContextViaMap) {
|
| ctx1p.Dispose();
|
| v8::V8::ContextDisposedNotification();
|
| }
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
| ctx2p.Dispose();
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
| @@ -1738,7 +1733,7 @@ TEST(LeakNativeContextViaMap) {
|
| // optimized code.
|
| TEST(LeakNativeContextViaFunction) {
|
| i::FLAG_allow_natives_syntax = true;
|
| - v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| v8::HandleScope outer_scope(isolate);
|
| v8::Persistent<v8::Context> ctx1p;
|
| v8::Persistent<v8::Context> ctx2p;
|
| @@ -1749,7 +1744,7 @@ TEST(LeakNativeContextViaFunction) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(4, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -1772,17 +1767,17 @@ TEST(LeakNativeContextViaFunction) {
|
| ctx1p.Dispose();
|
| v8::V8::ContextDisposedNotification();
|
| }
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
| ctx2p.Dispose();
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
|
|
| TEST(LeakNativeContextViaMapKeyed) {
|
| i::FLAG_allow_natives_syntax = true;
|
| - v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| v8::HandleScope outer_scope(isolate);
|
| v8::Persistent<v8::Context> ctx1p;
|
| v8::Persistent<v8::Context> ctx2p;
|
| @@ -1793,7 +1788,7 @@ TEST(LeakNativeContextViaMapKeyed) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(4, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -1816,17 +1811,17 @@ TEST(LeakNativeContextViaMapKeyed) {
|
| ctx1p.Dispose();
|
| v8::V8::ContextDisposedNotification();
|
| }
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
| ctx2p.Dispose();
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
|
|
| TEST(LeakNativeContextViaMapProto) {
|
| i::FLAG_allow_natives_syntax = true;
|
| - v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| + v8::Isolate* isolate = CcTest::isolate();
|
| v8::HandleScope outer_scope(isolate);
|
| v8::Persistent<v8::Context> ctx1p;
|
| v8::Persistent<v8::Context> ctx2p;
|
| @@ -1837,7 +1832,7 @@ TEST(LeakNativeContextViaMapProto) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(4, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -1864,10 +1859,10 @@ TEST(LeakNativeContextViaMapProto) {
|
| ctx1p.Dispose();
|
| v8::V8::ContextDisposedNotification();
|
| }
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
| ctx2p.Dispose();
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
| @@ -1879,12 +1874,12 @@ TEST(InstanceOfStubWriteBarrier) {
|
| #endif
|
|
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft()) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft()) return;
|
| if (i::FLAG_force_marking_deque_overflows) return;
|
| - v8::HandleScope outer_scope(v8::Isolate::GetCurrent());
|
| + v8::HandleScope outer_scope(CcTest::isolate());
|
|
|
| {
|
| - v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| + v8::HandleScope scope(CcTest::isolate());
|
| CompileRun(
|
| "function foo () { }"
|
| "function mkbar () { return new (new Function(\"\")) (); }"
|
| @@ -1895,7 +1890,7 @@ TEST(InstanceOfStubWriteBarrier) {
|
| "f(new foo()); g();");
|
| }
|
|
|
| - IncrementalMarking* marking = HEAP->incremental_marking();
|
| + IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| marking->Abort();
|
| marking->Start();
|
|
|
| @@ -1916,21 +1911,21 @@ TEST(InstanceOfStubWriteBarrier) {
|
| CHECK(marking->IsMarking());
|
|
|
| {
|
| - v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| + v8::HandleScope scope(CcTest::isolate());
|
| v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global();
|
| v8::Handle<v8::Function> g =
|
| v8::Handle<v8::Function>::Cast(global->Get(v8_str("g")));
|
| g->Call(global, 0, NULL);
|
| }
|
|
|
| - HEAP->incremental_marking()->set_should_hurry(true);
|
| - HEAP->CollectGarbage(OLD_POINTER_SPACE);
|
| + CcTest::heap()->incremental_marking()->set_should_hurry(true);
|
| + CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE);
|
| }
|
|
|
|
|
| TEST(PrototypeTransitionClearing) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
|
|
| @@ -1951,7 +1946,7 @@ TEST(PrototypeTransitionClearing) {
|
|
|
| // Verify that only dead prototype transitions are cleared.
|
| CHECK_EQ(10, baseObject->map()->NumberOfProtoTransitions());
|
| - HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| const int transitions = 10 - 3;
|
| CHECK_EQ(transitions, baseObject->map()->NumberOfProtoTransitions());
|
|
|
| @@ -1967,7 +1962,7 @@ TEST(PrototypeTransitionClearing) {
|
|
|
| // Make sure next prototype is placed on an old-space evacuation candidate.
|
| Handle<JSObject> prototype;
|
| - PagedSpace* space = HEAP->old_pointer_space();
|
| + PagedSpace* space = CcTest::heap()->old_pointer_space();
|
| {
|
| AlwaysAllocateScope always_allocate;
|
| SimulateFullSpace(space);
|
| @@ -1983,7 +1978,7 @@ TEST(PrototypeTransitionClearing) {
|
| CHECK(space->LastPage()->Contains(prototype->address()));
|
| JSObject::SetPrototype(baseObject, prototype, false);
|
| CHECK(Map::GetPrototypeTransition(map, prototype)->IsMap());
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| CHECK(Map::GetPrototypeTransition(map, prototype)->IsMap());
|
| }
|
|
|
| @@ -1996,11 +1991,11 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
|
| #endif
|
|
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft()) return;
|
| - v8::HandleScope outer_scope(v8::Isolate::GetCurrent());
|
| + if (!CcTest::i_isolate()->use_crankshaft()) return;
|
| + v8::HandleScope outer_scope(CcTest::isolate());
|
|
|
| {
|
| - v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| + v8::HandleScope scope(CcTest::isolate());
|
| CompileRun(
|
| "function f () {"
|
| " var s = 0;"
|
| @@ -2017,11 +2012,11 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
|
| v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
|
| CHECK(f->IsOptimized());
|
|
|
| - IncrementalMarking* marking = HEAP->incremental_marking();
|
| + IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| marking->Abort();
|
| marking->Start();
|
|
|
| - // The following two calls will increment HEAP->global_ic_age().
|
| + // The following two calls will increment CcTest::heap()->global_ic_age().
|
| const int kLongIdlePauseInMs = 1000;
|
| v8::V8::ContextDisposedNotification();
|
| v8::V8::IdleNotification(kLongIdlePauseInMs);
|
| @@ -2035,11 +2030,11 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
|
| // guard interrupt. But here we didn't ask for that, and there is no
|
| // JS code running to trigger the interrupt, so we explicitly finalize
|
| // here.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags,
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags,
|
| "Test finalizing incremental mark-sweep");
|
| }
|
|
|
| - CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age());
|
| + CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
|
| CHECK_EQ(0, f->shared()->opt_count());
|
| CHECK_EQ(0, f->shared()->code()->profiler_ticks());
|
| }
|
| @@ -2053,7 +2048,7 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
|
| #endif
|
|
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft()) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft()) return;
|
| v8::HandleScope outer_scope(CcTest::isolate());
|
|
|
| {
|
| @@ -2074,15 +2069,15 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
|
| v8::Context::GetCurrent()->Global()->Get(v8_str("f"))));
|
| CHECK(f->IsOptimized());
|
|
|
| - HEAP->incremental_marking()->Abort();
|
| + CcTest::heap()->incremental_marking()->Abort();
|
|
|
| - // The following two calls will increment HEAP->global_ic_age().
|
| + // The following two calls will increment CcTest::heap()->global_ic_age().
|
| // Since incremental marking is off, IdleNotification will do full GC.
|
| const int kLongIdlePauseInMs = 1000;
|
| v8::V8::ContextDisposedNotification();
|
| v8::V8::IdleNotification(kLongIdlePauseInMs);
|
|
|
| - CHECK_EQ(HEAP->global_ic_age(), f->shared()->ic_age());
|
| + CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
|
| CHECK_EQ(0, f->shared()->opt_count());
|
| CHECK_EQ(0, f->shared()->code()->profiler_ticks());
|
| }
|
| @@ -2092,11 +2087,11 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
|
| TEST(OptimizedAllocationAlwaysInNewSpace) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
|
|
| - SimulateFullSpace(HEAP->new_space());
|
| + SimulateFullSpace(CcTest::heap()->new_space());
|
| AlwaysAllocateScope always_allocate;
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function c(x) {"
|
| @@ -2114,17 +2109,17 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InNewSpace(*o));
|
| + CHECK(CcTest::heap()->InNewSpace(*o));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringAllocationFolding) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function DataObject() {"
|
| @@ -2145,22 +2140,22 @@ TEST(OptimizedPretenuringAllocationFolding) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(0)));
|
| - CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(1)));
|
| - CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(2)));
|
| - CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(3)));
|
| - CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(4)));
|
| - CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(5)));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(0)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1)));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(3)));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(4)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(5)));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringAllocationFoldingBlocks) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function DataObject() {"
|
| @@ -2181,22 +2176,22 @@ TEST(OptimizedPretenuringAllocationFoldingBlocks) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(0)));
|
| - CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(1)));
|
| - CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(2)));
|
| - CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(3)));
|
| - CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(4)));
|
| - CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(5)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(0)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1)));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2)));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(3)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(4)));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(5)));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringObjectArrayLiterals) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function f() {"
|
| @@ -2210,18 +2205,18 @@ TEST(OptimizedPretenuringObjectArrayLiterals) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InOldPointerSpace(o->elements()));
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringMixedInObjectProperties) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function f() {"
|
| @@ -2235,24 +2230,24 @@ TEST(OptimizedPretenuringMixedInObjectProperties) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| - CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(0)));
|
| - CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(1)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(0)));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(1)));
|
|
|
| JSObject* inner_object = reinterpret_cast<JSObject*>(o->RawFastPropertyAt(0));
|
| - CHECK(HEAP->InOldPointerSpace(inner_object));
|
| - CHECK(HEAP->InOldDataSpace(inner_object->RawFastPropertyAt(0)));
|
| - CHECK(HEAP->InOldPointerSpace(inner_object->RawFastPropertyAt(1)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(inner_object));
|
| + CHECK(CcTest::heap()->InOldDataSpace(inner_object->RawFastPropertyAt(0)));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(inner_object->RawFastPropertyAt(1)));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringDoubleArrayProperties) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function f() {"
|
| @@ -2266,18 +2261,18 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| - CHECK(HEAP->InOldDataSpace(o->properties()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->properties()));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringdoubleArrayLiterals) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function f() {"
|
| @@ -2291,18 +2286,18 @@ TEST(OptimizedPretenuringdoubleArrayLiterals) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InOldDataSpace(o->elements()));
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldDataSpace(o->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function f() {"
|
| @@ -2322,21 +2317,21 @@ TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
|
|
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| - CHECK(HEAP->InOldPointerSpace(*int_array_handle));
|
| - CHECK(HEAP->InOldPointerSpace(int_array_handle->elements()));
|
| - CHECK(HEAP->InOldPointerSpace(*double_array_handle));
|
| - CHECK(HEAP->InOldDataSpace(double_array_handle->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle));
|
| + CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements()));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringNestedObjectLiterals) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function f() {"
|
| @@ -2356,21 +2351,21 @@ TEST(OptimizedPretenuringNestedObjectLiterals) {
|
|
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| - CHECK(HEAP->InOldPointerSpace(*int_array_handle_1));
|
| - CHECK(HEAP->InOldPointerSpace(int_array_handle_1->elements()));
|
| - CHECK(HEAP->InOldPointerSpace(*int_array_handle_2));
|
| - CHECK(HEAP->InOldPointerSpace(int_array_handle_2->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_1));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_1->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_2));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_2->elements()));
|
| }
|
|
|
|
|
| TEST(OptimizedPretenuringNestedDoubleLiterals) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| v8::Local<v8::Value> res = CompileRun(
|
| "function f() {"
|
| @@ -2392,11 +2387,11 @@ TEST(OptimizedPretenuringNestedDoubleLiterals) {
|
|
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| - CHECK(HEAP->InOldPointerSpace(*double_array_handle_1));
|
| - CHECK(HEAP->InOldDataSpace(double_array_handle_1->elements()));
|
| - CHECK(HEAP->InOldPointerSpace(*double_array_handle_2));
|
| - CHECK(HEAP->InOldDataSpace(double_array_handle_2->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle_1));
|
| + CHECK(CcTest::heap()->InOldDataSpace(double_array_handle_1->elements()));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle_2));
|
| + CHECK(CcTest::heap()->InOldDataSpace(double_array_handle_2->elements()));
|
| }
|
|
|
|
|
| @@ -2404,7 +2399,7 @@ TEST(OptimizedPretenuringNestedDoubleLiterals) {
|
| TEST(OptimizedAllocationArrayLiterals) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
|
|
| @@ -2423,7 +2418,7 @@ TEST(OptimizedAllocationArrayLiterals) {
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
|
|
| - CHECK(HEAP->InNewSpace(o->elements()));
|
| + CHECK(CcTest::heap()->InNewSpace(o->elements()));
|
| }
|
|
|
|
|
| @@ -2431,10 +2426,10 @@ TEST(OptimizedPretenuringCallNew) {
|
| i::FLAG_allow_natives_syntax = true;
|
| i::FLAG_pretenuring_call_new = true;
|
| CcTest::InitializeVM();
|
| - if (!i::Isolate::Current()->use_crankshaft() || i::FLAG_always_opt) return;
|
| + if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
|
| if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| v8::HandleScope scope(CcTest::isolate());
|
| - HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| + CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
|
|
|
| AlwaysAllocateScope always_allocate;
|
| v8::Local<v8::Value> res = CompileRun(
|
| @@ -2448,7 +2443,7 @@ TEST(OptimizedPretenuringCallNew) {
|
|
|
| Handle<JSObject> o =
|
| v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
| - CHECK(HEAP->InOldPointerSpace(*o));
|
| + CHECK(CcTest::heap()->InOldPointerSpace(*o));
|
| }
|
|
|
|
|
| @@ -2488,7 +2483,7 @@ TEST(Regress1465) {
|
| CHECK_EQ(transitions_count, transitions_before);
|
|
|
| SimulateIncrementalMarking();
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| // Count number of live transitions after marking. Note that one transition
|
| // is left, because 'o' still holds an instance of one transition target.
|
| @@ -2522,10 +2517,10 @@ TEST(Regress2143a) {
|
| "f(root);");
|
|
|
| // This bug only triggers with aggressive IC clearing.
|
| - HEAP->AgeInlineCaches();
|
| + CcTest::heap()->AgeInlineCaches();
|
|
|
| // Explicitly request GC to perform final marking step and sweeping.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| Handle<JSObject> root =
|
| v8::Utils::OpenHandle(
|
| @@ -2566,10 +2561,10 @@ TEST(Regress2143b) {
|
| "%DeoptimizeFunction(f);");
|
|
|
| // This bug only triggers with aggressive IC clearing.
|
| - HEAP->AgeInlineCaches();
|
| + CcTest::heap()->AgeInlineCaches();
|
|
|
| // Explicitly request GC to perform final marking step and sweeping.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| Handle<JSObject> root =
|
| v8::Utils::OpenHandle(
|
| @@ -2588,13 +2583,14 @@ TEST(ReleaseOverReservedPages) {
|
| i::FLAG_crankshaft = false;
|
| i::FLAG_always_opt = false;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| + Heap* heap = isolate->heap();
|
| v8::HandleScope scope(CcTest::isolate());
|
| static const int number_of_test_pages = 20;
|
|
|
| // Prepare many pages with low live-bytes count.
|
| - PagedSpace* old_pointer_space = HEAP->old_pointer_space();
|
| + PagedSpace* old_pointer_space = heap->old_pointer_space();
|
| CHECK_EQ(1, old_pointer_space->CountTotalPages());
|
| for (int i = 0; i < number_of_test_pages; i++) {
|
| AlwaysAllocateScope always_allocate;
|
| @@ -2605,14 +2601,14 @@ TEST(ReleaseOverReservedPages) {
|
|
|
| // Triggering one GC will cause a lot of garbage to be discovered but
|
| // even spread across all allocated pages.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered for preparation");
|
| + heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered for preparation");
|
| CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages());
|
|
|
| // Triggering subsequent GCs should cause at least half of the pages
|
| // to be released to the OS after at most two cycles.
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1");
|
| + heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1");
|
| CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages());
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2");
|
| + heap->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2");
|
| CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2);
|
|
|
| // Triggering a last-resort GC should cause all pages to be released to the
|
| @@ -2622,7 +2618,7 @@ TEST(ReleaseOverReservedPages) {
|
| // first page should be small in order to reduce memory used when the VM
|
| // boots, but if the 20 small arrays don't fit on the first page then that's
|
| // an indication that it is too small.
|
| - HEAP->CollectAllAvailableGarbage("triggered really hard");
|
| + heap->CollectAllAvailableGarbage("triggered really hard");
|
| CHECK_EQ(1, old_pointer_space->CountTotalPages());
|
| }
|
|
|
| @@ -2630,10 +2626,10 @@ TEST(ReleaseOverReservedPages) {
|
| TEST(Regress2237) {
|
| i::FLAG_stress_compaction = false;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
| - Handle<String> slice(HEAP->empty_string());
|
| + Handle<String> slice(CcTest::heap()->empty_string());
|
|
|
| {
|
| // Generate a parent that lives in new-space.
|
| @@ -2641,20 +2637,20 @@ TEST(Regress2237) {
|
| const char* c = "This text is long enough to trigger sliced strings.";
|
| Handle<String> s = factory->NewStringFromAscii(CStrVector(c));
|
| CHECK(s->IsSeqOneByteString());
|
| - CHECK(HEAP->InNewSpace(*s));
|
| + CHECK(CcTest::heap()->InNewSpace(*s));
|
|
|
| // Generate a sliced string that is based on the above parent and
|
| // lives in old-space.
|
| - SimulateFullSpace(HEAP->new_space());
|
| + SimulateFullSpace(CcTest::heap()->new_space());
|
| AlwaysAllocateScope always_allocate;
|
| Handle<String> t = factory->NewProperSubString(s, 5, 35);
|
| CHECK(t->IsSlicedString());
|
| - CHECK(!HEAP->InNewSpace(*t));
|
| + CHECK(!CcTest::heap()->InNewSpace(*t));
|
| *slice.location() = *t.location();
|
| }
|
|
|
| CHECK(SlicedString::cast(*slice)->parent()->IsSeqOneByteString());
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
| CHECK(SlicedString::cast(*slice)->parent()->IsSeqOneByteString());
|
| }
|
|
|
| @@ -2683,7 +2679,7 @@ TEST(Regress2211) {
|
|
|
| v8::Handle<v8::String> value = v8_str("val string");
|
| Smi* hash = Smi::FromInt(321);
|
| - Heap* heap = Isolate::Current()->heap();
|
| + Heap* heap = CcTest::heap();
|
|
|
| for (int i = 0; i < 2; i++) {
|
| // Store identity hash first and common hidden property second.
|
| @@ -2747,7 +2743,7 @@ TEST(IncrementalMarkingClearsTypeFeedbackCells) {
|
| CHECK(cells->GetCell(1)->value()->IsJSFunction());
|
|
|
| SimulateIncrementalMarking();
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| CHECK_EQ(2, cells->CellCount());
|
| CHECK(cells->GetCell(0)->value()->IsTheHole());
|
| @@ -2789,7 +2785,7 @@ TEST(IncrementalMarkingPreservesMonomorhpicIC) {
|
| CHECK(ic_before->ic_state() == MONOMORPHIC);
|
|
|
| SimulateIncrementalMarking();
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
|
| CHECK(ic_after->ic_state() == MONOMORPHIC);
|
| @@ -2823,7 +2819,7 @@ TEST(IncrementalMarkingClearsMonomorhpicIC) {
|
| // Fire context dispose notification.
|
| v8::V8::ContextDisposedNotification();
|
| SimulateIncrementalMarking();
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
|
| CHECK(ic_after->ic_state() == UNINITIALIZED);
|
| @@ -2864,7 +2860,7 @@ TEST(IncrementalMarkingClearsPolymorhpicIC) {
|
| // Fire context dispose notification.
|
| v8::V8::ContextDisposedNotification();
|
| SimulateIncrementalMarking();
|
| - HEAP->CollectAllGarbage(Heap::kNoGCFlags);
|
| + CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
|
|
|
| Code* ic_after = FindFirstIC(f->shared()->code(), Code::LOAD_IC);
|
| CHECK(ic_after->ic_state() == UNINITIALIZED);
|
| @@ -2900,21 +2896,20 @@ void ReleaseStackTraceDataTest(const char* source, const char* accessor) {
|
| // resource's callback is fired when the external string is GC'ed.
|
| FLAG_use_ic = false; // ICs retain objects.
|
| FLAG_concurrent_recompilation = false;
|
| - CcTest::InitializeVM();
|
| v8::HandleScope scope(CcTest::isolate());
|
| SourceResource* resource = new SourceResource(i::StrDup(source));
|
| {
|
| v8::HandleScope scope(CcTest::isolate());
|
| v8::Handle<v8::String> source_string = v8::String::NewExternal(resource);
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
| v8::Script::Compile(source_string)->Run();
|
| CHECK(!resource->IsDisposed());
|
| }
|
| - // HEAP->CollectAllAvailableGarbage();
|
| + // CcTest::heap()->CollectAllAvailableGarbage();
|
| CHECK(!resource->IsDisposed());
|
|
|
| CompileRun(accessor);
|
| - HEAP->CollectAllAvailableGarbage();
|
| + CcTest::heap()->CollectAllAvailableGarbage();
|
|
|
| // External source has been released.
|
| CHECK(resource->IsDisposed());
|
| @@ -2923,6 +2918,7 @@ void ReleaseStackTraceDataTest(const char* source, const char* accessor) {
|
|
|
|
|
| TEST(ReleaseStackTraceData) {
|
| + CcTest::InitializeVM();
|
| static const char* source1 = "var error = null; "
|
| /* Normal Error */ "try { "
|
| " throw new Error(); "
|
| @@ -2968,7 +2964,7 @@ TEST(ReleaseStackTraceData) {
|
| TEST(Regression144230) {
|
| i::FLAG_stress_compaction = false;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| @@ -3009,9 +3005,10 @@ TEST(Regression144230) {
|
| // visited later, causing the CallIC to be cleared.
|
| Handle<String> name = isolate->factory()->InternalizeUtf8String("call");
|
| Handle<GlobalObject> global(isolate->context()->global_object());
|
| + Handle<Smi> zero(Smi::FromInt(0), isolate);
|
| MaybeObject* maybe_call = global->GetProperty(*name);
|
| JSFunction* call = JSFunction::cast(maybe_call->ToObjectChecked());
|
| - USE(global->SetProperty(*name, Smi::FromInt(0), NONE, kNonStrictMode));
|
| + JSReceiver::SetProperty(global, name, zero, NONE, kNonStrictMode);
|
| isolate->compilation_cache()->Clear();
|
| call->shared()->set_ic_age(heap->global_ic_age() + 1);
|
| Handle<Object> call_code(call->code(), isolate);
|
| @@ -3022,7 +3019,7 @@ TEST(Regression144230) {
|
|
|
| // Either heap verification caught the problem already or we go kaboom once
|
| // the CallIC is executed the next time.
|
| - USE(global->SetProperty(*name, *call_function, NONE, kNonStrictMode));
|
| + JSReceiver::SetProperty(global, name, call_function, NONE, kNonStrictMode);
|
| CompileRun("call();");
|
| }
|
|
|
| @@ -3031,7 +3028,7 @@ TEST(Regress159140) {
|
| i::FLAG_allow_natives_syntax = true;
|
| i::FLAG_flush_code_incrementally = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| @@ -3093,7 +3090,7 @@ TEST(Regress165495) {
|
| i::FLAG_allow_natives_syntax = true;
|
| i::FLAG_flush_code_incrementally = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| @@ -3142,7 +3139,7 @@ TEST(Regress169209) {
|
| i::FLAG_flush_code_incrementally = true;
|
|
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| @@ -3228,7 +3225,7 @@ TEST(Regress169928) {
|
| i::FLAG_allow_natives_syntax = true;
|
| i::FLAG_crankshaft = false;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| v8::HandleScope scope(CcTest::isolate());
|
|
|
| @@ -3257,14 +3254,14 @@ TEST(Regress169928) {
|
| v8::Context::GetCurrent()->Global()->Set(array_name, v8::Int32::New(0));
|
|
|
| // First make sure we flip spaces
|
| - HEAP->CollectGarbage(NEW_SPACE);
|
| + CcTest::heap()->CollectGarbage(NEW_SPACE);
|
|
|
| // Allocate the object.
|
| Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED);
|
| array_data->set(0, Smi::FromInt(1));
|
| array_data->set(1, Smi::FromInt(2));
|
|
|
| - AllocateAllButNBytes(HEAP->new_space(),
|
| + AllocateAllButNBytes(CcTest::heap()->new_space(),
|
| JSArray::kSize + AllocationMemento::kSize +
|
| kPointerSize);
|
|
|
| @@ -3277,13 +3274,13 @@ TEST(Regress169928) {
|
|
|
| // We need filler the size of AllocationMemento object, plus an extra
|
| // fill pointer value.
|
| - MaybeObject* maybe_object = HEAP->AllocateRaw(
|
| + MaybeObject* maybe_object = CcTest::heap()->AllocateRaw(
|
| AllocationMemento::kSize + kPointerSize, NEW_SPACE, OLD_POINTER_SPACE);
|
| Object* obj = NULL;
|
| CHECK(maybe_object->ToObject(&obj));
|
| Address addr_obj = reinterpret_cast<Address>(
|
| reinterpret_cast<byte*>(obj - kHeapObjectTag));
|
| - HEAP->CreateFillerObjectAt(addr_obj,
|
| + CcTest::heap()->CreateFillerObjectAt(addr_obj,
|
| AllocationMemento::kSize + kPointerSize);
|
|
|
| // Give the array a name, making sure not to allocate strings.
|
| @@ -3303,7 +3300,7 @@ TEST(Regress168801) {
|
| i::FLAG_allow_natives_syntax = true;
|
| i::FLAG_flush_code_incrementally = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| @@ -3359,7 +3356,7 @@ TEST(Regress173458) {
|
| i::FLAG_allow_natives_syntax = true;
|
| i::FLAG_flush_code_incrementally = true;
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| @@ -3416,7 +3413,7 @@ class DummyVisitor : public ObjectVisitor {
|
|
|
| TEST(DeferredHandles) {
|
| CcTest::InitializeVM();
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate));
|
| v8::ImplementationUtilities::HandleScopeData* data =
|
| @@ -3444,7 +3441,7 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
|
| " for (var i = 0; i < n; i += 100) a[i] = i;"
|
| "};"
|
| "f(10 * 1024 * 1024);");
|
| - IncrementalMarking* marking = HEAP->incremental_marking();
|
| + IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| if (marking->IsStopped()) marking->Start();
|
| // This big step should be sufficient to mark the whole array.
|
| marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
|
|
|