| OLD | NEW |
| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 Value* CreateArrayComp::InputAt(intptr_t i) const { | 134 Value* CreateArrayComp::InputAt(intptr_t i) const { |
| 135 if (i == 0) { | 135 if (i == 0) { |
| 136 return element_type(); | 136 return element_type(); |
| 137 } else { | 137 } else { |
| 138 return ElementAt(i - 1); | 138 return ElementAt(i - 1); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 void CreateArrayComp::SetInputAt(intptr_t i, Value* value) { |
| 144 if (i == 0) { |
| 145 inputs_[0] = value; |
| 146 } else { |
| 147 (*elements_)[i - 1] = value; |
| 148 } |
| 149 } |
| 150 |
| 151 |
| 143 intptr_t BranchInstr::InputCount() const { | 152 intptr_t BranchInstr::InputCount() const { |
| 144 return 1; | 153 return 1; |
| 145 } | 154 } |
| 146 | 155 |
| 147 | 156 |
| 148 Value* BranchInstr::InputAt(intptr_t i) const { | 157 Value* BranchInstr::InputAt(intptr_t i) const { |
| 149 if (i == 0) return value(); | 158 if (i == 0) return value(); |
| 150 UNREACHABLE(); | 159 UNREACHABLE(); |
| 151 return NULL; | 160 return NULL; |
| 152 } | 161 } |
| 153 | 162 |
| 154 | 163 |
| 164 void BranchInstr::SetInputAt(intptr_t i, Value* value) { |
| 165 if (i == 0) { |
| 166 value_ = value; |
| 167 return; |
| 168 } |
| 169 UNREACHABLE(); |
| 170 } |
| 171 |
| 172 |
| 155 intptr_t ReThrowInstr::InputCount() const { | 173 intptr_t ReThrowInstr::InputCount() const { |
| 156 return 2; | 174 return 2; |
| 157 } | 175 } |
| 158 | 176 |
| 159 | 177 |
| 160 Value* ReThrowInstr::InputAt(intptr_t i) const { | 178 Value* ReThrowInstr::InputAt(intptr_t i) const { |
| 161 if (i == 0) return exception(); | 179 if (i == 0) return exception(); |
| 162 if (i == 1) return stack_trace(); | 180 if (i == 1) return stack_trace(); |
| 163 UNREACHABLE(); | 181 UNREACHABLE(); |
| 164 return NULL; | 182 return NULL; |
| 165 } | 183 } |
| 166 | 184 |
| 167 | 185 |
| 186 void ReThrowInstr::SetInputAt(intptr_t i, Value* value) { |
| 187 if (i == 0) { |
| 188 exception_ = value; |
| 189 return; |
| 190 } |
| 191 if (i == 1) { |
| 192 stack_trace_ = value; |
| 193 return; |
| 194 } |
| 195 UNREACHABLE(); |
| 196 } |
| 197 |
| 198 |
| 168 intptr_t ThrowInstr::InputCount() const { | 199 intptr_t ThrowInstr::InputCount() const { |
| 169 return 1; | 200 return 1; |
| 170 } | 201 } |
| 171 | 202 |
| 172 | 203 |
| 173 Value* ThrowInstr::InputAt(intptr_t i) const { | 204 Value* ThrowInstr::InputAt(intptr_t i) const { |
| 174 if (i == 0) return exception(); | 205 if (i == 0) return exception(); |
| 175 UNREACHABLE(); | 206 UNREACHABLE(); |
| 176 return NULL; | 207 return NULL; |
| 177 } | 208 } |
| 178 | 209 |
| 179 | 210 |
| 211 void ThrowInstr::SetInputAt(intptr_t i, Value* value) { |
| 212 if (i == 0) { |
| 213 exception_ = value; |
| 214 return; |
| 215 } |
| 216 UNREACHABLE(); |
| 217 } |
| 218 |
| 219 |
| 180 intptr_t ReturnInstr::InputCount() const { | 220 intptr_t ReturnInstr::InputCount() const { |
| 181 return 1; | 221 return 1; |
| 182 } | 222 } |
| 183 | 223 |
| 184 | 224 |
| 185 Value* ReturnInstr::InputAt(intptr_t i) const { | 225 Value* ReturnInstr::InputAt(intptr_t i) const { |
| 186 if (i == 0) return value(); | 226 if (i == 0) return value(); |
| 187 UNREACHABLE(); | 227 UNREACHABLE(); |
| 188 return NULL; | 228 return NULL; |
| 189 } | 229 } |
| 190 | 230 |
| 191 | 231 |
| 232 void ReturnInstr::SetInputAt(intptr_t i, Value* value) { |
| 233 if (i == 0) { |
| 234 value_ = value; |
| 235 return; |
| 236 } |
| 237 UNREACHABLE(); |
| 238 } |
| 239 |
| 240 |
| 192 intptr_t BindInstr::InputCount() const { | 241 intptr_t BindInstr::InputCount() const { |
| 193 return computation()->InputCount(); | 242 return computation()->InputCount(); |
| 194 } | 243 } |
| 195 | 244 |
| 196 | 245 |
| 197 Value* BindInstr::InputAt(intptr_t i) const { | 246 Value* BindInstr::InputAt(intptr_t i) const { |
| 198 return computation()->InputAt(i); | 247 return computation()->InputAt(i); |
| 199 } | 248 } |
| 200 | 249 |
| 201 | 250 |
| 251 void BindInstr::SetInputAt(intptr_t i, Value* value) { |
| 252 computation()->SetInputAt(i, value); |
| 253 } |
| 254 |
| 255 |
| 202 intptr_t PhiInstr::InputCount() const { | 256 intptr_t PhiInstr::InputCount() const { |
| 203 return inputs_.length(); | 257 return inputs_.length(); |
| 204 } | 258 } |
| 205 | 259 |
| 206 | 260 |
| 207 Value* PhiInstr::InputAt(intptr_t i) const { | 261 Value* PhiInstr::InputAt(intptr_t i) const { |
| 208 return inputs_[i]; | 262 return inputs_[i]; |
| 209 } | 263 } |
| 210 | 264 |
| 211 | 265 |
| 266 void PhiInstr::SetInputAt(intptr_t i, Value* value) { |
| 267 inputs_[i] = value; |
| 268 } |
| 269 |
| 270 |
| 212 intptr_t DoInstr::InputCount() const { | 271 intptr_t DoInstr::InputCount() const { |
| 213 return computation()->InputCount(); | 272 return computation()->InputCount(); |
| 214 } | 273 } |
| 215 | 274 |
| 216 | 275 |
| 217 Value* DoInstr::InputAt(intptr_t i) const { | 276 Value* DoInstr::InputAt(intptr_t i) const { |
| 218 return computation()->InputAt(i); | 277 return computation()->InputAt(i); |
| 219 } | 278 } |
| 220 | 279 |
| 221 | 280 |
| 281 void DoInstr::SetInputAt(intptr_t i, Value* value) { |
| 282 computation()->SetInputAt(i, value); |
| 283 } |
| 284 |
| 285 |
| 222 intptr_t GraphEntryInstr::InputCount() const { | 286 intptr_t GraphEntryInstr::InputCount() const { |
| 223 return 0; | 287 return 0; |
| 224 } | 288 } |
| 225 | 289 |
| 226 | 290 |
| 227 Value* GraphEntryInstr::InputAt(intptr_t i) const { | 291 Value* GraphEntryInstr::InputAt(intptr_t i) const { |
| 228 UNREACHABLE(); | 292 UNREACHABLE(); |
| 229 return NULL; | 293 return NULL; |
| 230 } | 294 } |
| 231 | 295 |
| 232 | 296 |
| 297 void GraphEntryInstr::SetInputAt(intptr_t i, Value* value) { |
| 298 UNREACHABLE(); |
| 299 } |
| 300 |
| 301 |
| 233 intptr_t TargetEntryInstr::InputCount() const { | 302 intptr_t TargetEntryInstr::InputCount() const { |
| 234 return 0; | 303 return 0; |
| 235 } | 304 } |
| 236 | 305 |
| 237 | 306 |
| 238 Value* TargetEntryInstr::InputAt(intptr_t i) const { | 307 Value* TargetEntryInstr::InputAt(intptr_t i) const { |
| 239 UNREACHABLE(); | 308 UNREACHABLE(); |
| 240 return NULL; | 309 return NULL; |
| 241 } | 310 } |
| 242 | 311 |
| 243 | 312 |
| 313 void TargetEntryInstr::SetInputAt(intptr_t i, Value* value) { |
| 314 UNREACHABLE(); |
| 315 } |
| 316 |
| 317 |
| 244 intptr_t JoinEntryInstr::InputCount() const { | 318 intptr_t JoinEntryInstr::InputCount() const { |
| 245 return 0; | 319 return 0; |
| 246 } | 320 } |
| 247 | 321 |
| 248 | 322 |
| 249 Value* JoinEntryInstr::InputAt(intptr_t i) const { | 323 Value* JoinEntryInstr::InputAt(intptr_t i) const { |
| 250 UNREACHABLE(); | 324 UNREACHABLE(); |
| 251 return NULL; | 325 return NULL; |
| 252 } | 326 } |
| 253 | 327 |
| 254 | 328 |
| 329 void JoinEntryInstr::SetInputAt(intptr_t i, Value* value) { |
| 330 UNREACHABLE(); |
| 331 } |
| 332 |
| 333 |
| 255 // ==== Recording assigned variables. | 334 // ==== Recording assigned variables. |
| 256 void Computation::RecordAssignedVars(BitVector* assigned_vars) { | 335 void Computation::RecordAssignedVars(BitVector* assigned_vars) { |
| 257 // Nothing to do for the base class. | 336 // Nothing to do for the base class. |
| 258 } | 337 } |
| 259 | 338 |
| 260 | 339 |
| 261 void StoreLocalComp::RecordAssignedVars(BitVector* assigned_vars) { | 340 void StoreLocalComp::RecordAssignedVars(BitVector* assigned_vars) { |
| 262 if (!local().is_captured()) { | 341 if (!local().is_captured()) { |
| 263 assigned_vars->Add(local().BitIndexIn(assigned_vars->length())); | 342 assigned_vars->Add(local().BitIndexIn(assigned_vars->length())); |
| 264 } | 343 } |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1267 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1189 compiler->GenerateCall(token_index(), try_index(), &label, | 1268 compiler->GenerateCall(token_index(), try_index(), &label, |
| 1190 PcDescriptors::kOther); | 1269 PcDescriptors::kOther); |
| 1191 __ Drop(2); // Discard type arguments and receiver. | 1270 __ Drop(2); // Discard type arguments and receiver. |
| 1192 } | 1271 } |
| 1193 | 1272 |
| 1194 | 1273 |
| 1195 #undef __ | 1274 #undef __ |
| 1196 | 1275 |
| 1197 } // namespace dart | 1276 } // namespace dart |
| OLD | NEW |