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

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

Issue 23875033: Do not analyze assert when assertions are disabled. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 this.backend = builder.backend, 928 this.backend = builder.backend,
929 this.work = work, 929 this.work = work,
930 graph = new HGraph(), 930 graph = new HGraph(),
931 stack = new List<HInstruction>(), 931 stack = new List<HInstruction>(),
932 activationVariables = new Map<Element, HLocalValue>(), 932 activationVariables = new Map<Element, HLocalValue>(),
933 jumpTargets = new Map<TargetElement, JumpHandler>(), 933 jumpTargets = new Map<TargetElement, JumpHandler>(),
934 parameters = new Map<Element, HInstruction>(), 934 parameters = new Map<Element, HInstruction>(),
935 sourceElementStack = <Element>[work.element], 935 sourceElementStack = <Element>[work.element],
936 inliningStack = <InliningState>[], 936 inliningStack = <InliningState>[],
937 rti = builder.backend.rti, 937 rti = builder.backend.rti,
938 super(work.resolutionTree) { 938 super(work.resolutionTree, builder.compiler) {
939 localsHandler = new LocalsHandler(this); 939 localsHandler = new LocalsHandler(this);
940 } 940 }
941 941
942 List<InliningState> inliningStack; 942 List<InliningState> inliningStack;
943 943
944 Element returnElement; 944 Element returnElement;
945 DartType returnType; 945 DartType returnType;
946 946
947 bool inTryStatement = false; 947 bool inTryStatement = false;
948 int loopNesting = 0; 948 int loopNesting = 0;
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after
3599 // Finally, if we called a redirecting factory constructor, check the type. 3599 // Finally, if we called a redirecting factory constructor, check the type.
3600 if (isRedirected) { 3600 if (isRedirected) {
3601 HInstruction checked = potentiallyCheckType(newInstance, expectedType); 3601 HInstruction checked = potentiallyCheckType(newInstance, expectedType);
3602 if (checked != newInstance) { 3602 if (checked != newInstance) {
3603 pop(); 3603 pop();
3604 stack.add(checked); 3604 stack.add(checked);
3605 } 3605 }
3606 } 3606 }
3607 } 3607 }
3608 3608
3609 visitAssert(node) {
3610 if (!compiler.enableUserAssertions) {
3611 stack.add(graph.addConstantNull(compiler));
3612 return;
3613 }
3614 visitStaticSend(node);
3615 }
3616
3609 visitStaticSend(Send node) { 3617 visitStaticSend(Send node) {
3610 Selector selector = elements.getSelector(node); 3618 Selector selector = elements.getSelector(node);
3611 Element element = elements[node]; 3619 Element element = elements[node];
3612 if (element.isForeign(compiler)) { 3620 if (element.isForeign(compiler)) {
3613 visitForeignSend(node); 3621 visitForeignSend(node);
3614 return; 3622 return;
3615 } 3623 }
3616 if (element.isErroneous()) { 3624 if (element.isErroneous()) {
3617 generateThrowNoSuchMethod(node, 3625 generateThrowNoSuchMethod(node,
3618 getTargetName(element), 3626 getTargetName(element),
3619 argumentNodes: node.arguments); 3627 argumentNodes: node.arguments);
3620 return; 3628 return;
3621 } 3629 }
3622 if (identical(element, compiler.assertMethod)
3623 && !compiler.enableUserAssertions) {
3624 stack.add(graph.addConstantNull(compiler));
3625 return;
3626 }
3627 compiler.ensure(!element.isGenerativeConstructor()); 3630 compiler.ensure(!element.isGenerativeConstructor());
3628 if (element.isFunction()) { 3631 if (element.isFunction()) {
3629 var inputs = <HInstruction>[]; 3632 var inputs = <HInstruction>[];
3630 // TODO(5347): Try to avoid the need for calling [implementation] before 3633 // TODO(5347): Try to avoid the need for calling [implementation] before
3631 // calling [addStaticSendArgumentsToList]. 3634 // calling [addStaticSendArgumentsToList].
3632 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, 3635 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments,
3633 element.implementation, 3636 element.implementation,
3634 inputs); 3637 inputs);
3635 if (!succeeded) { 3638 if (!succeeded) {
3636 generateWrongArgumentCountError(node, element, node.arguments); 3639 generateWrongArgumentCountError(node, element, node.arguments);
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
5513 new HSubGraphBlockInformation(elseBranch.graph)); 5516 new HSubGraphBlockInformation(elseBranch.graph));
5514 5517
5515 HBasicBlock conditionStartBlock = conditionBranch.block; 5518 HBasicBlock conditionStartBlock = conditionBranch.block;
5516 conditionStartBlock.setBlockFlow(info, joinBlock); 5519 conditionStartBlock.setBlockFlow(info, joinBlock);
5517 SubGraph conditionGraph = conditionBranch.graph; 5520 SubGraph conditionGraph = conditionBranch.graph;
5518 HIf branch = conditionGraph.end.last; 5521 HIf branch = conditionGraph.end.last;
5519 assert(branch is HIf); 5522 assert(branch is HIf);
5520 branch.blockInformation = conditionStartBlock.blockFlow; 5523 branch.blockInformation = conditionStartBlock.blockFlow;
5521 } 5524 }
5522 } 5525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698