| Index: runtime/vm/dart_api_impl_test.cc
|
| diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
|
| index f6e8bb716f4663e322c2f776ed252ad5a34ffc84..fcc4e79cd8cc88cc39f412f13ed1490c827bd007 100644
|
| --- a/runtime/vm/dart_api_impl_test.cc
|
| +++ b/runtime/vm/dart_api_impl_test.cc
|
| @@ -8957,6 +8957,41 @@ TEST_CASE(ExternalStringPolymorphicDeoptimize) {
|
| }
|
|
|
|
|
| +TEST_CASE(ExternalStringLoadElimination) {
|
| + const bool saved_flag = FLAG_support_externalizable_strings;
|
| + FLAG_support_externalizable_strings = true;
|
| +
|
| + const char* kScriptChars =
|
| + "class A {\n"
|
| + " static change_str(String s) native 'A_change_str';\n"
|
| + "}\n"
|
| + "double_char0(str) {\n"
|
| + " return str.codeUnitAt(0) + str.codeUnitAt(0);\n"
|
| + "}\n"
|
| + "main() {\n"
|
| + " var externalA = 'AA' + 'AA';\n"
|
| + " A.change_str(externalA);\n"
|
| + " for (var i = 0; i < 10000; i++) double_char0(externalA);\n"
|
| + " var result = double_char0(externalA);\n"
|
| + " return result == 130;\n"
|
| + "}\n";
|
| + Dart_Handle lib =
|
| + TestCase::LoadTestScript(kScriptChars,
|
| + &ExternalStringDeoptimize_native_lookup);
|
| + Dart_Handle result = Dart_Invoke(lib,
|
| + NewString("main"),
|
| + 0,
|
| + NULL);
|
| + EXPECT_VALID(result);
|
| + bool value = false;
|
| + result = Dart_BooleanValue(result, &value);
|
| + EXPECT_VALID(result);
|
| + EXPECT(value);
|
| +
|
| + FLAG_support_externalizable_strings = saved_flag;
|
| +}
|
| +
|
| +
|
| TEST_CASE(ExternalStringGuardFieldDeoptimize) {
|
| const bool saved_flag = FLAG_support_externalizable_strings;
|
| FLAG_support_externalizable_strings = true;
|
|
|