From: vegorov@chromium.org Date: Wed, 28 Apr 2010 11:02:26 +0000 (+0000) Subject: Fix api tests based on incorrect assumptions about GC behavior. X-Git-Tag: upstream/4.7.83~21920 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8c8b7f893d4cec27b384321053af5d11a42df2d1;p=platform%2Fupstream%2Fv8.git Fix api tests based on incorrect assumptions about GC behavior. Review URL: http://codereview.chromium.org/1701018 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4529 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 84fdd68..dc80391 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -569,6 +569,7 @@ THREADED_TEST(UsingExternalAsciiString) { THREADED_TEST(ScavengeExternalString) { TestResource::dispose_count = 0; + bool in_new_space = false; { v8::HandleScope scope; uint16_t* two_byte_string = AsciiToTwoByteString("test string"); @@ -576,16 +577,18 @@ THREADED_TEST(ScavengeExternalString) { String::NewExternal(new TestResource(two_byte_string)); i::Handle istring = v8::Utils::OpenHandle(*string); i::Heap::CollectGarbage(0, i::NEW_SPACE); - CHECK(i::Heap::InNewSpace(*istring)); + in_new_space = i::Heap::InNewSpace(*istring); + CHECK(in_new_space || i::Heap::old_data_space()->Contains(*istring)); CHECK_EQ(0, TestResource::dispose_count); } - i::Heap::CollectGarbage(0, i::NEW_SPACE); + i::Heap::CollectGarbage(0, in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE); CHECK_EQ(1, TestResource::dispose_count); } THREADED_TEST(ScavengeExternalAsciiString) { TestAsciiResource::dispose_count = 0; + bool in_new_space = false; { v8::HandleScope scope; const char* one_byte_string = "test string"; @@ -593,10 +596,11 @@ THREADED_TEST(ScavengeExternalAsciiString) { new TestAsciiResource(i::StrDup(one_byte_string))); i::Handle istring = v8::Utils::OpenHandle(*string); i::Heap::CollectGarbage(0, i::NEW_SPACE); - CHECK(i::Heap::InNewSpace(*istring)); + in_new_space = i::Heap::InNewSpace(*istring); + CHECK(in_new_space || i::Heap::old_data_space()->Contains(*istring)); CHECK_EQ(0, TestAsciiResource::dispose_count); } - i::Heap::CollectGarbage(0, i::NEW_SPACE); + i::Heap::CollectGarbage(0, in_new_space ? i::NEW_SPACE : i::OLD_DATA_SPACE); CHECK_EQ(1, TestAsciiResource::dispose_count); }