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/cpu.h" |
9 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
10 #include "vm/stub_code.h" | 11 #include "vm/stub_code.h" |
11 #include "vm/unit_test.h" | 12 #include "vm/unit_test.h" |
12 | 13 |
13 namespace dart { | 14 namespace dart { |
14 | 15 |
15 #define __ assembler-> | 16 #define __ assembler-> |
16 | 17 |
17 ASSEMBLER_TEST_GENERATE(Call, assembler) { | 18 ASSEMBLER_TEST_GENERATE(Call, assembler) { |
18 __ BranchLinkPatchable(&StubCode::InstanceFunctionLookupLabel()); | 19 __ BranchLinkPatchable(&StubCode::InstanceFunctionLookupLabel()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 uword target1 = jump1.TargetAddress(); | 56 uword target1 = jump1.TargetAddress(); |
56 uword target2 = jump2.TargetAddress(); | 57 uword target2 = jump2.TargetAddress(); |
57 jump1.SetTargetAddress(target2); | 58 jump1.SetTargetAddress(target2); |
58 jump2.SetTargetAddress(target1); | 59 jump2.SetTargetAddress(target1); |
59 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), | 60 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
60 jump1.TargetAddress()); | 61 jump1.TargetAddress()); |
61 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 62 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
62 jump2.TargetAddress()); | 63 jump2.TargetAddress()); |
63 } | 64 } |
64 | 65 |
| 66 |
| 67 #if defined(USING_SIMULATOR) |
| 68 ASSEMBLER_TEST_GENERATE(JumpARMv6, assembler) { |
| 69 // ARMv7 is the default. |
| 70 HostCPUFeatures::set_arm_version(ARMv6); |
| 71 __ BranchPatchable(&StubCode::InstanceFunctionLookupLabel()); |
| 72 __ BranchPatchable(&StubCode::AllocateArrayLabel()); |
| 73 HostCPUFeatures::set_arm_version(ARMv7); |
| 74 } |
| 75 |
| 76 |
| 77 ASSEMBLER_TEST_RUN(JumpARMv6, test) { |
| 78 HostCPUFeatures::set_arm_version(ARMv6); |
| 79 const Code& code = test->code(); |
| 80 const Instructions& instrs = Instructions::Handle(code.instructions()); |
| 81 bool status = |
| 82 VirtualMemory::Protect(reinterpret_cast<void*>(instrs.EntryPoint()), |
| 83 instrs.size(), |
| 84 VirtualMemory::kReadWrite); |
| 85 EXPECT(status); |
| 86 JumpPattern jump1(test->entry(), test->code()); |
| 87 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 88 jump1.TargetAddress()); |
| 89 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes(), |
| 90 test->code()); |
| 91 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 92 jump2.TargetAddress()); |
| 93 uword target1 = jump1.TargetAddress(); |
| 94 uword target2 = jump2.TargetAddress(); |
| 95 jump1.SetTargetAddress(target2); |
| 96 jump2.SetTargetAddress(target1); |
| 97 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 98 jump1.TargetAddress()); |
| 99 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 100 jump2.TargetAddress()); |
| 101 HostCPUFeatures::set_arm_version(ARMv7); |
| 102 } |
| 103 #endif |
| 104 |
65 } // namespace dart | 105 } // namespace dart |
66 | 106 |
67 #endif // defined TARGET_ARCH_ARM | 107 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |