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

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

Issue 2046933002: [V8] Make String::CanMakeExternal ignore the length of new strings (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ignore the length of strings Created 4 years, 6 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
« src/api.cc ('K') | « src/api.cc ('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 d71011668790a0d6c9eee526c2b960f27069344c..6fffb0a373051249330db63622a6f26e4648db08 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -554,41 +554,20 @@ TEST(MakingExternalStringConditions) {
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
- uint16_t* two_byte_string = AsciiToTwoByteString("s1");
- Local<String> small_string =
+ uint16_t* two_byte_string = AsciiToTwoByteString("ascii string");
+ Local<String> local_string =
String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
v8::NewStringType::kNormal)
.ToLocalChecked();
i::DeleteArray(two_byte_string);
- // We should refuse to externalize small strings.
- CHECK(!small_string->CanMakeExternal());
+ // We should refuse to externalize new strings.
+ CHECK(!local_string->CanMakeExternal());
// Trigger GCs so that the newly allocated string moves to old gen.
CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
// Old space strings should be accepted.
- CHECK(small_string->CanMakeExternal());
-
- two_byte_string = AsciiToTwoByteString("small string 2");
- small_string = String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
- v8::NewStringType::kNormal)
- .ToLocalChecked();
- i::DeleteArray(two_byte_string);
-
- const int buf_size = 10 * 1024;
- char* buf = i::NewArray<char>(buf_size);
- memset(buf, 'a', buf_size);
- buf[buf_size - 1] = '\0';
-
- two_byte_string = AsciiToTwoByteString(buf);
- Local<String> large_string =
- String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
- v8::NewStringType::kNormal)
- .ToLocalChecked();
- i::DeleteArray(buf);
- i::DeleteArray(two_byte_string);
- // Large strings should be immediately accepted.
- CHECK(large_string->CanMakeExternal());
+ CHECK(local_string->CanMakeExternal());
}
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698