| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 UNIMPLEMENTED(); | 18 __ BranchLinkPatchable(&StubCode::InstanceFunctionLookupLabel()); |
| 19 __ Stop("Test should not be executed"); |
| 19 } | 20 } |
| 20 | 21 |
| 21 | 22 |
| 22 ASSEMBLER_TEST_RUN(Call, entry) { | 23 ASSEMBLER_TEST_RUN(Call, test) { |
| 23 CallPattern call(entry); | 24 CallPattern call(test->entry(), test->code()); |
| 24 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 25 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 25 call.TargetAddress()); | 26 call.TargetAddress()); |
| 26 } | 27 } |
| 27 | 28 |
| 28 | 29 |
| 29 ASSEMBLER_TEST_GENERATE(Jump, assembler) { | 30 ASSEMBLER_TEST_GENERATE(Jump, assembler) { |
| 30 UNIMPLEMENTED(); | 31 UNIMPLEMENTED(); |
| 31 } | 32 } |
| 32 | 33 |
| 33 | 34 |
| 34 ASSEMBLER_TEST_RUN(Jump, entry) { | 35 ASSEMBLER_TEST_RUN(Jump, test) { |
| 35 JumpPattern jump1(entry); | 36 JumpPattern jump1(test->entry()); |
| 36 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 37 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 37 jump1.TargetAddress()); | 38 jump1.TargetAddress()); |
| 38 JumpPattern jump2(entry + jump1.pattern_length_in_bytes()); | 39 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes()); |
| 39 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), | 40 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 40 jump2.TargetAddress()); | 41 jump2.TargetAddress()); |
| 41 uword target1 = jump1.TargetAddress(); | 42 uword target1 = jump1.TargetAddress(); |
| 42 uword target2 = jump2.TargetAddress(); | 43 uword target2 = jump2.TargetAddress(); |
| 43 jump1.SetTargetAddress(target2); | 44 jump1.SetTargetAddress(target2); |
| 44 jump2.SetTargetAddress(target1); | 45 jump2.SetTargetAddress(target1); |
| 45 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), | 46 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 46 jump1.TargetAddress()); | 47 jump1.TargetAddress()); |
| 47 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 48 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 48 jump2.TargetAddress()); | 49 jump2.TargetAddress()); |
| 49 } | 50 } |
| 50 | 51 |
| 51 } // namespace dart | 52 } // namespace dart |
| 52 | 53 |
| 53 #endif // defined TARGET_ARCH_ARM | 54 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |