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

Side by Side Diff: vm/intermediate_language_x64.cc

Issue 10456012: Change three more instructions on x64 to use location-based codegen templates. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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/flow_graph_compiler_x64.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 "lib/error.h" 8 #include "lib/error.h"
9 #include "vm/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
10 #include "vm/locations.h" 10 #include "vm/locations.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 __ movq(R10, Immediate(argument_count())); 368 __ movq(R10, Immediate(argument_count()));
369 compiler->GenerateCall(token_index(), 369 compiler->GenerateCall(token_index(),
370 try_index(), 370 try_index(),
371 &StubCode::CallNativeCFunctionLabel(), 371 &StubCode::CallNativeCFunctionLabel(),
372 PcDescriptors::kOther); 372 PcDescriptors::kOther);
373 __ popq(RAX); 373 __ popq(RAX);
374 } 374 }
375 375
376 376
377 LocationSummary* StoreIndexedComp::MakeLocationSummary() const { 377 LocationSummary* StoreIndexedComp::MakeLocationSummary() const {
378 return NULL; 378 const intptr_t kNumInputs = 3;
379 return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister());
379 } 380 }
380 381
381 382
382 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { 383 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
383 UNIMPLEMENTED(); 384 Register receiver = locs()->in(0).reg();
Vyacheslav Egorov (Google) 2012/05/29 10:29:09 please add TODO to mark these instructions as doin
385 Register index = locs()->in(1).reg();
386 Register value = locs()->in(2).reg();
387 Register result = locs()->out().reg();
srdjan 2012/05/29 15:04:03 We can simplify the code by using (if needed) the
388
389 // Call operator []= but preserve the third argument value under the
390 // arguments as the result of the computation.
391 const String& function_name =
392 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX)));
393
394 // Insert a copy of the value (third argument) under the arguments.
395 __ pushq(value);
396 __ pushq(receiver);
397 __ pushq(index);
398 __ pushq(value);
399 compiler->EmitInstanceCall(cid(),
400 token_index(),
401 try_index(),
402 function_name,
403 3,
404 Array::ZoneHandle(),
405 1);
406 __ popq(result);
384 } 407 }
385 408
386 409
387 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { 410 LocationSummary* InstanceSetterComp::MakeLocationSummary() const {
411 const intptr_t kNumInputs = 2;
412 return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister());
388 return NULL; 413 return NULL;
389 } 414 }
390 415
391 416
392 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { 417 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
393 UNIMPLEMENTED(); 418 Register receiver = locs()->in(0).reg();
419 Register value = locs()->in(1).reg();
420 Register result = locs()->out().reg();
421
422 // Preserve the value (second argument) under the arguments as the result
423 // of the computation, then call the setter.
424 const String& function_name =
425 String::ZoneHandle(Field::SetterSymbol(field_name()));
426
427 // Insert a copy of the second (last) argument under the arguments.
428 __ pushq(value);
429 __ pushq(receiver);
430 __ pushq(value);
431 compiler->EmitInstanceCall(cid(),
432 token_index(),
433 try_index(),
434 function_name,
435 2,
436 Array::ZoneHandle(),
437 1);
438 __ popq(result);
394 } 439 }
395 440
396 441
397 LocationSummary* StaticSetterComp::MakeLocationSummary() const { 442 LocationSummary* StaticSetterComp::MakeLocationSummary() const {
398 return NULL; 443 const intptr_t kNumInputs = 1;
444 return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister());
399 } 445 }
400 446
401 447
402 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { 448 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
403 UNIMPLEMENTED(); 449 Register value = locs()->in(0).reg();
450 Register result = locs()->out().reg();
451
452 // Preserve the argument as the result of the computation,
453 // then call the setter.
454
455 // Duplicate the argument.
456 __ pushq(value);
457 __ pushq(value);
458 compiler->EmitStaticCall(token_index(),
459 try_index(),
460 setter_function(),
461 1,
462 Array::ZoneHandle());
463 __ popq(result);
404 } 464 }
405 465
406 466
407 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { 467 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const {
408 // TODO(fschneider): For this instruction the input register may be 468 // TODO(fschneider): For this instruction the input register may be
409 // reused for the result (but is not required to) because the input 469 // reused for the result (but is not required to) because the input
410 // is not used after the result is defined. We should consider adding 470 // is not used after the result is defined. We should consider adding
411 // this information to the input policy. 471 // this information to the input policy.
412 return MakeSimpleLocationSummary(1, Location::RequiresRegister()); 472 return MakeSimpleLocationSummary(1, Location::RequiresRegister());
413 } 473 }
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 if (locs()->out().reg() != RAX) { 962 if (locs()->out().reg() != RAX) {
903 __ movq(locs()->out().reg(), RAX); 963 __ movq(locs()->out().reg(), RAX);
904 } 964 }
905 } 965 }
906 966
907 } // namespace dart 967 } // namespace dart
908 968
909 #undef __ 969 #undef __
910 970
911 #endif // defined TARGET_ARCH_X64 971 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698