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

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

Issue 10442110: Fully unwrap a HCheck instruction to a real non-checked instruction. In case the check does not hav… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 6 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 | « no previous file | no next file » | 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 SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 final JavaScriptBackend backend; 6 final JavaScriptBackend backend;
7 SsaCodeGeneratorTask(JavaScriptBackend backend) 7 SsaCodeGeneratorTask(JavaScriptBackend backend)
8 : this.backend = backend, 8 : this.backend = backend,
9 super(backend.compiler); 9 super(backend.compiler);
10 String get name() => 'SSA code generator'; 10 String get name() => 'SSA code generator';
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 if (!graph.entry.hasGuards()) return; 2280 if (!graph.entry.hasGuards()) return;
2281 indent--; // Close original case. 2281 indent--; // Close original case.
2282 indent--; 2282 indent--;
2283 addIndented('}\n'); // Close 'switch'. 2283 addIndented('}\n'); // Close 'switch'.
2284 setup.add(' }\n'); 2284 setup.add(' }\n');
2285 } 2285 }
2286 2286
2287 // For instructions that reference a guard or a check, we change that 2287 // For instructions that reference a guard or a check, we change that
2288 // reference to the instruction they guard against. Therefore, we must 2288 // reference to the instruction they guard against. Therefore, we must
2289 // use that instruction when restoring the environment. 2289 // use that instruction when restoring the environment.
2290 HInstruction unwrap(HInstruction argument) { 2290 HInstruction unwrap(argument) {
2291 if (argument is HIntegerCheck) { 2291 while (argument is HCheck) argument = argument.checkedInput;
2292 HIntegerCheck instruction = argument; 2292 return argument;
2293 return unwrap(instruction.value);
2294 } else if (argument is HBoundsCheck) {
2295 HBoundsCheck instruction = argument;
2296 return unwrap(instruction.index);
2297 } else if (argument is HTypeGuard) {
2298 HTypeGuard instruction = argument;
2299 return unwrap(instruction.guarded);
2300 } else {
2301 return argument;
2302 }
2303 } 2293 }
2304 2294
2305 bool visitAndOrInfo(HAndOrBlockInformation info) => false; 2295 bool visitAndOrInfo(HAndOrBlockInformation info) => false;
2306 bool visitIfInfo(HIfBlockInformation info) => false; 2296 bool visitIfInfo(HIfBlockInformation info) => false;
2307 bool visitLoopInfo(HLoopBlockInformation info) => false; 2297 bool visitLoopInfo(HLoopBlockInformation info) => false;
2308 bool visitTryInfo(HTryBlockInformation info) => false; 2298 bool visitTryInfo(HTryBlockInformation info) => false;
2309 bool visitSequenceInfo(HStatementSequenceInformation info) => false; 2299 bool visitSequenceInfo(HStatementSequenceInformation info) => false;
2310 2300
2311 void visitTypeGuard(HTypeGuard node) { 2301 void visitTypeGuard(HTypeGuard node) {
2312 indent--; 2302 indent--;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 startBailoutSwitch(); 2460 startBailoutSwitch();
2471 } 2461 }
2472 } 2462 }
2473 2463
2474 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2464 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2475 if (labeledBlockInfo.body.start.hasGuards()) { 2465 if (labeledBlockInfo.body.start.hasGuards()) {
2476 endBailoutSwitch(); 2466 endBailoutSwitch();
2477 } 2467 }
2478 } 2468 }
2479 } 2469 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698