| 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 StubCode* stub_code = Isolate::Current()->stub_code(); | 18 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 19 __ call(&stub_code->InvokeDartCodeLabel()); | 19 __ call(&stub_code->InvokeDartCodeLabel()); |
| 20 __ ret(); | 20 __ ret(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 | 23 |
| 24 ASSEMBLER_TEST_RUN(Call, test) { | |
| 25 StubCode* stub_code = Isolate::Current()->stub_code(); | |
| 26 CallPattern call(test->entry(), test->code()); | |
| 27 EXPECT_EQ(stub_code->InvokeDartCodeLabel().address(), | |
| 28 call.TargetAddress()); | |
| 29 } | |
| 30 | |
| 31 | |
| 32 static intptr_t prologue_code_size = -1; | 24 static intptr_t prologue_code_size = -1; |
| 33 | 25 |
| 34 | 26 |
| 35 ASSEMBLER_TEST_GENERATE(Jump, assembler) { | 27 ASSEMBLER_TEST_GENERATE(Jump, assembler) { |
| 36 ASSERT(assembler->CodeSize() == 0); | 28 ASSERT(assembler->CodeSize() == 0); |
| 37 __ pushq(PP); | 29 __ pushq(PP); |
| 38 __ LoadPoolPointer(PP); | 30 __ LoadPoolPointer(PP); |
| 39 prologue_code_size = assembler->CodeSize(); | 31 prologue_code_size = assembler->CodeSize(); |
| 40 StubCode* stub_code = Isolate::Current()->stub_code(); | 32 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 41 __ JmpPatchable(&stub_code->InvokeDartCodeLabel(), PP); | 33 __ JmpPatchable(&stub_code->InvokeDartCodeLabel(), PP); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 71 jump1.SetTargetAddress(target2); | 63 jump1.SetTargetAddress(target2); |
| 72 jump2.SetTargetAddress(target1); | 64 jump2.SetTargetAddress(target1); |
| 73 EXPECT_EQ(array_stub.EntryPoint(), jump1.TargetAddress()); | 65 EXPECT_EQ(array_stub.EntryPoint(), jump1.TargetAddress()); |
| 74 EXPECT_EQ(stub_code->InvokeDartCodeLabel().address(), | 66 EXPECT_EQ(stub_code->InvokeDartCodeLabel().address(), |
| 75 jump2.TargetAddress()); | 67 jump2.TargetAddress()); |
| 76 } | 68 } |
| 77 | 69 |
| 78 } // namespace dart | 70 } // namespace dart |
| 79 | 71 |
| 80 #endif // defined TARGET_ARCH_X64 | 72 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |