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

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

Issue 10804024: Add source mapping info to loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 generateStatements(info.body); 778 generateStatements(info.body);
779 currentBlockInformation = oldInfo; 779 currentBlockInformation = oldInfo;
780 } else { 780 } else {
781 generateStatements(info.body); 781 generateStatements(info.body);
782 } 782 }
783 } 783 }
784 784
785 bool visitLoopInfo(HLoopBlockInformation info) { 785 bool visitLoopInfo(HLoopBlockInformation info) {
786 HExpressionInformation condition = info.condition; 786 HExpressionInformation condition = info.condition;
787 bool isConditionExpression = isJSCondition(condition); 787 bool isConditionExpression = isJSCondition(condition);
788 buffer.setSourceLocation(work.element, info.sourcePosition.getBeginToken());
788 789
789 switch (info.kind) { 790 switch (info.kind) {
790 // Treate all three "test-first" loops the same way. 791 // Treate all three "test-first" loops the same way.
791 case HLoopBlockInformation.FOR_LOOP: 792 case HLoopBlockInformation.FOR_LOOP:
792 case HLoopBlockInformation.WHILE_LOOP: 793 case HLoopBlockInformation.WHILE_LOOP:
793 case HLoopBlockInformation.FOR_IN_LOOP: { 794 case HLoopBlockInformation.FOR_IN_LOOP: {
794 HBlockInformation initialization = info.initializer; 795 HBlockInformation initialization = info.initializer;
795 int initializationType = TYPE_STATEMENT; 796 int initializationType = TYPE_STATEMENT;
796 if (initialization !== null) { 797 if (initialization !== null) {
797 initializationType = expressionType(initialization); 798 initializationType = expressionType(initialization);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 use(condition.conditionExpression, JSPrecedence.PREFIX_PRECEDENCE); 896 use(condition.conditionExpression, JSPrecedence.PREFIX_PRECEDENCE);
896 buffer.add(");\n"); 897 buffer.add(");\n");
897 } 898 }
898 break; 899 break;
899 } 900 }
900 default: 901 default:
901 compiler.internalError( 902 compiler.internalError(
902 'Unexpected loop kind: ${info.kind}', 903 'Unexpected loop kind: ${info.kind}',
903 instruction: condition.conditionExpression); 904 instruction: condition.conditionExpression);
904 } 905 }
906 buffer.setSourceLocation(work.element, info.sourcePosition.getEndToken());
905 return true; 907 return true;
906 } 908 }
907 909
908 bool visitLabeledBlockInfo(HLabeledBlockInformation labeledBlockInfo) { 910 bool visitLabeledBlockInfo(HLabeledBlockInformation labeledBlockInfo) {
909 preLabeledBlock(labeledBlockInfo); 911 preLabeledBlock(labeledBlockInfo);
910 addIndentation(); 912 addIndentation();
911 Link<Element> continueOverrides = const EmptyLink<Element>(); 913 Link<Element> continueOverrides = const EmptyLink<Element>();
912 // If [labeledBlockInfo.isContinue], the block is an artificial 914 // If [labeledBlockInfo.isContinue], the block is an artificial
913 // block around the body of a loop with an update block, so that 915 // block around the body of a loop with an update block, so that
914 // continues of the loop can be written as breaks of the body 916 // continues of the loop can be written as breaks of the body
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 if (leftType.canBeNull() && rightType.canBeNull()) { 3144 if (leftType.canBeNull() && rightType.canBeNull()) {
3143 if (left.isConstantNull() || right.isConstantNull() || 3145 if (left.isConstantNull() || right.isConstantNull() ||
3144 (leftType.isPrimitive() && leftType == rightType)) { 3146 (leftType.isPrimitive() && leftType == rightType)) {
3145 return '=='; 3147 return '==';
3146 } 3148 }
3147 return null; 3149 return null;
3148 } else { 3150 } else {
3149 return '==='; 3151 return '===';
3150 } 3152 }
3151 } 3153 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698