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

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

Issue 20723002: Do not allow external strings in old pointer space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updating cctest.status Created 7 years, 5 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 | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 724eb6a2fc2793f10fa8fbf341d0f67c6e42b316..7cb3c04087b69d5238b904861e20d4aaf75fc3fa 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -625,10 +625,14 @@ TEST(MakingExternalUnalignedAsciiString) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
+ CompileRun("function cons(a, b) { return a + b; }"
+ "function slice(a) { return a.substring(1); }");
// 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; }"
+ Local<String> cons = Local<String>::Cast(CompileRun(
"cons('abcdefghijklm', 'nopqrstuvwxyz');"));
+ // Create a sliced string that will land in old pointer space.
+ Local<String> slice = Local<String>::Cast(CompileRun(
+ "slice('abcdefghijklmnopqrstuvwxyz');"));
// Trigger GCs so that the newly allocated string moves to old gen.
SimulateFullSpace(HEAP->old_pointer_space());
@@ -637,9 +641,13 @@ TEST(MakingExternalUnalignedAsciiString) {
// 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));
+ const char* c_cons = "_abcdefghijklmnopqrstuvwxyz";
+ bool success = cons->MakeExternal(
+ new TestAsciiResource(i::StrDup(c_cons) + 1, &dispose_count));
+ CHECK(success);
+ const char* c_slice = "_bcdefghijklmnopqrstuvwxyz";
+ success = slice->MakeExternal(
+ new TestAsciiResource(i::StrDup(c_slice) + 1, &dispose_count));
CHECK(success);
// Trigger GCs and force evacuation.
« no previous file with comments | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698