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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 12051013: Cleanup how we handle side effects in HInstruction and put the right flags for HIs, modulo, truncat… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 createForeign('#[#]', 'Object', [typeInfo, position]); 2616 createForeign('#[#]', 'Object', [typeInfo, position]);
2617 add(typeArgument); 2617 add(typeArgument);
2618 // Create the call to isSubtype. 2618 // Create the call to isSubtype.
2619 List<HInstruction> inputs = 2619 List<HInstruction> inputs =
2620 <HInstruction>[isSubtype, typeArgument, representation]; 2620 <HInstruction>[isSubtype, typeArgument, representation];
2621 HInstruction call = new HInvokeStatic(inputs); 2621 HInstruction call = new HInvokeStatic(inputs);
2622 add(call); 2622 add(call);
2623 checks.add(call); 2623 checks.add(call);
2624 index++; 2624 index++;
2625 }); 2625 });
2626 instruction = new HIs.withArgumentChecks(type, expression, checks); 2626 instruction = new HIs(type, <HInstruction>[expression]..addAll(checks));
2627 } else { 2627 } else {
2628 instruction = new HIs(type, expression); 2628 instruction = new HIs(type, <HInstruction>[expression]);
2629 } 2629 }
2630 if (isNot) { 2630 if (isNot) {
2631 add(instruction); 2631 add(instruction);
2632 instruction = new HNot(instruction); 2632 instruction = new HNot(instruction);
2633 } 2633 }
2634 push(instruction); 2634 push(instruction);
2635 } else if (const SourceString("as") == op.source) { 2635 } else if (const SourceString("as") == op.source) {
2636 visit(node.receiver); 2636 visit(node.receiver);
2637 HInstruction expression = pop(); 2637 HInstruction expression = pop();
2638 Node argument = node.arguments.head; 2638 Node argument = node.arguments.head;
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 tryInstruction.exception = exception; 4391 tryInstruction.exception = exception;
4392 Link<Node> link = node.catchBlocks.nodes; 4392 Link<Node> link = node.catchBlocks.nodes;
4393 4393
4394 void pushCondition(CatchBlock catchBlock) { 4394 void pushCondition(CatchBlock catchBlock) {
4395 if (catchBlock.onKeyword != null) { 4395 if (catchBlock.onKeyword != null) {
4396 DartType type = elements.getType(catchBlock.type); 4396 DartType type = elements.getType(catchBlock.type);
4397 if (type == null) { 4397 if (type == null) {
4398 compiler.cancel('On with unresolved type', 4398 compiler.cancel('On with unresolved type',
4399 node: catchBlock.type); 4399 node: catchBlock.type);
4400 } 4400 }
4401 HInstruction condition = new HIs(type, unwrappedException); 4401 HInstruction condition =
4402 new HIs(type, <HInstruction>[unwrappedException]);
4402 push(condition); 4403 push(condition);
4403 } 4404 }
4404 else { 4405 else {
4405 VariableDefinitions declaration = catchBlock.formals.nodes.head; 4406 VariableDefinitions declaration = catchBlock.formals.nodes.head;
4406 HInstruction condition = null; 4407 HInstruction condition = null;
4407 if (declaration.type == null) { 4408 if (declaration.type == null) {
4408 condition = graph.addConstantBool(true, constantSystem); 4409 condition = graph.addConstantBool(true, constantSystem);
4409 stack.add(condition); 4410 stack.add(condition);
4410 } else { 4411 } else {
4411 // TODO(aprelev@gmail.com): Once old catch syntax is removed 4412 // TODO(aprelev@gmail.com): Once old catch syntax is removed
4412 // "if" condition above and this "else" branch should be deleted as 4413 // "if" condition above and this "else" branch should be deleted as
4413 // type of declared variable won't matter for the catch 4414 // type of declared variable won't matter for the catch
4414 // condition. 4415 // condition.
4415 DartType type = elements.getType(declaration.type); 4416 DartType type = elements.getType(declaration.type);
4416 if (type == null) { 4417 if (type == null) {
4417 compiler.cancel('Catch with unresolved type', node: catchBlock); 4418 compiler.cancel('Catch with unresolved type', node: catchBlock);
4418 } 4419 }
4419 condition = new HIs(type, unwrappedException, nullOk: true); 4420 condition =
4421 new HIs(type, <HInstruction>[unwrappedException], nullOk: true);
4420 push(condition); 4422 push(condition);
4421 } 4423 }
4422 } 4424 }
4423 } 4425 }
4424 4426
4425 void visitThen() { 4427 void visitThen() {
4426 CatchBlock catchBlock = link.head; 4428 CatchBlock catchBlock = link.head;
4427 link = link.tail; 4429 link = link.tail;
4428 if (catchBlock.exception != null) { 4430 if (catchBlock.exception != null) {
4429 localsHandler.updateLocal(elements[catchBlock.exception], 4431 localsHandler.updateLocal(elements[catchBlock.exception],
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
4941 new HSubGraphBlockInformation(elseBranch.graph)); 4943 new HSubGraphBlockInformation(elseBranch.graph));
4942 4944
4943 HBasicBlock conditionStartBlock = conditionBranch.block; 4945 HBasicBlock conditionStartBlock = conditionBranch.block;
4944 conditionStartBlock.setBlockFlow(info, joinBlock); 4946 conditionStartBlock.setBlockFlow(info, joinBlock);
4945 SubGraph conditionGraph = conditionBranch.graph; 4947 SubGraph conditionGraph = conditionBranch.graph;
4946 HIf branch = conditionGraph.end.last; 4948 HIf branch = conditionGraph.end.last;
4947 assert(branch is HIf); 4949 assert(branch is HIf);
4948 branch.blockInformation = conditionStartBlock.blockFlow; 4950 branch.blockInformation = conditionStartBlock.blockFlow;
4949 } 4951 }
4950 } 4952 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698