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

Side by Side Diff: vm/intermediate_language_x64.cc

Issue 10412043: Make it less verbose to declare instructions that use LocationSummary-based code generation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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 | « vm/intermediate_language_ia32.cc ('k') | no next file » | 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) 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" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 #include "vm/locations.h" 9 #include "vm/locations.h"
10 #include "vm/stub_code.h" 10 #include "vm/stub_code.h"
(...skipping 28 matching lines...) Expand all
39 intptr_t input_count, Location out) { 39 intptr_t input_count, Location out) {
40 LocationSummary* summary = new LocationSummary(input_count); 40 LocationSummary* summary = new LocationSummary(input_count);
41 for (intptr_t i = 0; i < input_count; i++) { 41 for (intptr_t i = 0; i < input_count; i++) {
42 summary->set_in(i, Location::RequiresRegister()); 42 summary->set_in(i, Location::RequiresRegister());
43 } 43 }
44 summary->set_out(out); 44 summary->set_out(out);
45 return summary; 45 return summary;
46 } 46 }
47 47
48 48
49 LocationSummary* CurrentContextComp::MakeLocationSummary() { 49 LocationSummary* CurrentContextComp::MakeLocationSummary() const {
50 return MakeSimpleLocationSummary(0, Location::RequiresRegister()); 50 return MakeSimpleLocationSummary(0, Location::RequiresRegister());
51 } 51 }
52 52
53 53
54 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 54 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
55 __ movq(locs()->out().reg(), CTX); 55 __ movq(locs()->out().reg(), CTX);
56 } 56 }
57 57
58 58
59 LocationSummary* StoreContextComp::MakeLocationSummary() { 59 LocationSummary* StoreContextComp::MakeLocationSummary() const {
60 LocationSummary* summary = new LocationSummary(1); 60 LocationSummary* summary = new LocationSummary(1);
61 summary->set_in(0, Location::RegisterLocation(CTX)); 61 summary->set_in(0, Location::RegisterLocation(CTX));
62 return summary; 62 return summary;
63 } 63 }
64 64
65 65
66 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 66 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
67 // Nothing to do. Context register were loaded by register allocator. 67 // Nothing to do. Context register were loaded by register allocator.
68 ASSERT(locs()->in(0).reg() == CTX); 68 ASSERT(locs()->in(0).reg() == CTX);
69 } 69 }
70 70
71 71
72 LocationSummary* StrictCompareComp::MakeLocationSummary() { 72 LocationSummary* StrictCompareComp::MakeLocationSummary() const {
73 return MakeSimpleLocationSummary(2, Location::SameAsFirstInput()); 73 return MakeSimpleLocationSummary(2, Location::SameAsFirstInput());
74 } 74 }
75 75
76 76
77 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) { 77 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
78 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); 78 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
79 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); 79 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
80 80
81 Register left = locs()->in(0).reg(); 81 Register left = locs()->in(0).reg();
82 Register right = locs()->in(1).reg(); 82 Register right = locs()->in(1).reg();
(...skipping 16 matching lines...) Expand all
99 99
100 // Generic summary for call instructions that have all arguments pushed 100 // Generic summary for call instructions that have all arguments pushed
101 // on the stack and return the result in a fixed register RAX. 101 // on the stack and return the result in a fixed register RAX.
102 static LocationSummary* MakeCallSummary() { 102 static LocationSummary* MakeCallSummary() {
103 LocationSummary* result = new LocationSummary(0); 103 LocationSummary* result = new LocationSummary(0);
104 result->set_out(Location::RegisterLocation(RAX)); 104 result->set_out(Location::RegisterLocation(RAX));
105 return result; 105 return result;
106 } 106 }
107 107
108 108
109 LocationSummary* ClosureCallComp::MakeLocationSummary() { 109 LocationSummary* ClosureCallComp::MakeLocationSummary() const {
110 return MakeCallSummary(); 110 return MakeCallSummary();
111 } 111 }
112 112
113 113
114 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { 114 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
115 ASSERT(VerifyCallComputation(this)); 115 ASSERT(VerifyCallComputation(this));
116 // The arguments to the stub include the closure. The arguments 116 // The arguments to the stub include the closure. The arguments
117 // descriptor describes the closure's arguments (and so does not include 117 // descriptor describes the closure's arguments (and so does not include
118 // the closure). 118 // the closure).
119 int argument_count = ArgumentCount(); 119 int argument_count = ArgumentCount();
120 const Array& arguments_descriptor = 120 const Array& arguments_descriptor =
121 CodeGenerator::ArgumentsDescriptor(argument_count - 1, 121 CodeGenerator::ArgumentsDescriptor(argument_count - 1,
122 argument_names()); 122 argument_names());
123 __ LoadObject(R10, arguments_descriptor); 123 __ LoadObject(R10, arguments_descriptor);
124 124
125 compiler->GenerateCall(token_index(), 125 compiler->GenerateCall(token_index(),
126 try_index(), 126 try_index(),
127 &StubCode::CallClosureFunctionLabel(), 127 &StubCode::CallClosureFunctionLabel(),
128 PcDescriptors::kOther); 128 PcDescriptors::kOther);
129 __ Drop(argument_count); 129 __ Drop(argument_count);
130 } 130 }
131 131
132 132
133 LocationSummary* InstanceCallComp::MakeLocationSummary() { 133 LocationSummary* InstanceCallComp::MakeLocationSummary() const {
134 return MakeCallSummary(); 134 return MakeCallSummary();
135 } 135 }
136 136
137 137
138 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { 138 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
139 ASSERT(VerifyCallComputation(this)); 139 ASSERT(VerifyCallComputation(this));
140 compiler->EmitInstanceCall(cid(), 140 compiler->EmitInstanceCall(cid(),
141 token_index(), 141 token_index(),
142 try_index(), 142 try_index(),
143 function_name(), 143 function_name(),
144 ArgumentCount(), 144 ArgumentCount(),
145 argument_names(), 145 argument_names(),
146 checked_argument_count()); 146 checked_argument_count());
147 } 147 }
148 148
149 149
150 LocationSummary* StaticCallComp::MakeLocationSummary() { 150 LocationSummary* StaticCallComp::MakeLocationSummary() const {
151 return MakeCallSummary(); 151 return MakeCallSummary();
152 } 152 }
153 153
154 154
155 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { 155 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
156 ASSERT(VerifyCallComputation(this)); 156 ASSERT(VerifyCallComputation(this));
157 compiler->EmitStaticCall(token_index(), 157 compiler->EmitStaticCall(token_index(),
158 try_index(), 158 try_index(),
159 function(), 159 function(),
160 ArgumentCount(), 160 ArgumentCount(),
161 argument_names()); 161 argument_names());
162 } 162 }
163 163
164 164
165 LocationSummary* LoadLocalComp::MakeLocationSummary() { 165 LocationSummary* LoadLocalComp::MakeLocationSummary() const {
166 return MakeSimpleLocationSummary(0, Location::RequiresRegister()); 166 return MakeSimpleLocationSummary(0, Location::RequiresRegister());
167 } 167 }
168 168
169 169
170 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { 170 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) {
171 Register result = locs()->out().reg(); 171 Register result = locs()->out().reg();
172 __ movq(result, Address(RBP, local().index() * kWordSize)); 172 __ movq(result, Address(RBP, local().index() * kWordSize));
173 } 173 }
174 174
175 175
176 LocationSummary* StoreLocalComp::MakeLocationSummary() { 176 LocationSummary* StoreLocalComp::MakeLocationSummary() const {
177 return MakeSimpleLocationSummary(1, Location::SameAsFirstInput()); 177 return MakeSimpleLocationSummary(1, Location::SameAsFirstInput());
178 } 178 }
179 179
180 180
181 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { 181 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) {
182 Register value = locs()->in(0).reg(); 182 Register value = locs()->in(0).reg();
183 Register result = locs()->out().reg(); 183 Register result = locs()->out().reg();
184 ASSERT(result == value); // Assert that register assignment is correct. 184 ASSERT(result == value); // Assert that register assignment is correct.
185 __ movq(Address(RBP, local().index() * kWordSize), value); 185 __ movq(Address(RBP, local().index() * kWordSize), value);
186 } 186 }
187 187
188 188
189 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 189 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
190 computation()->EmitNativeCode(compiler); 190 computation()->EmitNativeCode(compiler);
191 __ pushq(locs()->out().reg()); 191 __ pushq(locs()->out().reg());
192 } 192 }
193 193
194 194
195 LocationSummary* ConstantVal::MakeLocationSummary() { 195 LocationSummary* ConstantVal::MakeLocationSummary() const {
196 return MakeSimpleLocationSummary(0, Location::RequiresRegister()); 196 return MakeSimpleLocationSummary(0, Location::RequiresRegister());
197 } 197 }
198 198
199 199
200 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) { 200 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) {
201 Register result = locs()->out().reg(); 201 Register result = locs()->out().reg();
202 if (value().IsSmi()) { 202 if (value().IsSmi()) {
203 int64_t imm = reinterpret_cast<int64_t>(value().raw()); 203 int64_t imm = reinterpret_cast<int64_t>(value().raw());
204 __ movq(result, Immediate(imm)); 204 __ movq(result, Immediate(imm));
205 } else { 205 } else {
206 __ LoadObject(result, value()); 206 __ LoadObject(result, value());
207 } 207 }
208 } 208 }
209 209
210 210
211 void UseVal::EmitNativeCode(FlowGraphCompiler* compiler) {
212 UNIMPLEMENTED();
213 }
214
215
216 LocationSummary* UseVal::MakeLocationSummary() const {
217 return NULL;
218 }
219
220
221 void AssertAssignableComp::EmitNativeCode(FlowGraphCompiler* compiler) {
222 UNIMPLEMENTED();
223 }
224
225
226 LocationSummary* AssertAssignableComp::MakeLocationSummary() const {
227 return NULL;
228 }
229
230
231 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) {
232 UNIMPLEMENTED();
233 }
234
235
236 LocationSummary* AssertBooleanComp::MakeLocationSummary() const {
237 return NULL;
238 }
239
240
241 void EqualityCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
242 UNIMPLEMENTED();
243 }
244
245
246 LocationSummary* EqualityCompareComp::MakeLocationSummary() const {
247 return NULL;
248 }
249
250
251 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
252 UNIMPLEMENTED();
253 }
254
255
256 LocationSummary* NativeCallComp::MakeLocationSummary() const {
257 return NULL;
258 }
259
260
261 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
262 UNIMPLEMENTED();
263 }
264
265
266 LocationSummary* StoreIndexedComp::MakeLocationSummary() const {
267 return NULL;
268 }
269
270
271 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
272 UNIMPLEMENTED();
273 }
274
275
276 LocationSummary* InstanceSetterComp::MakeLocationSummary() const {
277 return NULL;
278 }
279
280
281 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
282 UNIMPLEMENTED();
283 }
284
285
286 LocationSummary* StaticSetterComp::MakeLocationSummary() const {
287 return NULL;
288 }
289
290
291 void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
292 UNIMPLEMENTED();
293 }
294
295
296 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const {
297 return NULL;
298 }
299
300
301 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
302 UNIMPLEMENTED();
303 }
304
305
306 LocationSummary* StoreInstanceFieldComp::MakeLocationSummary() const {
307 return NULL;
308 }
309
310
311 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
312 UNIMPLEMENTED();
313 }
314
315
316 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const {
317 return NULL;
318 }
319
320
321 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
322 UNIMPLEMENTED();
323 }
324
325
326 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const {
327 return NULL;
328 }
329
330
331 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) {
332 UNIMPLEMENTED();
333 }
334
335
336 LocationSummary* BooleanNegateComp::MakeLocationSummary() const {
337 return NULL;
338 }
339
340
341 void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) {
342 UNIMPLEMENTED();
343 }
344
345
346 LocationSummary* InstanceOfComp::MakeLocationSummary() const {
347 return NULL;
348 }
349
350
351 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) {
352 UNIMPLEMENTED();
353 }
354
355
356 LocationSummary* CreateArrayComp::MakeLocationSummary() const {
357 return NULL;
358 }
359
360
361 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) {
362 UNIMPLEMENTED();
363 }
364
365
366 LocationSummary* CreateClosureComp::MakeLocationSummary() const {
367 return NULL;
368 }
369
370
371 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) {
372 UNIMPLEMENTED();
373 }
374
375
376 LocationSummary* AllocateObjectComp::MakeLocationSummary() const {
377 return NULL;
378 }
379
380
381 void AllocateObjectWithBoundsCheckComp::EmitNativeCode(
382 FlowGraphCompiler* compiler) {
383 UNIMPLEMENTED();
384 }
385
386
387 LocationSummary* AllocateObjectWithBoundsCheckComp::
388 MakeLocationSummary() const {
389 return NULL;
390 }
391
392
393 void NativeLoadFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
394 UNIMPLEMENTED();
395 }
396
397
398 LocationSummary* NativeLoadFieldComp::MakeLocationSummary() const {
399 return NULL;
400 }
401
402
403 void NativeStoreFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) {
404 UNIMPLEMENTED();
405 }
406
407
408 LocationSummary* NativeStoreFieldComp::MakeLocationSummary() const {
409 return NULL;
410 }
411
412
413 void InstantiateTypeArgumentsComp::EmitNativeCode(FlowGraphCompiler* compiler) {
414 UNIMPLEMENTED();
415 }
416
417
418 LocationSummary* InstantiateTypeArgumentsComp::MakeLocationSummary() const {
419 return NULL;
420 }
421
422
423 void ExtractConstructorTypeArgumentsComp::EmitNativeCode(
424 FlowGraphCompiler* compiler) {
425 UNIMPLEMENTED();
426 }
427
428
429 LocationSummary* ExtractConstructorTypeArgumentsComp::
430 MakeLocationSummary() const {
431 return NULL;
432 }
433
434
435 void ExtractConstructorInstantiatorComp::EmitNativeCode(
436 FlowGraphCompiler* compiler) {
437 UNIMPLEMENTED();
438 }
439
440
441 LocationSummary* ExtractConstructorInstantiatorComp::
442 MakeLocationSummary() const {
443 return NULL;
444 }
445
446
447 void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
448 UNIMPLEMENTED();
449 }
450
451
452 LocationSummary* AllocateContextComp::MakeLocationSummary() const {
453 return NULL;
454 }
455
456
457 void ChainContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
458 UNIMPLEMENTED();
459 }
460
461
462 LocationSummary* ChainContextComp::MakeLocationSummary() const {
463 return NULL;
464 }
465
466
467 void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
468 UNIMPLEMENTED();
469 }
470
471
472 LocationSummary* CloneContextComp::MakeLocationSummary() const {
473 return NULL;
474 }
475
476
477 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) {
478 UNIMPLEMENTED();
479 }
480
481
482 LocationSummary* CatchEntryComp::MakeLocationSummary() const {
483 return NULL;
484 }
485
486
211 } // namespace dart 487 } // namespace dart
212 488
213 #undef __ 489 #undef __
214 490
215 #endif // defined TARGET_ARCH_X64 491 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698