| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 // Test megamorphic calls. | |
| 5 | |
| 6 class A { | |
| 7 A() {} | |
| 8 f1() { return 1; } | |
| 9 f2() { return 2; } | |
| 10 f3() { return 3; } | |
| 11 f4() { return 4; } | |
| 12 f5() { return 5; } | |
| 13 f6() { return 6; } | |
| 14 f7() { return 7; } | |
| 15 f8() { return 8; } | |
| 16 f9() { return 9; } | |
| 17 f11() { return 11; } | |
| 18 f12() { return 12; } | |
| 19 f13() { return 13; } | |
| 20 f14() { return 14; } | |
| 21 f15() { return 15; } | |
| 22 f16() { return 16; } | |
| 23 f17() { return 17; } | |
| 24 f18() { return 18; } | |
| 25 f19() { return 19; } | |
| 26 f20() { return 20; } | |
| 27 f21() { return 21; } | |
| 28 f22() { return 22; } | |
| 29 f23() { return 23; } | |
| 30 f24() { return 24; } | |
| 31 f25() { return 25; } | |
| 32 f26() { return 26; } | |
| 33 f27() { return 27; } | |
| 34 f28() { return 28; } | |
| 35 f29() { return 29; } | |
| 36 f30() { return 30; } | |
| 37 f31() { return 31; } | |
| 38 f32() { return 32; } | |
| 39 f33() { return 33; } | |
| 40 f34() { return 34; } | |
| 41 f35() { return 35; } | |
| 42 f36() { return 36; } | |
| 43 f37() { return 37; } | |
| 44 f38() { return 38; } | |
| 45 f39() { return 39; } | |
| 46 } | |
| 47 | |
| 48 | |
| 49 class B extends A { | |
| 50 B() : super() {} | |
| 51 } | |
| 52 | |
| 53 | |
| 54 class ManyCallsTest { | |
| 55 static testMain() { | |
| 56 var list = new List(10); | |
| 57 for (int i = 0; i < (list.length ~/ 2) ; i++) { | |
| 58 list[i] = new A(); | |
| 59 } | |
| 60 for (int i = (list.length ~/ 2); i < list.length; i++) { | |
| 61 list[i] = new B(); | |
| 62 } | |
| 63 for (int loop = 0; loop < 7; loop++) { | |
| 64 for (int i = 0; i < list.length; i++) { | |
| 65 Expect.equals(1, list[i].f1()); | |
| 66 Expect.equals(2, list[i].f2()); | |
| 67 Expect.equals(3, list[i].f3()); | |
| 68 Expect.equals(4, list[i].f4()); | |
| 69 Expect.equals(5, list[i].f5()); | |
| 70 Expect.equals(6, list[i].f6()); | |
| 71 Expect.equals(7, list[i].f7()); | |
| 72 Expect.equals(8, list[i].f8()); | |
| 73 Expect.equals(9, list[i].f9()); | |
| 74 Expect.equals(11, list[i].f11()); | |
| 75 Expect.equals(12, list[i].f12()); | |
| 76 Expect.equals(13, list[i].f13()); | |
| 77 Expect.equals(14, list[i].f14()); | |
| 78 Expect.equals(15, list[i].f15()); | |
| 79 Expect.equals(16, list[i].f16()); | |
| 80 Expect.equals(17, list[i].f17()); | |
| 81 Expect.equals(18, list[i].f18()); | |
| 82 Expect.equals(19, list[i].f19()); | |
| 83 Expect.equals(20, list[i].f20()); | |
| 84 Expect.equals(21, list[i].f21()); | |
| 85 Expect.equals(22, list[i].f22()); | |
| 86 Expect.equals(23, list[i].f23()); | |
| 87 Expect.equals(24, list[i].f24()); | |
| 88 Expect.equals(25, list[i].f25()); | |
| 89 Expect.equals(26, list[i].f26()); | |
| 90 Expect.equals(27, list[i].f27()); | |
| 91 Expect.equals(28, list[i].f28()); | |
| 92 Expect.equals(29, list[i].f29()); | |
| 93 Expect.equals(30, list[i].f30()); | |
| 94 Expect.equals(31, list[i].f31()); | |
| 95 Expect.equals(32, list[i].f32()); | |
| 96 Expect.equals(33, list[i].f33()); | |
| 97 Expect.equals(34, list[i].f34()); | |
| 98 Expect.equals(35, list[i].f35()); | |
| 99 Expect.equals(36, list[i].f36()); | |
| 100 Expect.equals(37, list[i].f37()); | |
| 101 Expect.equals(38, list[i].f38()); | |
| 102 Expect.equals(39, list[i].f39()); | |
| 103 } | |
| 104 } | |
| 105 } | |
| 106 } | |
| 107 | |
| 108 main() { | |
| 109 ManyCallsTest.testMain(); | |
| 110 } | |
| OLD | NEW |