Commit c57236e2 authored by dcarney@chromium.org's avatar dcarney@chromium.org

remove HEAP from tests

R=svenpanne@chromium.org
BUG=

Review URL: https://codereview.chromium.org/24169005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16819 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8754a251
...@@ -78,9 +78,6 @@ typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags; ...@@ -78,9 +78,6 @@ typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags;
EXTENSION_LIST(DEFINE_EXTENSION_FLAG) EXTENSION_LIST(DEFINE_EXTENSION_FLAG)
#undef DEFINE_EXTENSION_FLAG #undef DEFINE_EXTENSION_FLAG
// Temporary macros for accessing current isolate and its subobjects.
// They provide better readability, especially when used a lot in the code.
#define HEAP (v8::internal::Isolate::Current()->heap())
class CcTest { class CcTest {
public: public:
...@@ -108,6 +105,10 @@ class CcTest { ...@@ -108,6 +105,10 @@ class CcTest {
return reinterpret_cast<i::Isolate*>(isolate()); return reinterpret_cast<i::Isolate*>(isolate());
} }
static i::Heap* heap() {
return i_isolate()->heap();
}
// Helper function to initialize the VM. // Helper function to initialize the VM.
static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS); static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS);
......
...@@ -317,7 +317,7 @@ static void CheckAccessorArgsCorrect( ...@@ -317,7 +317,7 @@ static void CheckAccessorArgsCorrect(
CHECK(info.GetIsolate() == CcTest::isolate()); CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder()); CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data"))); CHECK(info.Data()->Equals(v8::String::New("data")));
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
CHECK(info.GetIsolate() == CcTest::isolate()); CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder()); CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data"))); CHECK(info.Data()->Equals(v8::String::New("data")));
......
...@@ -37,7 +37,7 @@ using namespace v8::internal; ...@@ -37,7 +37,7 @@ using namespace v8::internal;
static MaybeObject* AllocateAfterFailures() { static MaybeObject* AllocateAfterFailures() {
static int attempts = 0; static int attempts = 0;
if (++attempts < 3) return Failure::RetryAfterGC(); if (++attempts < 3) return Failure::RetryAfterGC();
Heap* heap = CcTest::i_isolate()->heap(); Heap* heap = CcTest::heap();
// New space. // New space.
SimulateFullSpace(heap->new_space()); SimulateFullSpace(heap->new_space());
......
This diff is collapsed.
...@@ -61,7 +61,7 @@ TEST(MIPS0) { ...@@ -61,7 +61,7 @@ TEST(MIPS0) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -100,7 +100,7 @@ TEST(MIPS1) { ...@@ -100,7 +100,7 @@ TEST(MIPS1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -241,7 +241,7 @@ TEST(MIPS2) { ...@@ -241,7 +241,7 @@ TEST(MIPS2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -314,7 +314,7 @@ TEST(MIPS3) { ...@@ -314,7 +314,7 @@ TEST(MIPS3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -382,7 +382,7 @@ TEST(MIPS4) { ...@@ -382,7 +382,7 @@ TEST(MIPS4) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -448,7 +448,7 @@ TEST(MIPS5) { ...@@ -448,7 +448,7 @@ TEST(MIPS5) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -521,7 +521,7 @@ TEST(MIPS6) { ...@@ -521,7 +521,7 @@ TEST(MIPS6) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -598,7 +598,7 @@ TEST(MIPS7) { ...@@ -598,7 +598,7 @@ TEST(MIPS7) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -697,7 +697,7 @@ TEST(MIPS8) { ...@@ -697,7 +697,7 @@ TEST(MIPS8) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -745,7 +745,7 @@ TEST(MIPS9) { ...@@ -745,7 +745,7 @@ TEST(MIPS9) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -805,7 +805,7 @@ TEST(MIPS10) { ...@@ -805,7 +805,7 @@ TEST(MIPS10) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -938,7 +938,7 @@ TEST(MIPS11) { ...@@ -938,7 +938,7 @@ TEST(MIPS11) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -1043,7 +1043,7 @@ TEST(MIPS12) { ...@@ -1043,7 +1043,7 @@ TEST(MIPS12) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -1100,7 +1100,7 @@ TEST(MIPS13) { ...@@ -1100,7 +1100,7 @@ TEST(MIPS13) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
...@@ -1221,7 +1221,7 @@ TEST(MIPS14) { ...@@ -1221,7 +1221,7 @@ TEST(MIPS14) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
......
...@@ -317,7 +317,7 @@ TEST(Regression236) { ...@@ -317,7 +317,7 @@ TEST(Regression236) {
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Handle<Script> script = factory->NewScript(factory->empty_string()); Handle<Script> script = factory->NewScript(factory->empty_string());
script->set_source(HEAP->undefined_value()); script->set_source(CcTest::heap()->undefined_value());
CHECK_EQ(-1, GetScriptLineNumber(script, 0)); CHECK_EQ(-1, GetScriptLineNumber(script, 0));
CHECK_EQ(-1, GetScriptLineNumber(script, 100)); CHECK_EQ(-1, GetScriptLineNumber(script, 100));
CHECK_EQ(-1, GetScriptLineNumber(script, -1)); CHECK_EQ(-1, GetScriptLineNumber(script, -1));
......
...@@ -953,7 +953,7 @@ TEST(FunctionCallSample) { ...@@ -953,7 +953,7 @@ TEST(FunctionCallSample) {
v8::HandleScope scope(env->GetIsolate()); v8::HandleScope scope(env->GetIsolate());
// Collect garbage that might have be generated while installing extensions. // Collect garbage that might have be generated while installing extensions.
HEAP->CollectAllGarbage(Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
v8::Script::Compile(v8::String::New(call_function_test_source))->Run(); v8::Script::Compile(v8::String::New(call_function_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
......
...@@ -443,11 +443,11 @@ void CheckDebuggerUnloaded(bool check_functions) { ...@@ -443,11 +443,11 @@ void CheckDebuggerUnloaded(bool check_functions) {
CHECK_EQ(NULL, CcTest::i_isolate()->debug()->debug_info_list_); CHECK_EQ(NULL, CcTest::i_isolate()->debug()->debug_info_list_);
// Collect garbage to ensure weak handles are cleared. // Collect garbage to ensure weak handles are cleared.
HEAP->CollectAllGarbage(Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); CcTest::heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask);
// Iterate the head and check that there are no debugger related objects left. // Iterate the head and check that there are no debugger related objects left.
HeapIterator iterator(HEAP); HeapIterator iterator(CcTest::heap());
for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
CHECK(!obj->IsDebugInfo()); CHECK(!obj->IsDebugInfo());
CHECK(!obj->IsBreakPointInfo()); CHECK(!obj->IsBreakPointInfo());
...@@ -961,10 +961,10 @@ static void DebugEventBreakPointCollectGarbage( ...@@ -961,10 +961,10 @@ static void DebugEventBreakPointCollectGarbage(
break_point_hit_count++; break_point_hit_count++;
if (break_point_hit_count % 2 == 0) { if (break_point_hit_count % 2 == 0) {
// Scavenge. // Scavenge.
HEAP->CollectGarbage(v8::internal::NEW_SPACE); CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
} else { } else {
// Mark sweep compact. // Mark sweep compact.
HEAP->CollectAllGarbage(Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
} }
} }
} }
...@@ -985,7 +985,7 @@ static void DebugEventBreak( ...@@ -985,7 +985,7 @@ static void DebugEventBreak(
// Run the garbage collector to enforce heap verification if option // Run the garbage collector to enforce heap verification if option
// --verify-heap is set. // --verify-heap is set.
HEAP->CollectGarbage(v8::internal::NEW_SPACE); CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
// Set the break flag again to come back here as soon as possible. // Set the break flag again to come back here as soon as possible.
v8::Debug::DebugBreak(CcTest::isolate()); v8::Debug::DebugBreak(CcTest::isolate());
...@@ -1450,12 +1450,12 @@ static void CallAndGC(v8::Local<v8::Object> recv, ...@@ -1450,12 +1450,12 @@ static void CallAndGC(v8::Local<v8::Object> recv,
CHECK_EQ(1 + i * 3, break_point_hit_count); CHECK_EQ(1 + i * 3, break_point_hit_count);
// Scavenge and call function. // Scavenge and call function.
HEAP->CollectGarbage(v8::internal::NEW_SPACE); CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
f->Call(recv, 0, NULL); f->Call(recv, 0, NULL);
CHECK_EQ(2 + i * 3, break_point_hit_count); CHECK_EQ(2 + i * 3, break_point_hit_count);
// Mark sweep (and perhaps compact) and call function. // Mark sweep (and perhaps compact) and call function.
HEAP->CollectAllGarbage(Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
f->Call(recv, 0, NULL); f->Call(recv, 0, NULL);
CHECK_EQ(3 + i * 3, break_point_hit_count); CHECK_EQ(3 + i * 3, break_point_hit_count);
} }
...@@ -2259,7 +2259,7 @@ TEST(ScriptBreakPointLineTopLevel) { ...@@ -2259,7 +2259,7 @@ TEST(ScriptBreakPointLineTopLevel) {
} }
f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
HEAP->CollectAllGarbage(Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
SetScriptBreakPointByNameFromJS("test.html", 3, -1); SetScriptBreakPointByNameFromJS("test.html", 3, -1);
...@@ -6547,7 +6547,7 @@ TEST(ScriptCollectedEvent) { ...@@ -6547,7 +6547,7 @@ TEST(ScriptCollectedEvent) {
// Do garbage collection to ensure that only the script in this test will be // Do garbage collection to ensure that only the script in this test will be
// collected afterwards. // collected afterwards.
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
script_collected_count = 0; script_collected_count = 0;
v8::Debug::SetDebugEventListener2(DebugEventScriptCollectedEvent); v8::Debug::SetDebugEventListener2(DebugEventScriptCollectedEvent);
...@@ -6558,7 +6558,7 @@ TEST(ScriptCollectedEvent) { ...@@ -6558,7 +6558,7 @@ TEST(ScriptCollectedEvent) {
// Do garbage collection to collect the script above which is no longer // Do garbage collection to collect the script above which is no longer
// referenced. // referenced.
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
CHECK_EQ(2, script_collected_count); CHECK_EQ(2, script_collected_count);
...@@ -6609,7 +6609,7 @@ TEST(ScriptCollectedEventContext) { ...@@ -6609,7 +6609,7 @@ TEST(ScriptCollectedEventContext) {
// Do garbage collection to ensure that only the script in this test will be // Do garbage collection to ensure that only the script in this test will be
// collected afterwards. // collected afterwards.
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler); v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler);
v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); v8::Script::Compile(v8::String::New("eval('a=1')"))->Run();
...@@ -6626,7 +6626,7 @@ TEST(ScriptCollectedEventContext) { ...@@ -6626,7 +6626,7 @@ TEST(ScriptCollectedEventContext) {
// Do garbage collection to collect the script above which is no longer // Do garbage collection to collect the script above which is no longer
// referenced. // referenced.
HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
CHECK_EQ(2, script_collected_message_count); CHECK_EQ(2, script_collected_message_count);
......
...@@ -143,7 +143,7 @@ void DeclarationContext::Check(const char* source, ...@@ -143,7 +143,7 @@ void DeclarationContext::Check(const char* source,
InitializeIfNeeded(); InitializeIfNeeded();
// A retry after a GC may pollute the counts, so perform gc now // A retry after a GC may pollute the counts, so perform gc now
// to avoid that. // to avoid that.
HEAP->CollectGarbage(v8::internal::NEW_SPACE); CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
HandleScope scope(CcTest::isolate()); HandleScope scope(CcTest::isolate());
TryCatch catcher; TryCatch catcher;
catcher.SetVerbose(true); catcher.SetVerbose(true);
...@@ -169,7 +169,8 @@ void DeclarationContext::Check(const char* source, ...@@ -169,7 +169,8 @@ void DeclarationContext::Check(const char* source,
CHECK_EQ(value, catcher.Exception()); CHECK_EQ(value, catcher.Exception());
} }
} }
HEAP->CollectAllAvailableGarbage(); // Clean slate for the next test. // Clean slate for the next test.
CcTest::heap()->CollectAllAvailableGarbage();
} }
......
...@@ -104,7 +104,7 @@ class AllowNativesSyntaxNoInliningNoConcurrent { ...@@ -104,7 +104,7 @@ class AllowNativesSyntaxNoInliningNoConcurrent {
// Abort any ongoing incremental marking to make sure that all weak global // Abort any ongoing incremental marking to make sure that all weak global
// handle callbacks are processed. // handle callbacks are processed.
static void NonIncrementalGC() { static void NonIncrementalGC() {
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
} }
......
...@@ -50,13 +50,13 @@ TEST(ObjectHashTable) { ...@@ -50,13 +50,13 @@ TEST(ObjectHashTable) {
table = PutIntoObjectHashTable(table, a, b); table = PutIntoObjectHashTable(table, a, b);
CHECK_EQ(table->NumberOfElements(), 1); CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(table->Lookup(*a), *b); CHECK_EQ(table->Lookup(*a), *b);
CHECK_EQ(table->Lookup(*b), HEAP->the_hole_value()); CHECK_EQ(table->Lookup(*b), CcTest::heap()->the_hole_value());
// Keys still have to be valid after objects were moved. // Keys still have to be valid after objects were moved.
HEAP->CollectGarbage(NEW_SPACE); CcTest::heap()->CollectGarbage(NEW_SPACE);
CHECK_EQ(table->NumberOfElements(), 1); CHECK_EQ(table->NumberOfElements(), 1);
CHECK_EQ(table->Lookup(*a), *b); CHECK_EQ(table->Lookup(*a), *b);
CHECK_EQ(table->Lookup(*b), HEAP->the_hole_value()); CHECK_EQ(table->Lookup(*b), CcTest::heap()->the_hole_value());
// Keys that are overwritten should not change number of elements. // Keys that are overwritten should not change number of elements.
table = PutIntoObjectHashTable(table, a, factory->NewJSArray(13)); table = PutIntoObjectHashTable(table, a, factory->NewJSArray(13));
...@@ -67,7 +67,7 @@ TEST(ObjectHashTable) { ...@@ -67,7 +67,7 @@ TEST(ObjectHashTable) {
table = PutIntoObjectHashTable(table, a, factory->the_hole_value()); table = PutIntoObjectHashTable(table, a, factory->the_hole_value());
CHECK_EQ(table->NumberOfElements(), 0); CHECK_EQ(table->NumberOfElements(), 0);
CHECK_EQ(table->NumberOfDeletedElements(), 1); CHECK_EQ(table->NumberOfDeletedElements(), 1);
CHECK_EQ(table->Lookup(*a), HEAP->the_hole_value()); CHECK_EQ(table->Lookup(*a), CcTest::heap()->the_hole_value());
// Keys should map back to their respective values and also should get // Keys should map back to their respective values and also should get
// an identity hash code generated. // an identity hash code generated.
...@@ -87,7 +87,7 @@ TEST(ObjectHashTable) { ...@@ -87,7 +87,7 @@ TEST(ObjectHashTable) {
Handle<JSReceiver> key = factory->NewJSArray(7); Handle<JSReceiver> key = factory->NewJSArray(7);
CHECK(key->GetIdentityHash(ALLOW_CREATION)->ToObjectChecked()->IsSmi()); CHECK(key->GetIdentityHash(ALLOW_CREATION)->ToObjectChecked()->IsSmi());
CHECK_EQ(table->FindEntry(*key), ObjectHashTable::kNotFound); CHECK_EQ(table->FindEntry(*key), ObjectHashTable::kNotFound);
CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value()); CHECK_EQ(table->Lookup(*key), CcTest::heap()->the_hole_value());
CHECK(key->GetIdentityHash(OMIT_CREATION)->ToObjectChecked()->IsSmi()); CHECK(key->GetIdentityHash(OMIT_CREATION)->ToObjectChecked()->IsSmi());
} }
...@@ -95,8 +95,9 @@ TEST(ObjectHashTable) { ...@@ -95,8 +95,9 @@ TEST(ObjectHashTable) {
// should not get an identity hash code generated. // should not get an identity hash code generated.
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
Handle<JSReceiver> key = factory->NewJSArray(7); Handle<JSReceiver> key = factory->NewJSArray(7);
CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value()); CHECK_EQ(table->Lookup(*key), CcTest::heap()->the_hole_value());
CHECK_EQ(key->GetIdentityHash(OMIT_CREATION), HEAP->undefined_value()); CHECK_EQ(key->GetIdentityHash(OMIT_CREATION),
CcTest::heap()->undefined_value());
} }
} }
...@@ -170,8 +171,8 @@ TEST(ObjectHashSetCausesGC) { ...@@ -170,8 +171,8 @@ TEST(ObjectHashSetCausesGC) {
// Simulate a full heap so that generating an identity hash code // Simulate a full heap so that generating an identity hash code
// in subsequent calls will request GC. // in subsequent calls will request GC.
SimulateFullSpace(HEAP->new_space()); SimulateFullSpace(CcTest::heap()->new_space());
SimulateFullSpace(HEAP->old_pointer_space()); SimulateFullSpace(CcTest::heap()->old_pointer_space());
// Calling Contains() should not cause GC ever. // Calling Contains() should not cause GC ever.
CHECK(!table->Contains(*key)); CHECK(!table->Contains(*key));
...@@ -203,8 +204,8 @@ TEST(ObjectHashTableCausesGC) { ...@@ -203,8 +204,8 @@ TEST(ObjectHashTableCausesGC) {
// Simulate a full heap so that generating an identity hash code // Simulate a full heap so that generating an identity hash code
// in subsequent calls will request GC. // in subsequent calls will request GC.
SimulateFullSpace(HEAP->new_space()); SimulateFullSpace(CcTest::heap()->new_space());
SimulateFullSpace(HEAP->old_pointer_space()); SimulateFullSpace(CcTest::heap()->old_pointer_space());
// Calling Lookup() should not cause GC ever. // Calling Lookup() should not cause GC ever.
CHECK(table->Lookup(*key)->IsTheHole()); CHECK(table->Lookup(*key)->IsTheHole());
......
...@@ -401,7 +401,7 @@ TEST(DisasmX64) { ...@@ -401,7 +401,7 @@ TEST(DisasmX64) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = HEAP->CreateCode( Object* code = CcTest::heap()->CreateCode(
desc, desc,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
......
...@@ -82,7 +82,7 @@ static void CheckFunctionName(v8::Handle<v8::Script> script, ...@@ -82,7 +82,7 @@ static void CheckFunctionName(v8::Handle<v8::Script> script,
isolate->debug()->PrepareForBreakPoints(); isolate->debug()->PrepareForBreakPoints();
Object* shared_func_info_ptr = Object* shared_func_info_ptr =
isolate->debug()->FindSharedFunctionInfoInScript(i_script, func_pos); isolate->debug()->FindSharedFunctionInfoInScript(i_script, func_pos);
CHECK(shared_func_info_ptr != HEAP->undefined_value()); CHECK(shared_func_info_ptr != CcTest::heap()->undefined_value());
Handle<SharedFunctionInfo> shared_func_info( Handle<SharedFunctionInfo> shared_func_info(
SharedFunctionInfo::cast(shared_func_info_ptr)); SharedFunctionInfo::cast(shared_func_info_ptr));
......
...@@ -87,18 +87,18 @@ class TestObjectVisitor : public ObjectVisitor { ...@@ -87,18 +87,18 @@ class TestObjectVisitor : public ObjectVisitor {
TEST(IterateObjectGroupsOldApi) { TEST(IterateObjectGroupsOldApi) {
CcTest::InitializeVM(); CcTest::InitializeVM();
GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); GlobalHandles* global_handles = CcTest::i_isolate()->global_handles();
Heap* heap = CcTest::heap();
v8::HandleScope handle_scope(CcTest::isolate()); v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> g1s1 = Handle<Object> g1s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g1s2 = Handle<Object> g1s2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2s1 = Handle<Object> g2s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2s2 = Handle<Object> g2s2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
TestRetainedObjectInfo info1; TestRetainedObjectInfo info1;
TestRetainedObjectInfo info2; TestRetainedObjectInfo info2;
...@@ -182,18 +182,19 @@ TEST(IterateObjectGroupsOldApi) { ...@@ -182,18 +182,19 @@ TEST(IterateObjectGroupsOldApi) {
TEST(IterateObjectGroups) { TEST(IterateObjectGroups) {
CcTest::InitializeVM(); CcTest::InitializeVM();
GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); GlobalHandles* global_handles = CcTest::i_isolate()->global_handles();
Heap* heap = CcTest::heap();
v8::HandleScope handle_scope(CcTest::isolate()); v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> g1s1 = Handle<Object> g1s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g1s2 = Handle<Object> g1s2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2s1 = Handle<Object> g2s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2s2 = Handle<Object> g2s2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
TestRetainedObjectInfo info1; TestRetainedObjectInfo info1;
TestRetainedObjectInfo info2; TestRetainedObjectInfo info2;
...@@ -276,23 +277,24 @@ TEST(IterateObjectGroups) { ...@@ -276,23 +277,24 @@ TEST(IterateObjectGroups) {
TEST(ImplicitReferences) { TEST(ImplicitReferences) {
CcTest::InitializeVM(); CcTest::InitializeVM();
GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); GlobalHandles* global_handles = CcTest::i_isolate()->global_handles();
Heap* heap = CcTest::heap();
v8::HandleScope handle_scope(CcTest::isolate()); v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> g1s1 = Handle<Object> g1s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g1c1 = Handle<Object> g1c1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g1c2 = Handle<Object> g1c2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2s1 = Handle<Object> g2s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2s2 = Handle<Object> g2s2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2c1 = Handle<Object> g2c1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
global_handles->SetObjectGroupId(g1s1.location(), UniqueId(1)); global_handles->SetObjectGroupId(g1s1.location(), UniqueId(1));
global_handles->SetObjectGroupId(g2s1.location(), UniqueId(2)); global_handles->SetObjectGroupId(g2s1.location(), UniqueId(2));
......
...@@ -505,7 +505,7 @@ TEST(HeapSnapshotAddressReuse) { ...@@ -505,7 +505,7 @@ TEST(HeapSnapshotAddressReuse) {
CompileRun( CompileRun(
"for (var i = 0; i < 10000; ++i)\n" "for (var i = 0; i < 10000; ++i)\n"
" a[i] = new A();\n"); " a[i] = new A();\n");
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
const v8::HeapSnapshot* snapshot2 = const v8::HeapSnapshot* snapshot2 =
heap_profiler->TakeHeapSnapshot(v8_str("snapshot2")); heap_profiler->TakeHeapSnapshot(v8_str("snapshot2"));
...@@ -549,7 +549,7 @@ TEST(HeapEntryIdsAndArrayShift) { ...@@ -549,7 +549,7 @@ TEST(HeapEntryIdsAndArrayShift) {
"for (var i = 0; i < 1; ++i)\n" "for (var i = 0; i < 1; ++i)\n"
" a.shift();\n"); " a.shift();\n");
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
const v8::HeapSnapshot* snapshot2 = const v8::HeapSnapshot* snapshot2 =
heap_profiler->TakeHeapSnapshot(v8_str("s2")); heap_profiler->TakeHeapSnapshot(v8_str("s2"));
...@@ -594,7 +594,7 @@ TEST(HeapEntryIdsAndGC) { ...@@ -594,7 +594,7 @@ TEST(HeapEntryIdsAndGC) {
heap_profiler->TakeHeapSnapshot(s1_str); heap_profiler->TakeHeapSnapshot(s1_str);
CHECK(ValidateSnapshot(snapshot1)); CHECK(ValidateSnapshot(snapshot1));
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
const v8::HeapSnapshot* snapshot2 = const v8::HeapSnapshot* snapshot2 =
heap_profiler->TakeHeapSnapshot(s2_str); heap_profiler->TakeHeapSnapshot(s2_str);
...@@ -901,7 +901,7 @@ TEST(HeapSnapshotObjectsStats) { ...@@ -901,7 +901,7 @@ TEST(HeapSnapshotObjectsStats) {
// We have to call GC 6 times. In other case the garbage will be // We have to call GC 6 times. In other case the garbage will be
// the reason of flakiness. // the reason of flakiness.
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
} }
v8::SnapshotObjectId initial_id; v8::SnapshotObjectId initial_id;
......
This diff is collapsed.
...@@ -439,7 +439,7 @@ TEST(EquivalenceOfLoggingAndTraversal) { ...@@ -439,7 +439,7 @@ TEST(EquivalenceOfLoggingAndTraversal) {
" (function a(j) { return function b() { return j; } })(100);\n" " (function a(j) { return function b() { return j; } })(100);\n"
"})(this);"); "})(this);");
logger->StopProfiler(); logger->StopProfiler();
HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
logger->StringEvent("test-logging-done", ""); logger->StringEvent("test-logging-done", "");
// Iterate heap to find compiled functions, will write to log. // Iterate heap to find compiled functions, will write to log.
......
...@@ -81,7 +81,8 @@ TEST(Promotion) { ...@@ -81,7 +81,8 @@ TEST(Promotion) {
// from new space. // from new space.
FLAG_gc_global = true; FLAG_gc_global = true;
FLAG_always_compact = true; FLAG_always_compact = true;
HEAP->ConfigureHeap(2*256*KB, 8*MB, 8*MB); Heap* heap = CcTest::heap();
heap->ConfigureHeap(2*256*KB, 8*MB, 8*MB);
CcTest::InitializeVM(); CcTest::InitializeVM();
...@@ -91,23 +92,23 @@ TEST(Promotion) { ...@@ -91,23 +92,23 @@ TEST(Promotion) {
int array_size = int array_size =
(Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) / (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) /
(kPointerSize * 4); (kPointerSize * 4);
Object* obj = HEAP->AllocateFixedArray(array_size)->ToObjectChecked(); Object* obj = heap->AllocateFixedArray(array_size)->ToObjectChecked();
Handle<FixedArray> array(FixedArray::cast(obj)); Handle<FixedArray> array(FixedArray::cast(obj));
// Array should be in the new space. // Array should be in the new space.
CHECK(HEAP->InSpace(*array, NEW_SPACE)); CHECK(heap->InSpace(*array, NEW_SPACE));
// Call the m-c collector, so array becomes an old object. // Call the m-c collector, so array becomes an old object.
HEAP->CollectGarbage(OLD_POINTER_SPACE); heap->CollectGarbage(OLD_POINTER_SPACE);
// Array now sits in the old space // Array now sits in the old space
CHECK(HEAP->InSpace(*array, OLD_POINTER_SPACE)); CHECK(heap->InSpace(*array, OLD_POINTER_SPACE));
} }
TEST(NoPromotion) { TEST(NoPromotion) {
HEAP->ConfigureHeap(2*256*KB, 8*MB, 8*MB); CcTest::heap()->ConfigureHeap(2*256*KB, 8*MB, 8*MB);
// Test the situation that some objects in new space are promoted to // Test the situation that some objects in new space are promoted to
// the old space // the old space
...@@ -116,24 +117,24 @@ TEST(NoPromotion) { ...@@ -116,24 +117,24 @@ TEST(NoPromotion) {
v8::HandleScope sc(CcTest::isolate()); v8::HandleScope sc(CcTest::isolate());
// Do a mark compact GC to shrink the heap. // Do a mark compact GC to shrink the heap.
HEAP->CollectGarbage(OLD_POINTER_SPACE); CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE);
// Allocate a big Fixed array in the new space. // Allocate a big Fixed array in the new space.
int length = (Page::kMaxNonCodeHeapObjectSize - int length = (Page::kMaxNonCodeHeapObjectSize -
FixedArray::kHeaderSize) / (2 * kPointerSize); FixedArray::kHeaderSize) / (2 * kPointerSize);
Object* obj = CcTest::i_isolate()->heap()->AllocateFixedArray(length)-> Object* obj = CcTest::heap()->AllocateFixedArray(length)->
ToObjectChecked(); ToObjectChecked();
Handle<FixedArray> array(FixedArray::cast(obj)); Handle<FixedArray> array(FixedArray::cast(obj));
// Array still stays in the new space. // Array still stays in the new space.
CHECK(HEAP->InSpace(*array, NEW_SPACE)); CHECK(CcTest::heap()->InSpace(*array, NEW_SPACE));
// Allocate objects in the old space until out of memory. // Allocate objects in the old space until out of memory.
FixedArray* host = *array; FixedArray* host = *array;
while (true) { while (true) {
Object* obj; Object* obj;
{ MaybeObject* maybe_obj = HEAP->AllocateFixedArray(100, TENURED); { MaybeObject* maybe_obj = CcTest::heap()->AllocateFixedArray(100, TENURED);
if (!maybe_obj->ToObject(&obj)) break; if (!maybe_obj->ToObject(&obj)) break;
} }
...@@ -142,7 +143,7 @@ TEST(NoPromotion) { ...@@ -142,7 +143,7 @@ TEST(NoPromotion) {
} }
// Call mark compact GC, and it should pass. // Call mark compact GC, and it should pass.
HEAP->CollectGarbage(OLD_POINTER_SPACE); CcTest::heap()->CollectGarbage(OLD_POINTER_SPACE);
} }
...@@ -255,15 +256,15 @@ TEST(MapCompact) { ...@@ -255,15 +256,15 @@ TEST(MapCompact) {
Handle<Map> map = CreateMap(); Handle<Map> map = CreateMap();
map->set_prototype(*root); map->set_prototype(*root);
root = factory->NewJSObjectFromMap(map); root = factory->NewJSObjectFromMap(map);
} while (HEAP->map_space()->MapPointersEncodable()); } while (CcTest::heap()->map_space()->MapPointersEncodable());
} }
// Now, as we don't have any handles to just allocated maps, we should // Now, as we don't have any handles to just allocated maps, we should
// be able to trigger map compaction. // be able to trigger map compaction.
// To give an additional chance to fail, try to force compaction which // To give an additional chance to fail, try to force compaction which
// should be impossible right now. // should be impossible right now.
HEAP->CollectAllGarbage(Heap::kForceCompactionMask); CcTest::heap()->CollectAllGarbage(Heap::kForceCompactionMask);
// And now map pointers should be encodable again. // And now map pointers should be encodable again.
CHECK(HEAP->map_space()->MapPointersEncodable()); CHECK(CcTest::heap()->map_space()->MapPointersEncodable());
} }
#endif #endif
...@@ -282,16 +283,16 @@ TEST(ObjectGroups) { ...@@ -282,16 +283,16 @@ TEST(ObjectGroups) {
FLAG_incremental_marking = false; FLAG_incremental_marking = false;
CcTest::InitializeVM(); CcTest::InitializeVM();
GlobalHandles* global_handles = CcTest::i_isolate()->global_handles(); GlobalHandles* global_handles = CcTest::i_isolate()->global_handles();
Heap* heap = CcTest::heap();
NumberOfWeakCalls = 0; NumberOfWeakCalls = 0;
v8::HandleScope handle_scope(CcTest::isolate()); v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> g1s1 = Handle<Object> g1s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g1s2 = Handle<Object> g1s2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g1c1 = Handle<Object> g1c1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
global_handles->MakeWeak(g1s1.location(), global_handles->MakeWeak(g1s1.location(),
reinterpret_cast<void*>(1234), reinterpret_cast<void*>(1234),
&WeakPointerCallback); &WeakPointerCallback);
...@@ -303,11 +304,11 @@ TEST(ObjectGroups) { ...@@ -303,11 +304,11 @@ TEST(ObjectGroups) {
&WeakPointerCallback); &WeakPointerCallback);
Handle<Object> g2s1 = Handle<Object> g2s1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2s2 = Handle<Object> g2s2 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2c1 = Handle<Object> g2c1 =
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
global_handles->MakeWeak(g2s1.location(), global_handles->MakeWeak(g2s1.location(),
reinterpret_cast<void*>(1234), reinterpret_cast<void*>(1234),
&WeakPointerCallback); &WeakPointerCallback);
...@@ -337,7 +338,7 @@ TEST(ObjectGroups) { ...@@ -337,7 +338,7 @@ TEST(ObjectGroups) {
Handle<HeapObject>::cast(g2s1).location(), g2_children, 1); Handle<HeapObject>::cast(g2s1).location(), g2_children, 1);
} }
// Do a full GC // Do a full GC
HEAP->CollectGarbage(OLD_POINTER_SPACE); heap->CollectGarbage(OLD_POINTER_SPACE);
// All object should be alive. // All object should be alive.
CHECK_EQ(0, NumberOfWeakCalls); CHECK_EQ(0, NumberOfWeakCalls);
...@@ -365,7 +366,7 @@ TEST(ObjectGroups) { ...@@ -365,7 +366,7 @@ TEST(ObjectGroups) {
Handle<HeapObject>::cast(g2s1).location(), g2_children, 1); Handle<HeapObject>::cast(g2s1).location(), g2_children, 1);
} }
HEAP->CollectGarbage(OLD_POINTER_SPACE); heap->CollectGarbage(OLD_POINTER_SPACE);
// All objects should be gone. 5 global handles in total. // All objects should be gone. 5 global handles in total.
CHECK_EQ(5, NumberOfWeakCalls); CHECK_EQ(5, NumberOfWeakCalls);
...@@ -378,7 +379,7 @@ TEST(ObjectGroups) { ...@@ -378,7 +379,7 @@ TEST(ObjectGroups) {
reinterpret_cast<void*>(1234), reinterpret_cast<void*>(1234),
&WeakPointerCallback); &WeakPointerCallback);
HEAP->CollectGarbage(OLD_POINTER_SPACE); heap->CollectGarbage(OLD_POINTER_SPACE);
CHECK_EQ(7, NumberOfWeakCalls); CHECK_EQ(7, NumberOfWeakCalls);
} }
...@@ -413,8 +414,8 @@ TEST(EmptyObjectGroups) { ...@@ -413,8 +414,8 @@ TEST(EmptyObjectGroups) {
v8::HandleScope handle_scope(CcTest::isolate()); v8::HandleScope handle_scope(CcTest::isolate());
Handle<Object> object = Handle<Object> object = global_handles->Create(
global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); CcTest::heap()->AllocateFixedArray(1)->ToObjectChecked());
TestRetainedObjectInfo info; TestRetainedObjectInfo info;
global_handles->AddObjectGroup(NULL, 0, &info); global_handles->AddObjectGroup(NULL, 0, &info);
......
...@@ -444,7 +444,7 @@ TEST(ObservationWeakMap) { ...@@ -444,7 +444,7 @@ TEST(ObservationWeakMap) {
CHECK_EQ(1, NumberOfElements(callbackInfoMap)); CHECK_EQ(1, NumberOfElements(callbackInfoMap));
CHECK_EQ(1, NumberOfElements(objectInfoMap)); CHECK_EQ(1, NumberOfElements(objectInfoMap));
CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap)); CHECK_EQ(1, NumberOfElements(notifierObjectInfoMap));
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); i_isolate->heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
CHECK_EQ(0, NumberOfElements(callbackInfoMap)); CHECK_EQ(0, NumberOfElements(callbackInfoMap));
CHECK_EQ(0, NumberOfElements(objectInfoMap)); CHECK_EQ(0, NumberOfElements(objectInfoMap));
CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap)); CHECK_EQ(0, NumberOfElements(notifierObjectInfoMap));
......
...@@ -399,7 +399,7 @@ class TestSetup { ...@@ -399,7 +399,7 @@ class TestSetup {
TEST(RecordTickSample) { TEST(RecordTickSample) {
TestSetup test_setup; TestSetup test_setup;
CpuProfilesCollection profiles(CcTest::i_isolate()->heap()); CpuProfilesCollection profiles(CcTest::heap());
profiles.StartProfiling("", 1, false); profiles.StartProfiling("", 1, false);
ProfileGenerator generator(&profiles); ProfileGenerator generator(&profiles);
CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
...@@ -465,7 +465,7 @@ static void CheckNodeIds(ProfileNode* node, int* expectedId) { ...@@ -465,7 +465,7 @@ static void CheckNodeIds(ProfileNode* node, int* expectedId) {
TEST(SampleIds) { TEST(SampleIds) {
TestSetup test_setup; TestSetup test_setup;
CpuProfilesCollection profiles(CcTest::i_isolate()->heap()); CpuProfilesCollection profiles(CcTest::heap());
profiles.StartProfiling("", 1, true); profiles.StartProfiling("", 1, true);
ProfileGenerator generator(&profiles); ProfileGenerator generator(&profiles);
CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
...@@ -513,7 +513,7 @@ TEST(SampleIds) { ...@@ -513,7 +513,7 @@ TEST(SampleIds) {
TEST(NoSamples) { TEST(NoSamples) {
TestSetup test_setup; TestSetup test_setup;
CpuProfilesCollection profiles(CcTest::i_isolate()->heap()); CpuProfilesCollection profiles(CcTest::heap());
profiles.StartProfiling("", 1, false); profiles.StartProfiling("", 1, false);
ProfileGenerator generator(&profiles); ProfileGenerator generator(&profiles);
CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
...@@ -652,7 +652,7 @@ TEST(RecordStackTraceAtStartProfiling) { ...@@ -652,7 +652,7 @@ TEST(RecordStackTraceAtStartProfiling) {
TEST(Issue51919) { TEST(Issue51919) {
CpuProfilesCollection collection(CcTest::i_isolate()->heap()); CpuProfilesCollection collection(CcTest::heap());
i::EmbeddedVector<char*, i::EmbeddedVector<char*,
CpuProfilesCollection::kMaxSimultaneousProfiles> titles; CpuProfilesCollection::kMaxSimultaneousProfiles> titles;
for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) { for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) {
......
...@@ -294,11 +294,11 @@ static void SanityCheck() { ...@@ -294,11 +294,11 @@ static void SanityCheck() {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
HEAP->Verify(); CcTest::heap()->Verify();
#endif #endif
CHECK(isolate->global_object()->IsJSObject()); CHECK(isolate->global_object()->IsJSObject());
CHECK(isolate->native_context()->IsContext()); CHECK(isolate->native_context()->IsContext());
CHECK(HEAP->string_table()->IsStringTable()); CHECK(CcTest::heap()->string_table()->IsStringTable());
CHECK(!isolate->factory()->InternalizeOneByteString( CHECK(!isolate->factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("Empty"))->IsFailure()); STATIC_ASCII_VECTOR("Empty"))->IsFailure());
} }
......
...@@ -72,7 +72,7 @@ TEST(Page) { ...@@ -72,7 +72,7 @@ TEST(Page) {
Page* p = Page::FromAddress(page_start); Page* p = Page::FromAddress(page_start);
// Initialized Page has heap pointer, normally set by memory_allocator. // Initialized Page has heap pointer, normally set by memory_allocator.
p->heap_ = HEAP; p->heap_ = CcTest::heap();
CHECK(p->address() == page_start); CHECK(p->address() == page_start);
CHECK(p->is_valid()); CHECK(p->is_valid());
...@@ -323,8 +323,8 @@ TEST(NewSpace) { ...@@ -323,8 +323,8 @@ TEST(NewSpace) {
NewSpace new_space(heap); NewSpace new_space(heap);
CHECK(new_space.SetUp(HEAP->ReservedSemiSpaceSize(), CHECK(new_space.SetUp(CcTest::heap()->ReservedSemiSpaceSize(),
HEAP->ReservedSemiSpaceSize())); CcTest::heap()->ReservedSemiSpaceSize()));
CHECK(new_space.HasBeenSetUp()); CHECK(new_space.HasBeenSetUp());
while (new_space.Available() >= Page::kMaxNonCodeHeapObjectSize) { while (new_space.Available() >= Page::kMaxNonCodeHeapObjectSize) {
...@@ -372,7 +372,7 @@ TEST(OldSpace) { ...@@ -372,7 +372,7 @@ TEST(OldSpace) {
TEST(LargeObjectSpace) { TEST(LargeObjectSpace) {
v8::V8::Initialize(); v8::V8::Initialize();
LargeObjectSpace* lo = HEAP->lo_space(); LargeObjectSpace* lo = CcTest::heap()->lo_space();
CHECK(lo != NULL); CHECK(lo != NULL);
int lo_size = Page::kPageSize; int lo_size = Page::kPageSize;
......
...@@ -290,7 +290,7 @@ ConsStringGenerationData::ConsStringGenerationData(bool long_blocks, ...@@ -290,7 +290,7 @@ ConsStringGenerationData::ConsStringGenerationData(bool long_blocks,
rng_.init(); rng_.init();
InitializeBuildingBlocks( InitializeBuildingBlocks(
building_blocks_, kNumberOfBuildingBlocks, long_blocks, &rng_, zone); building_blocks_, kNumberOfBuildingBlocks, long_blocks, &rng_, zone);
empty_string_ = CcTest::i_isolate()->heap()->empty_string(); empty_string_ = CcTest::heap()->empty_string();
Reset(); Reset();
} }
......
...@@ -37,8 +37,8 @@ TEST(Create) { ...@@ -37,8 +37,8 @@ TEST(Create) {
#endif #endif
} }
HEAP->PerformScavenge(); CcTest::heap()->PerformScavenge();
HEAP->CollectAllGarbage(Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
// All symbols should be distinct. // All symbols should be distinct.
for (int i = 0; i < kNumSymbols; ++i) { for (int i = 0; i < kNumSymbols; ++i) {
......
...@@ -117,7 +117,7 @@ class ThreadB : public v8::internal::Thread { ...@@ -117,7 +117,7 @@ class ThreadB : public v8::internal::Thread {
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
// Clear the caches by forcing major GC. // Clear the caches by forcing major GC.
HEAP->CollectAllGarbage(v8::internal::Heap::kNoGCFlags); CcTest::heap()->CollectAllGarbage(v8::internal::Heap::kNoGCFlags);
turn = SECOND_TIME_FILL_CACHE; turn = SECOND_TIME_FILL_CACHE;
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment