| 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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 ASSEMBLER_TEST_GENERATE(Jump, assembler) { | 35 ASSEMBLER_TEST_GENERATE(Jump, assembler) { |
| 36 __ BranchPatchable(&StubCode::InstanceFunctionLookupLabel()); | 36 __ BranchPatchable(&StubCode::InstanceFunctionLookupLabel()); |
| 37 __ BranchPatchable(&StubCode::AllocateArrayLabel()); | 37 __ BranchPatchable(&StubCode::AllocateArrayLabel()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 ASSEMBLER_TEST_RUN(Jump, test) { | 41 ASSEMBLER_TEST_RUN(Jump, test) { |
| 42 const Code& code = test->code(); |
| 43 const Instructions& instrs = Instructions::Handle(code.instructions()); |
| 44 bool status = |
| 45 VirtualMemory::Protect(reinterpret_cast<void*>(instrs.EntryPoint()), |
| 46 instrs.size(), |
| 47 VirtualMemory::kReadWrite); |
| 48 EXPECT(status); |
| 42 JumpPattern jump1(test->entry(), test->code()); | 49 JumpPattern jump1(test->entry(), test->code()); |
| 43 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 50 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 44 jump1.TargetAddress()); | 51 jump1.TargetAddress()); |
| 45 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes(), | 52 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes(), |
| 46 test->code()); | 53 test->code()); |
| 47 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), | 54 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 48 jump2.TargetAddress()); | 55 jump2.TargetAddress()); |
| 49 uword target1 = jump1.TargetAddress(); | 56 uword target1 = jump1.TargetAddress(); |
| 50 uword target2 = jump2.TargetAddress(); | 57 uword target2 = jump2.TargetAddress(); |
| 51 jump1.SetTargetAddress(target2); | 58 jump1.SetTargetAddress(target2); |
| 52 jump2.SetTargetAddress(target1); | 59 jump2.SetTargetAddress(target1); |
| 53 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), | 60 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 54 jump1.TargetAddress()); | 61 jump1.TargetAddress()); |
| 55 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 62 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 56 jump2.TargetAddress()); | 63 jump2.TargetAddress()); |
| 57 } | 64 } |
| 58 | 65 |
| 59 } // namespace dart | 66 } // namespace dart |
| 60 | 67 |
| 61 #endif // defined TARGET_ARCH_MIPS | 68 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |