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

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

Issue 9967001: Fix bug where constants were not correctly canonicalized. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 8 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 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 9
10 String generateMethod(WorkItem work, HGraph graph) { 10 String generateMethod(WorkItem work, HGraph graph) {
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 // TODO(floitsch): the compile-time constant handler and the codegen 1109 // TODO(floitsch): the compile-time constant handler and the codegen
1110 // need to work together to avoid the parenthesis. See r4928 for an 1110 // need to work together to avoid the parenthesis. See r4928 for an
1111 // implementation that still dealt with precedence. 1111 // implementation that still dealt with precedence.
1112 ConstantHandler handler = compiler.constantHandler; 1112 ConstantHandler handler = compiler.constantHandler;
1113 String name = handler.getNameForConstant(node.constant); 1113 String name = handler.getNameForConstant(node.constant);
1114 if (name === null) { 1114 if (name === null) {
1115 assert(!node.constant.isObject()); 1115 assert(!node.constant.isObject());
1116 if (node.constant.isNum() 1116 if (node.constant.isNum()
1117 && expectedPrecedence == JSPrecedence.MEMBER_PRECEDENCE) { 1117 && expectedPrecedence == JSPrecedence.MEMBER_PRECEDENCE) {
1118 buffer.add('('); 1118 buffer.add('(');
1119 node.constant.writeJsCode(buffer, handler); 1119 handler.writeConstant(buffer, node.constant);
1120 buffer.add(')'); 1120 buffer.add(')');
1121 } else { 1121 } else {
1122 node.constant.writeJsCode(buffer, handler); 1122 handler.writeConstant(buffer, node.constant);
1123 } 1123 }
1124 } else { 1124 } else {
1125 buffer.add(compiler.namer.CURRENT_ISOLATE); 1125 buffer.add(compiler.namer.CURRENT_ISOLATE);
1126 buffer.add("."); 1126 buffer.add(".");
1127 buffer.add(name); 1127 buffer.add(name);
1128 } 1128 }
1129 } 1129 }
1130 1130
1131 visitLoopBranch(HLoopBranch node) { 1131 visitLoopBranch(HLoopBranch node) {
1132 if (subGraph !== null && node.block == subGraph.end) { 1132 if (subGraph !== null && node.block == subGraph.end) {
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 startBailoutSwitch(); 1861 startBailoutSwitch();
1862 } 1862 }
1863 } 1863 }
1864 1864
1865 void endElse(HIf node) { 1865 void endElse(HIf node) {
1866 if (node.elseBlock.hasGuards()) { 1866 if (node.elseBlock.hasGuards()) {
1867 endBailoutSwitch(); 1867 endBailoutSwitch();
1868 } 1868 }
1869 } 1869 }
1870 } 1870 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/emitter.dart ('k') | tests/language/src/CompileTimeConstantMTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698