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

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

Issue 10696151: Skeleton of a linear scan register allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 8 years, 5 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 14 matching lines...) Expand all
25 // on the stack and return the result in a fixed register EAX. 25 // on the stack and return the result in a fixed register EAX.
26 LocationSummary* Computation::MakeCallSummary() { 26 LocationSummary* Computation::MakeCallSummary() {
27 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); 27 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall);
28 result->set_out(Location::RegisterLocation(EAX)); 28 result->set_out(Location::RegisterLocation(EAX));
29 return result; 29 return result;
30 } 30 }
31 31
32 32
33 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 33 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
34 computation()->EmitNativeCode(compiler); 34 computation()->EmitNativeCode(compiler);
35 if (is_used() && locs()->out().kind() == Location::kRegister) { 35 if (is_used() && locs()->out().IsRegister()) {
36 // TODO(vegorov): this should really happen only for comparisons fused 36 // TODO(vegorov): this should really happen only for comparisons fused
37 // with branches. Currrently IR does not provide an easy way to remove 37 // with branches. Currrently IR does not provide an easy way to remove
38 // instructions from the graph so we just leave fused comparison in it 38 // instructions from the graph so we just leave fused comparison in it
39 // but change its result location to be NoLocation. 39 // but change its result location to be NoLocation.
40 compiler->frame_register_allocator()->Push(locs()->out().reg(), this); 40 compiler->frame_register_allocator()->Push(locs()->out().reg(), this);
41 } 41 }
42 } 42 }
43 43
44 44
45 LocationSummary* ReturnInstr::MakeLocationSummary() const { 45 LocationSummary* ReturnInstr::MakeLocationSummary() const {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 142
143 LocationSummary* ConstantVal::MakeLocationSummary() const { 143 LocationSummary* ConstantVal::MakeLocationSummary() const {
144 return LocationSummary::Make(0, Location::RequiresRegister()); 144 return LocationSummary::Make(0, Location::RequiresRegister());
145 } 145 }
146 146
147 147
148 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) { 148 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) {
149 Register result = locs()->out().reg(); 149 Register result = locs()->out().reg();
150 if (value().IsSmi()) { 150 __ LoadObject(result, value());
151 int32_t imm = reinterpret_cast<int32_t>(value().raw());
152 __ movl(result, Immediate(imm));
153 } else {
154 __ LoadObject(result, value());
155 }
156 } 151 }
157 152
158 153
159 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { 154 LocationSummary* AssertAssignableComp::MakeLocationSummary() const {
160 const intptr_t kNumInputs = 3; 155 const intptr_t kNumInputs = 3;
161 const intptr_t kNumTemps = 0; 156 const intptr_t kNumTemps = 0;
162 LocationSummary* summary = new LocationSummary(kNumInputs, 157 LocationSummary* summary = new LocationSummary(kNumInputs,
163 kNumTemps, 158 kNumTemps,
164 LocationSummary::kCall); 159 LocationSummary::kCall);
165 summary->set_in(0, Location::RegisterLocation(EAX)); // Value. 160 summary->set_in(0, Location::RegisterLocation(EAX)); // Value.
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 instance_call()->argument_names()); 1969 instance_call()->argument_names());
1975 } 1970 }
1976 __ Bind(&done); 1971 __ Bind(&done);
1977 } 1972 }
1978 1973
1979 } // namespace dart 1974 } // namespace dart
1980 1975
1981 #undef __ 1976 #undef __
1982 1977
1983 #endif // defined TARGET_ARCH_X64 1978 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698