Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: runtime/vm/instructions_arm_test.cc

Issue 1343373003: Revert "VM: New calling convention for generated code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/instructions_arm64_test.cc ('k') | runtime/vm/instructions_ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cpu.h"
10 #include "vm/instructions.h" 10 #include "vm/instructions.h"
(...skipping 11 matching lines...) Expand all
22 __ Ret(); 22 __ Ret();
23 } 23 }
24 24
25 25
26 ASSEMBLER_TEST_RUN(Call, test) { 26 ASSEMBLER_TEST_RUN(Call, test) {
27 // The return address, which must be the address of an instruction contained 27 // The return address, which must be the address of an instruction contained
28 // in the code, points to the Ret instruction above, i.e. one instruction 28 // in the code, points to the Ret instruction above, i.e. one instruction
29 // before the end of the code buffer. 29 // before the end of the code buffer.
30 CallPattern call(test->entry() + test->code().Size() - Instr::kInstrSize, 30 CallPattern call(test->entry() + test->code().Size() - Instr::kInstrSize,
31 test->code()); 31 test->code());
32 EXPECT_EQ(StubCode::InvokeDartCode_entry()->code(), call.TargetCode()); 32 EXPECT_EQ(StubCode::InvokeDartCode_entry()->label().address(),
33 call.TargetAddress());
33 } 34 }
34 35
36
37 ASSEMBLER_TEST_GENERATE(Jump, assembler) {
38 __ BranchPatchable(*StubCode::InvokeDartCode_entry());
39 __ BranchPatchable(*StubCode::AllocateArray_entry());
40 }
41
42
43 ASSEMBLER_TEST_RUN(Jump, test) {
44 const Code& code = test->code();
45 const Instructions& instrs = Instructions::Handle(code.instructions());
46 bool status =
47 VirtualMemory::Protect(reinterpret_cast<void*>(instrs.EntryPoint()),
48 instrs.size(),
49 VirtualMemory::kReadWrite);
50 EXPECT(status);
51 JumpPattern jump1(test->entry(), test->code());
52 EXPECT_EQ(StubCode::InvokeDartCode_entry()->label().address(),
53 jump1.TargetAddress());
54 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes(),
55 test->code());
56 const Code& array_stub =
57 Code::Handle(StubCode::AllocateArray_entry()->code());
58 EXPECT_EQ(array_stub.EntryPoint(), jump2.TargetAddress());
59 uword target1 = jump1.TargetAddress();
60 uword target2 = jump2.TargetAddress();
61 jump1.SetTargetAddress(target2);
62 jump2.SetTargetAddress(target1);
63 EXPECT_EQ(array_stub.EntryPoint(), jump1.TargetAddress());
64 EXPECT_EQ(StubCode::InvokeDartCode_entry()->label().address(),
65 jump2.TargetAddress());
66 }
67
68
69 #if defined(USING_SIMULATOR)
70 ASSEMBLER_TEST_GENERATE(JumpARMv6, assembler) {
71 // ARMv7 is the default.
72 HostCPUFeatures::set_arm_version(ARMv6);
73 __ BranchPatchable(*StubCode::InvokeDartCode_entry());
74 __ BranchPatchable(*StubCode::AllocateArray_entry());
75 HostCPUFeatures::set_arm_version(ARMv7);
76 }
77
78
79 ASSEMBLER_TEST_RUN(JumpARMv6, test) {
80 HostCPUFeatures::set_arm_version(ARMv6);
81 const Code& code = test->code();
82 const Instructions& instrs = Instructions::Handle(code.instructions());
83 bool status =
84 VirtualMemory::Protect(reinterpret_cast<void*>(instrs.EntryPoint()),
85 instrs.size(),
86 VirtualMemory::kReadWrite);
87 EXPECT(status);
88 JumpPattern jump1(test->entry(), test->code());
89 EXPECT_EQ(StubCode::InvokeDartCode_entry()->label().address(),
90 jump1.TargetAddress());
91 JumpPattern jump2(test->entry() + jump1.pattern_length_in_bytes(),
92 test->code());
93 const Code& array_stub =
94 Code::Handle(StubCode::AllocateArray_entry()->code());
95 EXPECT_EQ(array_stub.EntryPoint(), jump2.TargetAddress());
96 uword target1 = jump1.TargetAddress();
97 uword target2 = jump2.TargetAddress();
98 jump1.SetTargetAddress(target2);
99 jump2.SetTargetAddress(target1);
100 EXPECT_EQ(array_stub.EntryPoint(), jump1.TargetAddress());
101 EXPECT_EQ(StubCode::InvokeDartCode_entry()->label().address(),
102 jump2.TargetAddress());
103 HostCPUFeatures::set_arm_version(ARMv7);
104 }
105 #endif
106
35 } // namespace dart 107 } // namespace dart
36 108
37 #endif // defined TARGET_ARCH_ARM 109 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/instructions_arm64_test.cc ('k') | runtime/vm/instructions_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698