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 class BailoutInfo { | 5 class BailoutInfo { |
6 int instructionId; | 6 int instructionId; |
7 int bailoutId; | 7 int bailoutId; |
8 BailoutInfo(this.instructionId, this.bailoutId); | 8 BailoutInfo(this.instructionId, this.bailoutId); |
9 } | 9 } |
10 | 10 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 environment.clear(); | 269 environment.clear(); |
270 visitInstruction(instruction); | 270 visitInstruction(instruction); |
271 } | 271 } |
272 | 272 |
273 void visitControlFlow(HControlFlow instruction) { | 273 void visitControlFlow(HControlFlow instruction) { |
274 compiler.internalError('Control flow instructions already dealt with.', | 274 compiler.internalError('Control flow instructions already dealt with.', |
275 instruction: instruction); | 275 instruction: instruction); |
276 } | 276 } |
277 | 277 |
278 bool shouldCaptureEnvironment(HInstruction instruction) { | 278 bool shouldCaptureEnvironment(HInstruction instruction) { |
279 HType propagatedType = instruction.propagatedType; | 279 return instruction.type.isKnown() && !instruction.hasExpectedType(); |
280 return propagatedType.isUseful() | |
281 && propagatedType != instruction.computeTypeFromInputTypes(); | |
282 } | 280 } |
283 | 281 |
284 void insertCapturedEnvironments() { | 282 void insertCapturedEnvironments() { |
285 work.guards = <HTypeGuard>[]; | 283 work.guards = <HTypeGuard>[]; |
286 int state = 1; | 284 int state = 1; |
287 capturedEnvironments.forEach((HInstruction instruction, Environment env) { | 285 capturedEnvironments.forEach((HInstruction instruction, Environment env) { |
288 List<HInstruction> inputs = env.buildAndSetLast(instruction); | 286 List<HInstruction> inputs = env.buildAndSetLast(instruction); |
289 HTypeGuard guard = new HTypeGuard(state++, inputs); | 287 HTypeGuard guard = new HTypeGuard(state++, inputs); |
290 work.guards.add(guard); | 288 work.guards.add(guard); |
291 instruction.block.rewrite(instruction, guard); | 289 instruction.block.rewrite(instruction, guard); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 compiler.internalError('Control flow instructions already dealt with.', | 359 compiler.internalError('Control flow instructions already dealt with.', |
362 instruction: instruction); | 360 instruction: instruction); |
363 } | 361 } |
364 | 362 |
365 visitTypeGuard(HTypeGuard guard) { | 363 visitTypeGuard(HTypeGuard guard) { |
366 blocks.forEach((HBasicBlock block) { | 364 blocks.forEach((HBasicBlock block) { |
367 block.guards.add(guard); | 365 block.guards.add(guard); |
368 }); | 366 }); |
369 } | 367 } |
370 } | 368 } |
OLD | NEW |