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

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

Issue 10448079: Address review comments in commited cl (issue 10460002). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/stub_code_ia32.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) 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 const intptr_t kNumTemps = 1; 584 const intptr_t kNumTemps = 1;
585 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); 585 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
586 locs->set_in(0, Location::RegisterLocation(RBX)); 586 locs->set_in(0, Location::RegisterLocation(RBX));
587 locs->set_temp(0, Location::RegisterLocation(R10)); 587 locs->set_temp(0, Location::RegisterLocation(R10));
588 locs->set_out(Location::RegisterLocation(RAX)); 588 locs->set_out(Location::RegisterLocation(RAX));
589 return locs; 589 return locs;
590 } 590 }
591 591
592 592
593 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { 593 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) {
594 ASSERT(locs()->in(0).reg() == RBX); 594 Register temp_reg = locs()->temp(0).reg();
595 ASSERT(locs()->temp(0).reg() == R10); 595 Register result_reg = locs()->out().reg();
596 596
597 // 1. Allocate the array. R10 = length, RBX = element type. 597 // 1. Allocate the array. R10 = length, RBX = element type.
598 __ movq(R10, Immediate(Smi::RawValue(ElementCount()))); 598 ASSERT(temp_reg == R10);
599 ASSERT(locs()->in(0).reg() == RBX);
600 __ movq(temp_reg, Immediate(Smi::RawValue(ElementCount())));
599 compiler->GenerateCall(token_index(), 601 compiler->GenerateCall(token_index(),
600 try_index(), 602 try_index(),
601 &StubCode::AllocateArrayLabel(), 603 &StubCode::AllocateArrayLabel(),
602 PcDescriptors::kOther); 604 PcDescriptors::kOther);
603 605
604 // 2. Initialize the array in RAX with the element values. 606 // 2. Initialize the array in result_reg with the element values.
605 __ leaq(R10, FieldAddress(RAX, Array::data_offset())); 607 __ leaq(temp_reg, FieldAddress(result_reg, Array::data_offset()));
606 for (int i = ElementCount() - 1; i >= 0; --i) { 608 for (int i = ElementCount() - 1; i >= 0; --i) {
607 if (ElementAt(i)->IsUse()) { 609 ASSERT(ElementAt(i)->IsUse());
608 __ popq(Address(R10, i * kWordSize)); 610 __ popq(Address(temp_reg, i * kWordSize));
609 } else {
610 compiler->LoadValue(RBX, ElementAt(i));
611 __ movq(Address(R10, i * kWordSize), RBX);
612 }
613 } 611 }
614 } 612 }
615 613
616 614
617 LocationSummary* CreateClosureComp::MakeLocationSummary() const { 615 LocationSummary* CreateClosureComp::MakeLocationSummary() const {
618 return MakeCallSummary(); 616 return MakeCallSummary();
619 } 617 }
620 618
621 619
622 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) { 620 void CreateClosureComp::EmitNativeCode(FlowGraphCompiler* compiler) {
623 const Function& closure_function = function(); 621 const Function& closure_function = function();
624 const Code& stub = Code::Handle( 622 const Code& stub = Code::Handle(
625 StubCode::GetAllocationStubForClosure(closure_function)); 623 StubCode::GetAllocationStubForClosure(closure_function));
626 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); 624 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
627 compiler->GenerateCall(token_index(), try_index(), &label, 625 compiler->GenerateCall(token_index(), try_index(), &label,
628 PcDescriptors::kOther); 626 PcDescriptors::kOther);
629 627 __ Drop(2); // Discard type arguments and receiver.
630 const Class& cls = Class::Handle(closure_function.signature_class());
631 if (cls.HasTypeArguments()) {
632 __ Drop(1); // Discard type arguments.
633 }
634 if (closure_function.IsImplicitInstanceClosureFunction()) {
635 __ Drop(1); // Discard receiver.
636 }
637 } 628 }
638 629
639 630
640 LocationSummary* AllocateObjectComp::MakeLocationSummary() const { 631 LocationSummary* AllocateObjectComp::MakeLocationSummary() const {
641 return MakeCallSummary(); 632 return MakeCallSummary();
642 } 633 }
643 634
644 635
645 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) { 636 void AllocateObjectComp::EmitNativeCode(FlowGraphCompiler* compiler) {
646 const Class& cls = Class::ZoneHandle(constructor().owner()); 637 const Class& cls = Class::ZoneHandle(constructor().owner());
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 if (locs()->out().reg() != RAX) { 1182 if (locs()->out().reg() != RAX) {
1192 __ movq(locs()->out().reg(), RAX); 1183 __ movq(locs()->out().reg(), RAX);
1193 } 1184 }
1194 } 1185 }
1195 1186
1196 } // namespace dart 1187 } // namespace dart
1197 1188
1198 #undef __ 1189 #undef __
1199 1190
1200 #endif // defined TARGET_ARCH_X64 1191 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698