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

Side by Side Diff: vm/intermediate_language_ia32.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
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_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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 compiler->GenerateInstanceOf(cid(), 1016 compiler->GenerateInstanceOf(cid(),
1017 token_pos(), 1017 token_pos(),
1018 try_index(), 1018 try_index(),
1019 type(), 1019 type(),
1020 negate_result()); 1020 negate_result());
1021 ASSERT(locs()->out().reg() == EAX); 1021 ASSERT(locs()->out().reg() == EAX);
1022 } 1022 }
1023 1023
1024 1024
1025 LocationSummary* CreateArrayComp::MakeLocationSummary() const { 1025 LocationSummary* CreateArrayComp::MakeLocationSummary() const {
1026 // TODO(regis): The elements of the array could be considered as arguments to 1026 return MakeCallSummary();
1027 // CreateArrayComp, thereby making CreateArrayComp a call.
1028 // For VerifyCallComputation to work, CreateArrayComp would need an
1029 // ArgumentCount getter and an ArgumentAt getter.
1030 const intptr_t kNumInputs = 1;
1031 const intptr_t kNumTemps = 1;
1032 LocationSummary* locs =
1033 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1034 locs->set_in(0, Location::RegisterLocation(ECX));
1035 locs->set_temp(0, Location::RegisterLocation(EDX));
1036 locs->set_out(Location::RegisterLocation(EAX));
1037 return locs;
1038 } 1027 }
1039 1028
1040 1029
1041 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { 1030 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1042 Register temp_reg = locs()->temp(0).reg(); 1031 // TODO(fschneider): Support call-instructions that take inputs in registers.
1043 Register result_reg = locs()->out().reg();
1044
1045 // Allocate the array. EDX = length, ECX = element type. 1032 // Allocate the array. EDX = length, ECX = element type.
1046 ASSERT(temp_reg == EDX); 1033 __ popl(ECX);
1047 ASSERT(locs()->in(0).reg() == ECX); 1034 __ movl(EDX, Immediate(Smi::RawValue(ElementCount())));
1048 __ movl(temp_reg, Immediate(Smi::RawValue(ElementCount())));
1049 compiler->GenerateCall(token_pos(), 1035 compiler->GenerateCall(token_pos(),
1050 try_index(), 1036 try_index(),
1051 &StubCode::AllocateArrayLabel(), 1037 &StubCode::AllocateArrayLabel(),
1052 PcDescriptors::kOther); 1038 PcDescriptors::kOther);
1053 ASSERT(result_reg == EAX); 1039 ASSERT(locs()->out().reg() == EAX);
1054 1040
1055 // Pop the element values from the stack into the array. 1041 // Pop the element values from the stack into the array.
1056 __ leal(temp_reg, FieldAddress(result_reg, Array::data_offset())); 1042 __ leal(EDX, FieldAddress(EAX, Array::data_offset()));
1057 for (int i = ElementCount() - 1; i >= 0; --i) { 1043 for (int i = ElementCount() - 1; i >= 0; --i) {
1058 ASSERT(ElementAt(i)->IsUse()); 1044 ASSERT(ElementAt(i)->IsUse());
1059 __ popl(Address(temp_reg, i * kWordSize)); 1045 __ popl(Address(EDX, i * kWordSize));
1060 } 1046 }
1061 } 1047 }
1062 1048
1063 1049
1064 LocationSummary* 1050 LocationSummary*
1065 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const { 1051 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const {
1066 const intptr_t kNumInputs = 2; 1052 const intptr_t kNumInputs = 2;
1067 const intptr_t kNumTemps = 0; 1053 const intptr_t kNumTemps = 0;
1068 LocationSummary* locs = 1054 LocationSummary* locs =
1069 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1055 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 ASSERT(locs()->out().reg() == EAX); 2096 ASSERT(locs()->out().reg() == EAX);
2111 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2097 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2112 EmitBranchOnCondition(compiler, branch_condition); 2098 EmitBranchOnCondition(compiler, branch_condition);
2113 } 2099 }
2114 2100
2115 } // namespace dart 2101 } // namespace dart
2116 2102
2117 #undef __ 2103 #undef __
2118 2104
2119 #endif // defined TARGET_ARCH_X64 2105 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698