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

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: Remove check of length 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
« no previous file with comments | « 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 d1416b7330cba62d3b8b0f8db5e60785a7657a6a..e2773ef3373bed5afbbf4b0a2e7a7c5a82ba84bb 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -556,40 +556,19 @@ TEST(MakingExternalStringConditions) {
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
uint16_t* two_byte_string = AsciiToTwoByteString("s1");
- Local<String> small_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 space 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());
}
@@ -601,23 +580,14 @@ TEST(MakingExternalOneByteStringConditions) {
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
- Local<String> small_string = v8_str("s1");
- // We should refuse to externalize small strings.
- CHECK(!small_string->CanMakeExternal());
+ Local<String> local_string = v8_str("s1");
+ // We should refuse to externalize new space 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());
-
- const int buf_size = 10 * 1024;
- char* buf = i::NewArray<char>(buf_size);
- memset(buf, 'a', buf_size);
- buf[buf_size - 1] = '\0';
- Local<String> large_string = v8_str(buf);
- i::DeleteArray(buf);
- // Large strings should be immediately accepted.
- CHECK(large_string->CanMakeExternal());
+ CHECK(local_string->CanMakeExternal());
}
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698