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

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

Issue 504143003: Support Int32 representation for selected binary operations. (Closed) Base URL: https://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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 PairLocation* Location::AsPairLocation() const { 65 PairLocation* Location::AsPairLocation() const {
66 ASSERT(IsPairLocation()); 66 ASSERT(IsPairLocation());
67 return reinterpret_cast<PairLocation*>(value_ & ~kLocationTagMask); 67 return reinterpret_cast<PairLocation*>(value_ & ~kLocationTagMask);
68 } 68 }
69 69
70 70
71 Location Location::RegisterOrConstant(Value* value) { 71 Location Location::RegisterOrConstant(Value* value) {
72 ConstantInstr* constant = value->definition()->AsConstant(); 72 ConstantInstr* constant = value->definition()->AsConstant();
73 return ((constant != NULL) && Assembler::IsSafe(constant->value())) 73 return ((constant != NULL) && Assembler::IsSafe(constant->value()))
74 ? Location::Constant(constant->value()) 74 ? Location::Constant(constant)
75 : Location::RequiresRegister(); 75 : Location::RequiresRegister();
76 } 76 }
77 77
78 78
79 Location Location::RegisterOrSmiConstant(Value* value) { 79 Location Location::RegisterOrSmiConstant(Value* value) {
80 ConstantInstr* constant = value->definition()->AsConstant(); 80 ConstantInstr* constant = value->definition()->AsConstant();
81 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) 81 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value()))
82 ? Location::Constant(constant->value()) 82 ? Location::Constant(constant)
83 : Location::RequiresRegister(); 83 : Location::RequiresRegister();
84 } 84 }
85 85
86 86
87 Location Location::WritableRegisterOrSmiConstant(Value* value) { 87 Location Location::WritableRegisterOrSmiConstant(Value* value) {
88 ConstantInstr* constant = value->definition()->AsConstant(); 88 ConstantInstr* constant = value->definition()->AsConstant();
89 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) 89 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value()))
90 ? Location::Constant(constant->value()) 90 ? Location::Constant(constant)
91 : Location::WritableRegister(); 91 : Location::WritableRegister();
92 } 92 }
93 93
94 94
95 Location Location::FixedRegisterOrConstant(Value* value, Register reg) { 95 Location Location::FixedRegisterOrConstant(Value* value, Register reg) {
96 ConstantInstr* constant = value->definition()->AsConstant(); 96 ConstantInstr* constant = value->definition()->AsConstant();
97 return ((constant != NULL) && Assembler::IsSafe(constant->value())) 97 return ((constant != NULL) && Assembler::IsSafe(constant->value()))
98 ? Location::Constant(constant->value()) 98 ? Location::Constant(constant)
99 : Location::RegisterLocation(reg); 99 : Location::RegisterLocation(reg);
100 } 100 }
101 101
102 102
103 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) { 103 Location Location::FixedRegisterOrSmiConstant(Value* value, Register reg) {
104 ConstantInstr* constant = value->definition()->AsConstant(); 104 ConstantInstr* constant = value->definition()->AsConstant();
105 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value())) 105 return ((constant != NULL) && Assembler::IsSafeSmi(constant->value()))
106 ? Location::Constant(constant->value()) 106 ? Location::Constant(constant)
107 : Location::RegisterLocation(reg); 107 : Location::RegisterLocation(reg);
108 } 108 }
109 109
110 110
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->value()) 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 if (index < 0) {
122 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; 122 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize;
123 return Address(FPREG, offset); 123 return Address(FPREG, offset);
124 } else { 124 } else {
125 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; 125 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize;
126 return Address(FPREG, offset); 126 return Address(FPREG, offset);
127 } 127 }
128 } 128 }
129 129
130 130
131 intptr_t Location::ToStackSlotOffset() const { 131 intptr_t Location::ToStackSlotOffset() const {
132 const intptr_t index = stack_index(); 132 const intptr_t index = stack_index();
133 if (index < 0) { 133 if (index < 0) {
134 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize; 134 const intptr_t offset = (kParamEndSlotFromFp - index) * kWordSize;
135 return offset; 135 return offset;
136 } else { 136 } else {
137 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize; 137 const intptr_t offset = (kFirstLocalSlotFromFp - index) * kWordSize;
138 return offset; 138 return offset;
139 } 139 }
140 } 140 }
141 141
142 142
143 const Object& Location::constant() const {
144 return constant_instruction()->value();
145 }
146
147
143 const char* Location::Name() const { 148 const char* Location::Name() const {
144 switch (kind()) { 149 switch (kind()) {
145 case kInvalid: return "?"; 150 case kInvalid: return "?";
146 case kRegister: return Assembler::RegisterName(reg()); 151 case kRegister: return Assembler::RegisterName(reg());
147 case kFpuRegister: return Assembler::FpuRegisterName(fpu_reg()); 152 case kFpuRegister: return Assembler::FpuRegisterName(fpu_reg());
148 case kStackSlot: return "S"; 153 case kStackSlot: return "S";
149 case kDoubleStackSlot: return "DS"; 154 case kDoubleStackSlot: return "DS";
150 case kQuadStackSlot: return "QS"; 155 case kQuadStackSlot: return "QS";
151 case kUnallocated: 156 case kUnallocated:
152 switch (policy()) { 157 switch (policy()) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 251
247 if (!out(0).IsInvalid()) { 252 if (!out(0).IsInvalid()) {
248 f->Print(" => "); 253 f->Print(" => ");
249 out(0).PrintTo(f); 254 out(0).PrintTo(f);
250 } 255 }
251 256
252 if (always_calls()) f->Print(" C"); 257 if (always_calls()) f->Print(" C");
253 } 258 }
254 259
255 } // namespace dart 260 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698