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

Side by Side Diff: vm/intermediate_language_x64.cc

Issue 10831176: Make CreateArrayComp a call by using explicit push-argument instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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
« vm/intermediate_language.h ('K') | « 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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 compiler->GenerateInstanceOf(cid(), 1030 compiler->GenerateInstanceOf(cid(),
1031 token_pos(), 1031 token_pos(),
1032 try_index(), 1032 try_index(),
1033 type(), 1033 type(),
1034 negate_result()); 1034 negate_result());
1035 ASSERT(locs()->out().reg() == RAX); 1035 ASSERT(locs()->out().reg() == RAX);
1036 } 1036 }
1037 1037
1038 1038
1039 LocationSummary* CreateArrayComp::MakeLocationSummary() const { 1039 LocationSummary* CreateArrayComp::MakeLocationSummary() const {
1040 // TODO(regis): The elements of the array could be considered as arguments to 1040 return MakeCallSummary();
1041 // CreateArrayComp, thereby making CreateArrayComp a call.
1042 // For VerifyCallComputation to work, CreateArrayComp would need an
1043 // ArgumentCount getter and an ArgumentAt getter.
1044 const intptr_t kNumInputs = 1;
1045 const intptr_t kNumTemps = 1;
1046 LocationSummary* locs =
1047 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1048 locs->set_in(0, Location::RegisterLocation(RBX));
1049 locs->set_temp(0, Location::RegisterLocation(R10));
1050 locs->set_out(Location::RegisterLocation(RAX));
1051 return locs;
1052 } 1041 }
1053 1042
1054 1043
1055 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { 1044 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1056 Register temp_reg = locs()->temp(0).reg(); 1045 // TODO(fschneider): Support call-instructions that take inputs in registers.
1057 Register result_reg = locs()->out().reg();
1058
1059 // Allocate the array. R10 = length, RBX = element type. 1046 // Allocate the array. R10 = length, RBX = element type.
1060 ASSERT(temp_reg == R10); 1047 __ popq(RBX);
1061 ASSERT(locs()->in(0).reg() == RBX); 1048 __ movq(R10, Immediate(Smi::RawValue(ElementCount())));
1062 __ movq(temp_reg, Immediate(Smi::RawValue(ElementCount())));
1063 compiler->GenerateCall(token_pos(), 1049 compiler->GenerateCall(token_pos(),
1064 try_index(), 1050 try_index(),
1065 &StubCode::AllocateArrayLabel(), 1051 &StubCode::AllocateArrayLabel(),
1066 PcDescriptors::kOther); 1052 PcDescriptors::kOther);
1067 ASSERT(result_reg == RAX); 1053 ASSERT(locs()->out().reg() == RAX);
1068 1054
1069 // Pop the element values from the stack into the array. 1055 // Pop the element values from the stack into the array.
1070 __ leaq(temp_reg, FieldAddress(result_reg, Array::data_offset())); 1056 __ leaq(R10, FieldAddress(RAX, Array::data_offset()));
1071 for (int i = ElementCount() - 1; i >= 0; --i) { 1057 for (int i = ElementCount() - 1; i >= 0; --i) {
1072 ASSERT(ElementAt(i)->IsUse()); 1058 ASSERT(ElementAt(i)->IsUse());
1073 __ popq(Address(temp_reg, i * kWordSize)); 1059 __ popq(Address(R10, i * kWordSize));
1074 } 1060 }
1075 } 1061 }
1076 1062
1077 1063
1078 LocationSummary* 1064 LocationSummary*
1079 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const { 1065 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const {
1080 const intptr_t kNumInputs = 2; 1066 const intptr_t kNumInputs = 2;
1081 const intptr_t kNumTemps = 0; 1067 const intptr_t kNumTemps = 0;
1082 LocationSummary* locs = 1068 LocationSummary* locs =
1083 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1069 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 ASSERT(locs()->out().reg() == RAX); 2103 ASSERT(locs()->out().reg() == RAX);
2118 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2104 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2119 EmitBranchOnCondition(compiler, branch_condition); 2105 EmitBranchOnCondition(compiler, branch_condition);
2120 } 2106 }
2121 2107
2122 } // namespace dart 2108 } // namespace dart
2123 2109
2124 #undef __ 2110 #undef __
2125 2111
2126 #endif // defined TARGET_ARCH_X64 2112 #endif // defined TARGET_ARCH_X64
OLDNEW
« vm/intermediate_language.h ('K') | « vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698