| OLD | NEW |
| 1 // Copyright (c) 2012, 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 | 29 |
| 30 ASSEMBLER_TEST_GENERATE(Jump, assembler) { | 30 ASSEMBLER_TEST_GENERATE(Jump, assembler) { |
| 31 __ jmp(&StubCode::InstanceFunctionLookupLabel()); | 31 __ jmp(&StubCode::InstanceFunctionLookupLabel()); |
| 32 __ jmp(&StubCode::AllocateArrayLabel()); | 32 __ jmp(&StubCode::AllocateArrayLabel()); |
| 33 __ ret(); | 33 __ ret(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 | 36 |
| 37 ASSEMBLER_TEST_RUN(Jump, test) { | 37 ASSEMBLER_TEST_RUN(Jump, test) { |
| 38 JumpPattern jump1(test->entry()); | 38 JumpPattern jump1(test->entry(), test->code()); |
| 39 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 39 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 40 jump1.TargetAddress()); | 40 jump1.TargetAddress()); |
| 41 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes()); | 41 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes(), |
| 42 test->code()); |
| 42 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), | 43 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 43 jump2.TargetAddress()); | 44 jump2.TargetAddress()); |
| 44 uword target1 = jump1.TargetAddress(); | 45 uword target1 = jump1.TargetAddress(); |
| 45 uword target2 = jump2.TargetAddress(); | 46 uword target2 = jump2.TargetAddress(); |
| 46 jump1.SetTargetAddress(target2); | 47 jump1.SetTargetAddress(target2); |
| 47 jump2.SetTargetAddress(target1); | 48 jump2.SetTargetAddress(target1); |
| 48 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), | 49 EXPECT_EQ(StubCode::AllocateArrayLabel().address(), |
| 49 jump1.TargetAddress()); | 50 jump1.TargetAddress()); |
| 50 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), | 51 EXPECT_EQ(StubCode::InstanceFunctionLookupLabel().address(), |
| 51 jump2.TargetAddress()); | 52 jump2.TargetAddress()); |
| 52 } | 53 } |
| 53 | 54 |
| 54 } // namespace dart | 55 } // namespace dart |
| 55 | 56 |
| 56 #endif // defined TARGET_ARCH_IA32 | 57 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |