OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/instructions.h" | 9 #include "vm/instructions.h" |
10 #include "vm/stub_code.h" | 10 #include "vm/stub_code.h" |
11 #include "vm/unit_test.h" | 11 #include "vm/unit_test.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 #define __ assembler-> | 15 #define __ assembler-> |
16 | 16 |
17 ASSEMBLER_TEST_GENERATE(Call, assembler) { | 17 ASSEMBLER_TEST_GENERATE(Call, assembler) { |
18 __ call(&StubCode::MegamorphicLookupLabel()); | 18 __ call(&StubCode::MegamorphicLookupLabel()); |
19 __ ret(); | 19 __ ret(); |
20 } | 20 } |
21 | 21 |
22 | 22 |
23 ASSEMBLER_TEST_RUN(Call, entry) { | 23 ASSEMBLER_TEST_RUN(Call, entry) { |
24 Call call(entry); | 24 CallPattern call(entry); |
25 EXPECT_EQ(StubCode::MegamorphicLookupLabel().address(), call.TargetAddress()); | 25 EXPECT_EQ(StubCode::MegamorphicLookupLabel().address(), call.TargetAddress()); |
26 } | 26 } |
27 | 27 |
28 | 28 |
29 ASSEMBLER_TEST_GENERATE(Jump, assembler) { | 29 ASSEMBLER_TEST_GENERATE(Jump, assembler) { |
30 __ jmp(&StubCode::MegamorphicLookupLabel()); | 30 __ jmp(&StubCode::MegamorphicLookupLabel()); |
31 __ jmp(&StubCode::OptimizeInvokedFunctionLabel()); | 31 __ jmp(&StubCode::OptimizeInvokedFunctionLabel()); |
32 __ ret(); | 32 __ ret(); |
33 } | 33 } |
34 | 34 |
35 | 35 |
36 ASSEMBLER_TEST_RUN(Jump, entry) { | 36 ASSEMBLER_TEST_RUN(Jump, entry) { |
37 Jump jump1(entry); | 37 JumpPattern jump1(entry); |
38 EXPECT_EQ(StubCode::MegamorphicLookupLabel().address(), | 38 EXPECT_EQ(StubCode::MegamorphicLookupLabel().address(), |
39 jump1.TargetAddress()); | 39 jump1.TargetAddress()); |
40 Jump jump2(entry + jump1.pattern_length_in_bytes()); | 40 JumpPattern jump2(entry + jump1.pattern_length_in_bytes()); |
41 EXPECT_EQ(StubCode::OptimizeInvokedFunctionLabel().address(), | 41 EXPECT_EQ(StubCode::OptimizeInvokedFunctionLabel().address(), |
42 jump2.TargetAddress()); | 42 jump2.TargetAddress()); |
43 uword target1 = jump1.TargetAddress(); | 43 uword target1 = jump1.TargetAddress(); |
44 uword target2 = jump2.TargetAddress(); | 44 uword target2 = jump2.TargetAddress(); |
45 jump1.SetTargetAddress(target2); | 45 jump1.SetTargetAddress(target2); |
46 jump2.SetTargetAddress(target1); | 46 jump2.SetTargetAddress(target1); |
47 EXPECT_EQ(StubCode::OptimizeInvokedFunctionLabel().address(), | 47 EXPECT_EQ(StubCode::OptimizeInvokedFunctionLabel().address(), |
48 jump1.TargetAddress()); | 48 jump1.TargetAddress()); |
49 EXPECT_EQ(StubCode::MegamorphicLookupLabel().address(), | 49 EXPECT_EQ(StubCode::MegamorphicLookupLabel().address(), |
50 jump2.TargetAddress()); | 50 jump2.TargetAddress()); |
51 } | 51 } |
52 | 52 |
53 } // namespace dart | 53 } // namespace dart |
54 | 54 |
55 #endif // defined TARGET_ARCH_IA32 | 55 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |