Regression test for existing bug in String::MakeExternal.

R=yangguo@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15903 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 37276389
......@@ -42,6 +42,9 @@ test-serialize/DependentTestThatAlwaysFails: FAIL
# This test always fails. It tests that LiveEdit causes abort when turned off.
test-debug/LiveEditDisabled: FAIL
# TODO(yangguo,mstarzinger): Fix bug in String::MakeExternal.
test-api/MakingExternalUnalignedAsciiString: PASS || CRASH
# TODO(gc): Temporarily disabled in the GC branch.
test-log/EquivalenceOfLoggingAndTraversal: PASS || FAIL
......
......@@ -621,6 +621,33 @@ TEST(MakingExternalAsciiStringConditions) {
}
TEST(MakingExternalUnalignedAsciiString) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
// Create a cons string that will land in old pointer space.
Local<String> string = Local<String>::Cast(CompileRun(
"function cons(a, b) { return a + b; }"
"cons('abcdefghijklm', 'nopqrstuvwxyz');"));
// Trigger GCs so that the newly allocated string moves to old gen.
SimulateFullSpace(HEAP->old_pointer_space());
HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
// Turn into external string with unaligned resource data.
int dispose_count = 0;
const char* c_source = "_abcdefghijklmnopqrstuvwxyz";
bool success = string->MakeExternal(
new TestAsciiResource(i::StrDup(c_source) + 1, &dispose_count));
CHECK(success);
// Trigger GCs and force evacuation.
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
HEAP->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask);
}
THREADED_TEST(UsingExternalString) {
i::Factory* factory = i::Isolate::Current()->factory();
{
......
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