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

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

Issue 10915030: Parse argument definition test expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 1772
1773 1773
1774 void visitLogicalNot(Send node) { 1774 void visitLogicalNot(Send node) {
1775 assert(node.argumentsNode is Prefix); 1775 assert(node.argumentsNode is Prefix);
1776 visit(node.receiver); 1776 visit(node.receiver);
1777 HNot not = new HNot(popBoolified()); 1777 HNot not = new HNot(popBoolified());
1778 pushWithPosition(not, node); 1778 pushWithPosition(not, node);
1779 } 1779 }
1780 1780
1781 void visitUnary(Send node, Operator op) { 1781 void visitUnary(Send node, Operator op) {
1782 String value = op.source.stringValue;
1783 if (value === '?') {
1784 // TODO(ahe): Implement argument definition test.
1785 stack.add(graph.addConstantBool(true));
1786 return;
1787 }
1782 assert(node.argumentsNode is Prefix); 1788 assert(node.argumentsNode is Prefix);
1783 visit(node.receiver); 1789 visit(node.receiver);
1784 assert(op.token.kind !== PLUS_TOKEN); 1790 assert(op.token.kind !== PLUS_TOKEN);
1785 HInstruction operand = pop(); 1791 HInstruction operand = pop();
1786 1792
1787 HInstruction target = 1793 HInstruction target =
1788 new HStatic(interceptors.getPrefixOperatorInterceptor(op)); 1794 new HStatic(interceptors.getPrefixOperatorInterceptor(op));
1789 add(target); 1795 add(target);
1790 HInvokeUnary result; 1796 HInvokeUnary result;
1791 String value = op.source.stringValue;
1792 switch (value) { 1797 switch (value) {
1793 case "-": result = new HNegate(target, operand); break; 1798 case "-": result = new HNegate(target, operand); break;
1794 case "~": result = new HBitNot(target, operand); break; 1799 case "~": result = new HBitNot(target, operand); break;
1795 default: 1800 default:
1796 compiler.internalError('Unexpected unary operator: $value.', node: op); 1801 compiler.internalError('Unexpected unary operator: $value.', node: op);
1797 break; 1802 break;
1798 } 1803 }
1799 // See if we can constant-fold right away. This avoids rewrites later on. 1804 // See if we can constant-fold right away. This avoids rewrites later on.
1800 if (operand is HConstant) { 1805 if (operand is HConstant) {
1801 HConstant constant = operand; 1806 HConstant constant = operand;
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3939 new HSubGraphBlockInformation(elseBranch.graph)); 3944 new HSubGraphBlockInformation(elseBranch.graph));
3940 3945
3941 HBasicBlock conditionStartBlock = conditionBranch.block; 3946 HBasicBlock conditionStartBlock = conditionBranch.block;
3942 conditionStartBlock.setBlockFlow(info, joinBlock); 3947 conditionStartBlock.setBlockFlow(info, joinBlock);
3943 SubGraph conditionGraph = conditionBranch.graph; 3948 SubGraph conditionGraph = conditionBranch.graph;
3944 HIf branch = conditionGraph.end.last; 3949 HIf branch = conditionGraph.end.last;
3945 assert(branch is HIf); 3950 assert(branch is HIf);
3946 branch.blockInformation = conditionStartBlock.blockFlow; 3951 branch.blockInformation = conditionStartBlock.blockFlow;
3947 } 3952 }
3948 } 3953 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/scanner/parser.dart ('k') | dart/tests/compiler/dart2js_extra/argument_definition_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698