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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 2005813002: Fix optimizer bug with external strings. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | runtime/vm/redundancy_elimination.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | runtime/vm/redundancy_elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698