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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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/code_patcher_arm.cc ('k') | runtime/vm/code_patcher_arm64_test.cc » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/instructions.h" 10 #include "vm/instructions.h"
(...skipping 24 matching lines...) Expand all
35 35
36 private: 36 private:
37 static const int kCallPatternSize = 3 * Instr::kInstrSize; 37 static const int kCallPatternSize = 3 * Instr::kInstrSize;
38 uword end_; 38 uword end_;
39 const ObjectPool& object_pool_; 39 const ObjectPool& object_pool_;
40 Register reg_; 40 Register reg_;
41 intptr_t index_; 41 intptr_t index_;
42 DISALLOW_IMPLICIT_CONSTRUCTORS(PoolPointerCall); 42 DISALLOW_IMPLICIT_CONSTRUCTORS(PoolPointerCall);
43 }; 43 };
44 44
45
46 RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, 45 RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address,
47 const Code& code) { 46 const Code& code) {
48 ASSERT(code.ContainsInstructionAt(return_address)); 47 ASSERT(code.ContainsInstructionAt(return_address));
49 PoolPointerCall call(return_address, code); 48 PoolPointerCall call(return_address, code);
50 return call.Target(); 49 return call.Target();
51 } 50 }
52 51
53
54 void CodePatcher::PatchStaticCallAt(uword return_address, 52 void CodePatcher::PatchStaticCallAt(uword return_address,
55 const Code& code, 53 const Code& code,
56 const Code& new_target) { 54 const Code& new_target) {
57 PatchPoolPointerCallAt(return_address, code, new_target); 55 PatchPoolPointerCallAt(return_address, code, new_target);
58 } 56 }
59 57
60
61 void CodePatcher::PatchPoolPointerCallAt(uword return_address, 58 void CodePatcher::PatchPoolPointerCallAt(uword return_address,
62 const Code& code, 59 const Code& code,
63 const Code& new_target) { 60 const Code& new_target) {
64 ASSERT(code.ContainsInstructionAt(return_address)); 61 ASSERT(code.ContainsInstructionAt(return_address));
65 PoolPointerCall call(return_address, code); 62 PoolPointerCall call(return_address, code);
66 call.SetTarget(new_target); 63 call.SetTarget(new_target);
67 } 64 }
68 65
69
70 void CodePatcher::InsertDeoptimizationCallAt(uword start) { 66 void CodePatcher::InsertDeoptimizationCallAt(uword start) {
71 UNREACHABLE(); 67 UNREACHABLE();
72 } 68 }
73 69
74
75 RawCode* CodePatcher::GetInstanceCallAt(uword return_address, 70 RawCode* CodePatcher::GetInstanceCallAt(uword return_address,
76 const Code& code, 71 const Code& code,
77 ICData* ic_data) { 72 ICData* ic_data) {
78 ASSERT(code.ContainsInstructionAt(return_address)); 73 ASSERT(code.ContainsInstructionAt(return_address));
79 CallPattern call(return_address, code); 74 CallPattern call(return_address, code);
80 if (ic_data != NULL) { 75 if (ic_data != NULL) {
81 *ic_data = call.IcData(); 76 *ic_data = call.IcData();
82 } 77 }
83 return call.TargetCode(); 78 return call.TargetCode();
84 } 79 }
85 80
86
87 intptr_t CodePatcher::InstanceCallSizeInBytes() { 81 intptr_t CodePatcher::InstanceCallSizeInBytes() {
88 // The instance call instruction sequence has a variable size on ARM64. 82 // The instance call instruction sequence has a variable size on ARM64.
89 UNREACHABLE(); 83 UNREACHABLE();
90 return 0; 84 return 0;
91 } 85 }
92 86
93
94 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, 87 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address,
95 const Code& code, 88 const Code& code,
96 ICData* ic_data_result) { 89 ICData* ic_data_result) {
97 ASSERT(code.ContainsInstructionAt(return_address)); 90 ASSERT(code.ContainsInstructionAt(return_address));
98 CallPattern static_call(return_address, code); 91 CallPattern static_call(return_address, code);
99 ICData& ic_data = ICData::Handle(); 92 ICData& ic_data = ICData::Handle();
100 ic_data ^= static_call.IcData(); 93 ic_data ^= static_call.IcData();
101 if (ic_data_result != NULL) { 94 if (ic_data_result != NULL) {
102 *ic_data_result = ic_data.raw(); 95 *ic_data_result = ic_data.raw();
103 } 96 }
104 return ic_data.GetTargetAt(0); 97 return ic_data.GetTargetAt(0);
105 } 98 }
106 99
107
108 void CodePatcher::PatchSwitchableCallAt(uword return_address, 100 void CodePatcher::PatchSwitchableCallAt(uword return_address,
109 const Code& caller_code, 101 const Code& caller_code,
110 const Object& data, 102 const Object& data,
111 const Code& target) { 103 const Code& target) {
112 ASSERT(caller_code.ContainsInstructionAt(return_address)); 104 ASSERT(caller_code.ContainsInstructionAt(return_address));
113 SwitchableCallPattern call(return_address, caller_code); 105 SwitchableCallPattern call(return_address, caller_code);
114 call.SetData(data); 106 call.SetData(data);
115 call.SetTarget(target); 107 call.SetTarget(target);
116 } 108 }
117 109
118
119 RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, 110 RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address,
120 const Code& caller_code) { 111 const Code& caller_code) {
121 ASSERT(caller_code.ContainsInstructionAt(return_address)); 112 ASSERT(caller_code.ContainsInstructionAt(return_address));
122 SwitchableCallPattern call(return_address, caller_code); 113 SwitchableCallPattern call(return_address, caller_code);
123 return call.target(); 114 return call.target();
124 } 115 }
125 116
126
127 RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, 117 RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address,
128 const Code& caller_code) { 118 const Code& caller_code) {
129 ASSERT(caller_code.ContainsInstructionAt(return_address)); 119 ASSERT(caller_code.ContainsInstructionAt(return_address));
130 SwitchableCallPattern call(return_address, caller_code); 120 SwitchableCallPattern call(return_address, caller_code);
131 return call.data(); 121 return call.data();
132 } 122 }
133 123
134
135 void CodePatcher::PatchNativeCallAt(uword return_address, 124 void CodePatcher::PatchNativeCallAt(uword return_address,
136 const Code& code, 125 const Code& code,
137 NativeFunction target, 126 NativeFunction target,
138 const Code& trampoline) { 127 const Code& trampoline) {
139 ASSERT(code.ContainsInstructionAt(return_address)); 128 ASSERT(code.ContainsInstructionAt(return_address));
140 NativeCallPattern call(return_address, code); 129 NativeCallPattern call(return_address, code);
141 call.set_target(trampoline); 130 call.set_target(trampoline);
142 call.set_native_function(target); 131 call.set_native_function(target);
143 } 132 }
144 133
145
146 RawCode* CodePatcher::GetNativeCallAt(uword return_address, 134 RawCode* CodePatcher::GetNativeCallAt(uword return_address,
147 const Code& code, 135 const Code& code,
148 NativeFunction* target) { 136 NativeFunction* target) {
149 ASSERT(code.ContainsInstructionAt(return_address)); 137 ASSERT(code.ContainsInstructionAt(return_address));
150 NativeCallPattern call(return_address, code); 138 NativeCallPattern call(return_address, code);
151 *target = call.native_function(); 139 *target = call.native_function();
152 return call.target(); 140 return call.target();
153 } 141 }
154 142
155 } // namespace dart 143 } // namespace dart
156 144
157 #endif // defined TARGET_ARCH_ARM64 145 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher_arm.cc ('k') | runtime/vm/code_patcher_arm64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698