Revision: 15903
Author:   [email protected]
Date:     Fri Jul 26 04:37:54 2013
Log:      Regression test for existing bug in String::MakeExternal.

[email protected]

Review URL: https://codereview.chromium.org/20713002
http://code.google.com/p/v8/source/detail?r=15903

Modified:
 /branches/bleeding_edge/test/cctest/cctest.status
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/test/cctest/cctest.status Wed Jul 24 05:16:02 2013 +++ /branches/bleeding_edge/test/cctest/cctest.status Fri Jul 26 04:37:54 2013
@@ -42,6 +42,9 @@
# 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

=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc     Tue Jul 23 08:01:38 2013
+++ /branches/bleeding_edge/test/cctest/test-api.cc     Fri Jul 26 04:37:54 2013
@@ -619,6 +619,33 @@
   // Large strings should be immediately accepted.
   CHECK(large_string->CanMakeExternal());
 }
+
+
+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) {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to