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

Unified Diff: runtime/vm/object_test.cc

Issue 10352012: Using SubtypeTestCache object instead of an array, that way we do not need to patch and can communi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 7302)
+++ runtime/vm/object_test.cc (working copy)
@@ -2803,6 +2803,29 @@
}
+TEST_CASE(SubtypeTestCache) {
+ String& class_name = String::Handle(String::NewSymbol("EmptyClass"));
+ Script& script = Script::Handle();
+ const Class& empty_class =
+ Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
+ SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New());
+ ASSERT(!cache.IsNull());
+ EXPECT_EQ(0, cache.NumberOfChecks());
+ const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2));
+ const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3));
+ cache.AddCheck(empty_class, targ_0, targ_1, Bool::Handle(Bool::True()));
+ EXPECT_EQ(1, cache.NumberOfChecks());
+ Class& test_class = Class::Handle();
+ AbstractTypeArguments& test_targ_0 = AbstractTypeArguments::Handle();
+ AbstractTypeArguments& test_targ_1 = AbstractTypeArguments::Handle();
+ Bool& test_result = Bool::Handle();
+ cache.GetCheck(0, &test_class, &test_targ_0, &test_targ_1, &test_result);
+ EXPECT_EQ(empty_class.raw(), test_class.raw());
+ EXPECT_EQ(targ_0.raw(), test_targ_0.raw());
+ EXPECT_EQ(targ_1.raw(), test_targ_1.raw());
+ EXPECT_EQ(Bool::True(), test_result.raw());
+}
+
#endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
} // namespace dart
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698