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

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

Issue 1901573003: [regexp] do not assume short external strings have a minimum size. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips port. functional mips64 port not available yet. Created 4 years, 8 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-regexp.cc
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
index 29c227d3a85eccde7979cda21de511cf47299779..0a153b78e05b145d822ba65656bd42807a369232 100644
--- a/test/cctest/test-regexp.cc
+++ b/test/cctest/test-regexp.cc
@@ -1973,3 +1973,26 @@ TEST(UseCountRegExp) {
CHECK_EQ(1, use_counts[v8::Isolate::kRegExpPrototypeToString]);
CHECK(resultToStringError->IsObject());
}
+
+class UncachedExternalString
+ : public v8::String::ExternalOneByteStringResource {
+ public:
+ const char* data() const override { return "abcdefghijklmnopqrstuvwxyz"; }
+ size_t length() const override { return 26; }
+ bool IsCompressible() const override { return true; }
+};
+
+TEST(UncachedExternalString) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ LocalContext env;
+ v8::Local<v8::String> external =
+ v8::String::NewExternalOneByte(isolate, new UncachedExternalString())
+ .ToLocalChecked();
+ CHECK(v8::Utils::OpenHandle(*external)->map() ==
+ CcTest::i_isolate()->heap()->short_external_one_byte_string_map());
+ v8::Local<v8::Object> global = env->Global();
+ global->Set(env.local(), v8_str("external"), external).FromJust();
+ CompileRun("var re = /y(.)/; re.test('ab');");
+ ExpectString("external.substring(1).match(re)[1]", "z");
+}
« 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