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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 11365273: Upon script loading deoptimize only functions whose owner has been subclassed, as that is the only… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
« runtime/vm/class_finalizer.cc ('K') | « runtime/vm/code_generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
===================================================================
--- runtime/vm/dart_api_impl_test.cc (revision 14913)
+++ runtime/vm/dart_api_impl_test.cc (working copy)
@@ -7164,6 +7164,45 @@
EXPECT_EQ(0, isolate->heap()->PeerCount());
}
+
+TEST_CASE(LazyLoadDeoptimizes) {
+ const char* kLoadFirst =
+ "start(a) {\n"
+ " var obj = (a == 1) ? createB() : new A();\n"
+ " for (int i = 0; i < 4000; i++) {\n"
+ " var res = obj.foo();\n"
+ " if (a == 1) { if (res != 1) throw 'Error'; }\n"
+ " else if (res != 2) throw 'Error'; \n"
+ " }\n"
+ "}\n"
+ "\n"
+ "createB() => new B();"
+ "\n"
+ "class A {\n"
+ " foo() => goo();\n"
+ " goo() => 2;\n"
+ "}\n";
+ const char* kLoadSecond =
+ "class B extends A {\n"
+ " goo() => 1;\n"
+ "}\n";
+ Dart_Handle result;
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib1 = TestCase::LoadTestScript(kLoadFirst, NULL);
+ Dart_Handle dart_args[1];
+ dart_args[0] = Dart_NewInteger(0);
+ result = Dart_Invoke(lib1, NewString("start"), 1, dart_args);
+ EXPECT_VALID(result);
+
+ Dart_Handle source = NewString(kLoadSecond);
+ Dart_Handle url = NewString(TestCase::url());
+ Dart_LoadSource(TestCase::lib(), url, source);
+
+ dart_args[0] = Dart_NewInteger(1);
+ result = Dart_Invoke(lib1, NewString("start"), 1, dart_args);
+ EXPECT_VALID(result);
+}
+
#endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
} // namespace dart
« runtime/vm/class_finalizer.cc ('K') | « runtime/vm/code_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698