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

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

Issue 266633007: Merge ConstantInstr -> UnboxDouble to UnboxedConstant. Reduces register usage and allows for variou… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 140 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
141 // The register allocator drops constant definitions that have no uses. 141 // The register allocator drops constant definitions that have no uses.
142 if (!locs()->out(0).IsInvalid()) { 142 if (!locs()->out(0).IsInvalid()) {
143 Register result = locs()->out(0).reg(); 143 Register result = locs()->out(0).reg();
144 __ LoadObjectSafely(result, value()); 144 __ LoadObjectSafely(result, value());
145 } 145 }
146 } 146 }
147 147
148 148
149 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(bool opt) const {
150 const intptr_t kNumInputs = 0;
151 const intptr_t kNumTemps = (constant_address() == 0) ? 1 : 0;
152 LocationSummary* locs =
153 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
154 locs->set_out(0, Location::RequiresFpuRegister());
155 if (kNumTemps == 1) {
156 locs->set_temp(0, Location::RequiresRegister());
157 }
158 return locs;
159 }
160
161
162 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
163 // The register allocator drops constant definitions that have no uses.
164 if (!locs()->out(0).IsInvalid()) {
165 if (constant_address() == 0) {
166 Register boxed = locs()->temp(0).reg();
167 XmmRegister result = locs()->out(0).fpu_reg();
168 __ LoadObjectSafely(boxed, value());
169 __ movsd(result, FieldAddress(boxed, Double::value_offset()));
170 } else {
171 XmmRegister result = locs()->out(0).fpu_reg();
172 __ movsd(result, Address::Absolute(constant_address()));
173 }
174 }
175 }
176
177
149 LocationSummary* AssertAssignableInstr::MakeLocationSummary(bool opt) const { 178 LocationSummary* AssertAssignableInstr::MakeLocationSummary(bool opt) const {
150 const intptr_t kNumInputs = 3; 179 const intptr_t kNumInputs = 3;
151 const intptr_t kNumTemps = 0; 180 const intptr_t kNumTemps = 0;
152 LocationSummary* summary = 181 LocationSummary* summary =
153 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 182 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
154 summary->set_in(0, Location::RegisterLocation(EAX)); // Value. 183 summary->set_in(0, Location::RegisterLocation(EAX)); // Value.
155 summary->set_in(1, Location::RegisterLocation(ECX)); // Instantiator. 184 summary->set_in(1, Location::RegisterLocation(ECX)); // Instantiator.
156 summary->set_in(2, Location::RegisterLocation(EDX)); // Type arguments. 185 summary->set_in(2, Location::RegisterLocation(EDX)); // Type arguments.
157 summary->set_out(0, Location::RegisterLocation(EAX)); 186 summary->set_out(0, Location::RegisterLocation(EAX));
158 return summary; 187 return summary;
(...skipping 5823 matching lines...) Expand 10 before | Expand all | Expand 10 after
5982 PcDescriptors::kOther, 6011 PcDescriptors::kOther,
5983 locs()); 6012 locs());
5984 __ Drop(ArgumentCount()); // Discard arguments. 6013 __ Drop(ArgumentCount()); // Discard arguments.
5985 } 6014 }
5986 6015
5987 } // namespace dart 6016 } // namespace dart
5988 6017
5989 #undef __ 6018 #undef __
5990 6019
5991 #endif // defined TARGET_ARCH_IA32 6020 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698