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

Side by Side Diff: lib/compiler/implementation/ssa/bailout.dart

Issue 10098001: Refactor type propagation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and add new test. Created 8 years, 8 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
« no previous file with comments | « frog/tests/leg/src/TypeInferenceTest.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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 return instruction.type.isKnown() && !instruction.hasExpectedType(); 279 HType propagatedType = instruction.propagatedType;
280 return propagatedType.isUseful()
281 && propagatedType != instruction.computeTypeFromInputTypes();
280 } 282 }
281 283
282 void insertCapturedEnvironments() { 284 void insertCapturedEnvironments() {
283 work.guards = <HTypeGuard>[]; 285 work.guards = <HTypeGuard>[];
284 int state = 1; 286 int state = 1;
285 capturedEnvironments.forEach((HInstruction instruction, Environment env) { 287 capturedEnvironments.forEach((HInstruction instruction, Environment env) {
286 List<HInstruction> inputs = env.buildAndSetLast(instruction); 288 List<HInstruction> inputs = env.buildAndSetLast(instruction);
287 HTypeGuard guard = new HTypeGuard(state++, inputs); 289 HTypeGuard guard = new HTypeGuard(state++, inputs);
288 work.guards.add(guard); 290 work.guards.add(guard);
289 instruction.block.rewrite(instruction, guard); 291 instruction.block.rewrite(instruction, guard);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 compiler.internalError('Control flow instructions already dealt with.', 361 compiler.internalError('Control flow instructions already dealt with.',
360 instruction: instruction); 362 instruction: instruction);
361 } 363 }
362 364
363 visitTypeGuard(HTypeGuard guard) { 365 visitTypeGuard(HTypeGuard guard) {
364 blocks.forEach((HBasicBlock block) { 366 blocks.forEach((HBasicBlock block) {
365 block.guards.add(guard); 367 block.guards.add(guard);
366 }); 368 });
367 } 369 }
368 } 370 }
OLDNEW
« no previous file with comments | « frog/tests/leg/src/TypeInferenceTest.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698