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

Unified Diff: runtime/vm/ic_stubs_ia32_test.cc

Issue 8357034: Transitioning to new IC structure: change IC data to include function name; pass IC data instead ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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/ic_stubs_ia32.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ic_stubs_ia32_test.cc
===================================================================
--- runtime/vm/ic_stubs_ia32_test.cc (revision 633)
+++ runtime/vm/ic_stubs_ia32_test.cc (working copy)
@@ -200,93 +200,6 @@
}
}
-
-static bool SameClassArrays(const GrowableArray<const Class*>& a,
- const GrowableArray<const Class*>& b) {
- if (a.length() != b.length()) {
- return false;
- }
- for (int i = 0; i < a.length(); i++) {
- if (a[i]->raw() != b[i]->raw()) {
- return false;
- }
- }
- return true;
-}
-
-
-// Testing the platform independent ICData class here because ICStubs::GetICStub
-// is implemented only in ia32.
-TEST_CASE(ICDataTest) {
- GrowableArray<const Class*> classes;
- GrowableArray<const Function*> targets;
- const Code& ic_stub = Code::Handle(ICStubs::GetICStub(classes, targets));
- if (ic_stub.IsNull()) {
- // ICStubs not implemented for the platform.
- return;
- }
- ICData ic_data(ic_stub);
- intptr_t num_classes = 2;
- intptr_t num_checks = 3;
- ic_data.SetICDataArray(num_classes, num_checks);
- EXPECT_EQ(num_classes, ic_data.NumberOfClasses());
- EXPECT_EQ(num_checks, ic_data.NumberOfChecks());
- ObjectStore* object_store = Isolate::Current()->object_store();
- const Class& double_class = Class::ZoneHandle(object_store->double_class());
- const Class& smi_class = Class::ZoneHandle(object_store->smi_class());
- GrowableArray<const Class*> check0;
- check0.Add(&smi_class);
- check0.Add(&smi_class);
- GrowableArray<const Class*> check1;
- check1.Add(&smi_class);
- check1.Add(&double_class);
- GrowableArray<const Class*> check2;
- check2.Add(&double_class);
- check2.Add(&smi_class);
- const Function& function0 = Function::ZoneHandle(GetDummyTarget("SmiSmi"));
- const Function& function1 = Function::ZoneHandle(GetDummyTarget("SmiDouble"));
- const Function& function2 = Function::ZoneHandle(GetDummyTarget("DoubleSmi"));
- const Function& function3 =
- Function::ZoneHandle(GetDummyTarget("DoubleDouble"));
- ic_data.SetCheckAt(0, check0, function0);
- ic_data.SetCheckAt(1, check1, function1);
- ic_data.SetCheckAt(2, check2, function2);
-
- Function& test_function = Function::Handle();
- GrowableArray<const Class*> test_classes;
-
- ic_data.GetCheckAt(0, &test_classes, &test_function);
- EXPECT_EQ(function0.raw(), test_function.raw());
- EXPECT_EQ(true, SameClassArrays(test_classes, check0));
-
- ic_data.GetCheckAt(1, &test_classes, &test_function);
- EXPECT_EQ(function1.raw(), test_function.raw());
- EXPECT_EQ(true, SameClassArrays(test_classes, check1));
-
- ic_data.GetCheckAt(1, &test_classes, &test_function);
- EXPECT_EQ(function1.raw(), test_function.raw());
- EXPECT_EQ(true, SameClassArrays(test_classes, check1));
-
- ic_data.GetCheckAt(2, &test_classes, &test_function);
- EXPECT_EQ(function2.raw(), test_function.raw());
- EXPECT_EQ(true, SameClassArrays(test_classes, check2));
-
- // Test AddCheck, test new and old data.
- GrowableArray<const Class*> double_double_classes;
- double_double_classes.Add(&double_class);
- double_double_classes.Add(&double_class);
- ic_data.AddCheck(double_double_classes, function3);
- EXPECT_EQ(4, ic_data.NumberOfChecks());
- ic_data.GetCheckAt(3, &test_classes, &test_function);
- EXPECT_EQ(function3.raw(), test_function.raw());
- EXPECT_EQ(true, SameClassArrays(test_classes, double_double_classes));
-
- ic_data.GetCheckAt(1, &test_classes, &test_function);
- EXPECT_EQ(function1.raw(), test_function.raw());
- EXPECT_EQ(true, SameClassArrays(test_classes, check1));
-}
-
-
} // namespace dart
#endif // defined TARGET_ARCH_IA32
« no previous file with comments | « runtime/vm/ic_stubs_ia32.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698