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

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

Issue 9395016: First part of new ICData infrastructure: use a wrapper object instead of an array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/code_patcher_arm.cc ('k') | runtime/vm/code_patcher_ia32_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
11 #include "vm/ic_data.h"
12 #include "vm/instructions.h" 11 #include "vm/instructions.h"
13 #include "vm/object.h" 12 #include "vm/object.h"
14 #include "vm/raw_object.h" 13 #include "vm/raw_object.h"
15 14
16 namespace dart { 15 namespace dart {
17 16
18 // The pattern of a Dart call is: 17 // The pattern of a Dart call is:
19 // 1: mov ECX, immediate 1 18 // 1: mov ECX, immediate 1
20 // 2: mov EDX, immediate 2 19 // 2: mov EDX, immediate 2
21 // 3: call target_address 20 // 3: call target_address
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 f ^= reinterpret_cast<RawObject*>(immediate_one()); 112 f ^= reinterpret_cast<RawObject*>(immediate_one());
114 return f.raw(); 113 return f.raw();
115 } 114 }
116 115
117 private: 116 private:
118 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCall); 117 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticCall);
119 }; 118 };
120 119
121 120
122 // The expected pattern of a dart instance call: 121 // The expected pattern of a dart instance call:
123 // mov ECX, ic-data array 122 // mov ECX, ic-data
124 // mov EDX, argument_descriptor_array 123 // mov EDX, argument_descriptor_array
125 // call target_address 124 // call target_address
126 // <- return address 125 // <- return address
127 class InstanceCall : public DartCallPattern { 126 class InstanceCall : public DartCallPattern {
128 public: 127 public:
129 explicit InstanceCall(uword return_address) 128 explicit InstanceCall(uword return_address)
130 : DartCallPattern(return_address) {} 129 : DartCallPattern(return_address) {}
131 130
132 RawArray* ic_data() const { 131 RawICData* ic_data() const {
133 Array& array = Array::Handle(); 132 ICData& ic_data = ICData::Handle();
134 array ^= reinterpret_cast<RawObject*>(immediate_one()); 133 ic_data ^= reinterpret_cast<RawObject*>(immediate_one());
135 return array.raw(); 134 return ic_data.raw();
136 } 135 }
137 136
138 void SetIcData(const Array& value) { 137 void SetIcData(const ICData& value) {
139 set_immediate_one(reinterpret_cast<int32_t>(value.raw())); 138 set_immediate_one(reinterpret_cast<int32_t>(value.raw()));
140 } 139 }
141 140
142 private: 141 private:
143 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall); 142 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCall);
144 }; 143 };
145 144
146 145
147 void CodePatcher::GetStaticCallAt(uword return_address, 146 void CodePatcher::GetStaticCallAt(uword return_address,
148 Function* function, 147 Function* function,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 int* num_named_arguments, 240 int* num_named_arguments,
242 uword* target) { 241 uword* target) {
243 ASSERT(function_name != NULL); 242 ASSERT(function_name != NULL);
244 ASSERT(num_arguments != NULL); 243 ASSERT(num_arguments != NULL);
245 ASSERT(num_named_arguments != NULL); 244 ASSERT(num_named_arguments != NULL);
246 ASSERT(target != NULL); 245 ASSERT(target != NULL);
247 InstanceCall call(return_address); 246 InstanceCall call(return_address);
248 *num_arguments = call.argument_count(); 247 *num_arguments = call.argument_count();
249 *num_named_arguments = call.named_argument_count(); 248 *num_named_arguments = call.named_argument_count();
250 *target = call.target(); 249 *target = call.target();
251 ICData ic_data(Array::ZoneHandle(call.ic_data())); 250 const ICData& ic_data = ICData::Handle(call.ic_data());
252 *function_name = ic_data.FunctionName(); 251 *function_name = ic_data.target_name();
253 } 252 }
254 253
255 254
256 RawArray* CodePatcher::GetInstanceCallIcDataAt(uword return_address) { 255 RawICData* CodePatcher::GetInstanceCallIcDataAt(uword return_address) {
257 InstanceCall call(return_address); 256 InstanceCall call(return_address);
258 return call.ic_data(); 257 return call.ic_data();
259 } 258 }
260 259
261 260
262 void CodePatcher::SetInstanceCallIcDataAt(uword return_address,
263 const Array& ic_data) {
264 InstanceCall call(return_address);
265 call.SetIcData(ic_data);
266 }
267
268
269 intptr_t CodePatcher::InstanceCallSizeInBytes() { 261 intptr_t CodePatcher::InstanceCallSizeInBytes() {
270 return DartCallPattern::kNumInstructions * DartCallPattern::kInstructionSize; 262 return DartCallPattern::kNumInstructions * DartCallPattern::kInstructionSize;
271 } 263 }
272 264
273 } // namespace dart 265 } // namespace dart
274 266
275 #endif // defined TARGET_ARCH_IA32 267 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher_arm.cc ('k') | runtime/vm/code_patcher_ia32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698