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_X64) | 6 #if defined(TARGET_ARCH_X64) |
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::InvokeDartCodeLabel()); | 18 __ call(&StubCode::InvokeDartCodeLabel()); |
19 __ ret(); | 19 __ ret(); |
20 } | 20 } |
21 | 21 |
22 | 22 |
23 static intptr_t prologue_code_size = -1; | 23 static intptr_t prologue_code_size = -1; |
24 | 24 |
25 | 25 |
26 ASSEMBLER_TEST_GENERATE(Jump, assembler) { | 26 ASSEMBLER_TEST_GENERATE(Jump, assembler) { |
27 ASSERT(assembler->CodeSize() == 0); | 27 ASSERT(assembler->CodeSize() == 0); |
28 __ pushq(PP); | 28 __ pushq(PP); |
29 __ LoadPoolPointer(PP); | 29 __ LoadPoolPointer(); |
30 prologue_code_size = assembler->CodeSize(); | 30 prologue_code_size = assembler->CodeSize(); |
31 __ JmpPatchable(&StubCode::InvokeDartCodeLabel(), PP); | 31 __ JmpPatchable(&StubCode::InvokeDartCodeLabel(), PP); |
32 const ExternalLabel array_label(StubCode::AllocateArrayEntryPoint()); | 32 const ExternalLabel array_label(StubCode::AllocateArrayEntryPoint()); |
33 __ JmpPatchable(&array_label, PP); | 33 __ JmpPatchable(&array_label, PP); |
34 __ popq(PP); | 34 __ popq(PP); |
35 __ ret(); | 35 __ ret(); |
36 } | 36 } |
37 | 37 |
38 | 38 |
39 ASSEMBLER_TEST_RUN(Jump, test) { | 39 ASSEMBLER_TEST_RUN(Jump, test) { |
(...skipping 20 matching lines...) Expand all Loading... |
60 jump1.SetTargetAddress(target2); | 60 jump1.SetTargetAddress(target2); |
61 jump2.SetTargetAddress(target1); | 61 jump2.SetTargetAddress(target1); |
62 EXPECT_EQ(array_stub.EntryPoint(), jump1.TargetAddress()); | 62 EXPECT_EQ(array_stub.EntryPoint(), jump1.TargetAddress()); |
63 EXPECT_EQ(StubCode::InvokeDartCodeLabel().address(), | 63 EXPECT_EQ(StubCode::InvokeDartCodeLabel().address(), |
64 jump2.TargetAddress()); | 64 jump2.TargetAddress()); |
65 } | 65 } |
66 | 66 |
67 } // namespace dart | 67 } // namespace dart |
68 | 68 |
69 #endif // defined TARGET_ARCH_X64 | 69 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |