Index: test/cctest/test-regexp.cc |
diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc |
index 14ec12f21b87f98bdc19693e48cec099af9f98b8..22321c36643e09e264a8b38706dd60067c19e02f 100644 |
--- a/test/cctest/test-regexp.cc |
+++ b/test/cctest/test-regexp.cc |
@@ -1967,3 +1967,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"); |
+} |