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

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

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/locations.h" 5 #include "vm/locations.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/il_printer.h" 8 #include "vm/il_printer.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 Location Location::AnyOrConstant(Value* value) { 111 Location Location::AnyOrConstant(Value* value) {
112 ConstantInstr* constant = value->definition()->AsConstant(); 112 ConstantInstr* constant = value->definition()->AsConstant();
113 return ((constant != NULL) && Assembler::IsSafe(constant->value())) 113 return ((constant != NULL) && Assembler::IsSafe(constant->value()))
114 ? Location::Constant(constant) 114 ? Location::Constant(constant)
115 : Location::Any(); 115 : Location::Any();
116 } 116 }
117 117
118 118
119 Address Location::ToStackSlotAddress() const { 119 Address Location::ToStackSlotAddress() const {
120 const intptr_t index = stack_index(); 120 const intptr_t index = stack_index();
121 if (index < 0) { 121 const Register base = base_reg();
122 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; 122 if (base == FPREG) {
123 return Address(FPREG, offset); 123 if (index < 0) {
124 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize;
125 return Address(base, offset);
126 } else {
127 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize;
128 return Address(base, offset);
129 }
124 } else { 130 } else {
125 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; 131 ASSERT(base == SPREG);
126 return Address(FPREG, offset); 132 return Address(base, index * kWordSize);
127 } 133 }
128 } 134 }
129 135
130 136
131 intptr_t Location::ToStackSlotOffset() const { 137 intptr_t Location::ToStackSlotOffset() const {
132 const intptr_t index = stack_index(); 138 const intptr_t index = stack_index();
133 if (index < 0) { 139 if (base_reg() == FPREG) {
134 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; 140 if (index < 0) {
135 return offset; 141 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize;
142 return offset;
143 } else {
144 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize;
145 return offset;
146 }
136 } else { 147 } else {
137 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; 148 ASSERT(base_reg() == SPREG);
138 return offset; 149 return index * kWordSize;
139 } 150 }
140 } 151 }
141 152
142 153
143 const Object& Location::constant() const { 154 const Object& Location::constant() const {
144 return constant_instruction()->value(); 155 return constant_instruction()->value();
145 } 156 }
146 157
147 158
148 const char* Location::Name() const { 159 const char* Location::Name() const {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 262
252 if (!out(0).IsInvalid()) { 263 if (!out(0).IsInvalid()) {
253 f->Print(" => "); 264 f->Print(" => ");
254 out(0).PrintTo(f); 265 out(0).PrintTo(f);
255 } 266 }
256 267
257 if (always_calls()) f->Print(" C"); 268 if (always_calls()) f->Print(" C");
258 } 269 }
259 270
260 } // namespace dart 271 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698