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

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

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ARM working, x64 cleanup 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
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" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 9
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
11 #include "vm/instructions.h" 11 #include "vm/instructions.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 uword CodePatcher::GetStaticCallTargetAt(uword return_address, 16 RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address,
17 const Code& code) { 17 const Code& code) {
18 ASSERT(code.ContainsInstructionAt(return_address)); 18 ASSERT(code.ContainsInstructionAt(return_address));
19 CallPattern call(return_address, code); 19 CallPattern call(return_address, code);
20 return call.TargetAddress(); 20 return call.TargetCode();
21 } 21 }
22 22
23 23
24 void CodePatcher::PatchStaticCallAt(uword return_address, 24 void CodePatcher::PatchStaticCallAt(uword return_address,
25 const Code& code, 25 const Code& code,
26 uword new_target) { 26 const Code& new_target) {
27 ASSERT(code.ContainsInstructionAt(return_address)); 27 ASSERT(code.ContainsInstructionAt(return_address));
28 CallPattern call(return_address, code); 28 CallPattern call(return_address, code);
29 call.SetTargetAddress(new_target); 29 call.SetTargetCode(new_target);
30 } 30 }
31 31
32 32
33 void CodePatcher::PatchInstanceCallAt(uword return_address, 33 void CodePatcher::PatchInstanceCallAt(uword return_address,
34 const Code& code, 34 const Code& code,
35 uword new_target) { 35 const Code& new_target) {
36 ASSERT(code.ContainsInstructionAt(return_address)); 36 ASSERT(code.ContainsInstructionAt(return_address));
37 CallPattern call(return_address, code); 37 CallPattern call(return_address, code);
38 call.SetTargetAddress(new_target); 38 call.SetTargetCode(new_target);
39 } 39 }
40 40
41 41
42 void CodePatcher::InsertCallAt(uword start, uword target) { 42 void CodePatcher::InsertDeoptimizationCallAt(uword start, uword target) {
43 // The inserted call should not overlap the lazy deopt jump code. 43 // The inserted call should not overlap the lazy deopt jump code.
44 ASSERT(start + CallPattern::LengthInBytes() <= target); 44 ASSERT(start + CallPattern::DeoptCallPatternLengthInBytes() <= target);
45 CallPattern::InsertAt(start, target); 45 CallPattern::InsertDeoptCallAt(start, target);
46 } 46 }
47 47
48 48
49 uword CodePatcher::GetInstanceCallAt(uword return_address, 49 RawCode* CodePatcher::GetInstanceCallAt(uword return_address,
50 const Code& code, 50 const Code& code,
51 ICData* ic_data) { 51 ICData* ic_data) {
52 ASSERT(code.ContainsInstructionAt(return_address)); 52 ASSERT(code.ContainsInstructionAt(return_address));
53 CallPattern call(return_address, code); 53 CallPattern call(return_address, code);
54 if (ic_data != NULL) { 54 if (ic_data != NULL) {
55 *ic_data = call.IcData(); 55 *ic_data = call.IcData();
56 } 56 }
57 return call.TargetAddress(); 57 return call.TargetCode();
58 } 58 }
59 59
60 60
61 intptr_t CodePatcher::InstanceCallSizeInBytes() { 61 intptr_t CodePatcher::InstanceCallSizeInBytes() {
62 // The instance call instruction sequence has a variable size on ARM. 62 // The instance call instruction sequence has a variable size on ARM.
63 UNREACHABLE(); 63 UNREACHABLE();
64 return 0; 64 return 0;
65 } 65 }
66 66
67 67
68 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt( 68 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(
69 uword return_address, const Code& code, ICData* ic_data_result) { 69 uword return_address, const Code& code, ICData* ic_data_result) {
70 ASSERT(code.ContainsInstructionAt(return_address)); 70 ASSERT(code.ContainsInstructionAt(return_address));
71 CallPattern static_call(return_address, code); 71 CallPattern static_call(return_address, code);
72 ICData& ic_data = ICData::Handle(); 72 ICData& ic_data = ICData::Handle();
73 ic_data ^= static_call.IcData(); 73 ic_data ^= static_call.IcData();
74 if (ic_data_result != NULL) { 74 if (ic_data_result != NULL) {
75 *ic_data_result = ic_data.raw(); 75 *ic_data_result = ic_data.raw();
76 } 76 }
77 return ic_data.GetTargetAt(0); 77 return ic_data.GetTargetAt(0);
78 } 78 }
79 79
80 80
81 void CodePatcher::PatchNativeCallAt(uword return_address, 81 void CodePatcher::PatchNativeCallAt(uword return_address,
82 const Code& code, 82 const Code& code,
83 NativeFunction target, 83 NativeFunction target,
84 const Code& trampoline) { 84 const Code& trampoline) {
85 ASSERT(code.ContainsInstructionAt(return_address)); 85 ASSERT(code.ContainsInstructionAt(return_address));
86 NativeCallPattern call(return_address, code); 86 NativeCallPattern call(return_address, code);
87 call.set_target(trampoline.EntryPoint()); 87 call.set_target(trampoline);
88 call.set_native_function(target); 88 call.set_native_function(target);
89 } 89 }
90 90
91 91
92 uword CodePatcher::GetNativeCallAt(uword return_address, 92 RawCode* CodePatcher::GetNativeCallAt(uword return_address,
93 const Code& code, 93 const Code& code,
94 NativeFunction* target) { 94 NativeFunction* target) {
95 ASSERT(code.ContainsInstructionAt(return_address)); 95 ASSERT(code.ContainsInstructionAt(return_address));
96 NativeCallPattern call(return_address, code); 96 NativeCallPattern call(return_address, code);
97 *target = call.native_function(); 97 *target = call.native_function();
98 return call.target(); 98 return call.target();
99 } 99 }
100 100
101 101
102 // This class pattern matches on a load from the object pool. Loading on 102 // This class pattern matches on a load from the object pool. Loading on
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { 137 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
138 ASSERT(code.ContainsInstructionAt(pc)); 138 ASSERT(code.ContainsInstructionAt(pc));
139 EdgeCounter counter(pc, code); 139 EdgeCounter counter(pc, code);
140 return counter.edge_counter(); 140 return counter.edge_counter();
141 } 141 }
142 142
143 } // namespace dart 143 } // namespace dart
144 144
145 #endif // defined TARGET_ARCH_ARM 145 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698