Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Unified Diff: test/cctest/test-strings.cc

Issue 7833033: Promote and inflate string slices during scavenging GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.cc ('k') | test/mjsunit/string-slices.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-strings.cc
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc
index 55c21417d0edeb5df29090f3280ac9580cc003bd..a94aa84ff98e59e4886dd90cbdc6045e69919847 100644
--- a/test/cctest/test-strings.cc
+++ b/test/cctest/test-strings.cc
@@ -558,3 +558,35 @@ TEST(SliceFromSlice) {
CHECK(SlicedString::cast(*string)->parent()->IsSeqString());
CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString()));
}
+
+
+TEST(SliceConversion) {
+ // This tests whether a slice promoted during scavenging is properly
+ // converted to a sequential string when being copied into old space.
+ FLAG_string_slices = true;
+ InitializeVM();
+ HandleScope scope;
+ v8::Local<v8::Value> result;
+ Handle<String> string;
+ const char* init = "var str = 'abcdefghijklmnopqrstuvwxyz';";
+ const char* slice = "str.slice(2,24)";
+ const char* fill_new_space =
+ "var fill = [];"
+ "for (var i = 0; i < 100000; i++) fill.push(i + ' ');";
+
+ CompileRun(init);
+
+ result = CompileRun(slice);
+ CHECK(result->IsString());
+ string = v8::Utils::OpenHandle(v8::String::Cast(*result));
+ CHECK(HEAP->InNewSpace(*string));
+ CHECK(string->IsSlicedString());
+ CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString()));
+
+ CompileRun(fill_new_space);
+ HEAP->PerformScavenge();
+
+ CHECK(!HEAP->InNewSpace(*string));
+ CHECK(string->IsSeqString());
+ CHECK_EQ("cdefghijklmnopqrstuvwx", *(string->ToCString()));
+}
« no previous file with comments | « src/heap.cc ('k') | test/mjsunit/string-slices.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698