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

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

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 class SsaCodeGeneratorTask extends CompilerTask { 7 class SsaCodeGeneratorTask extends CompilerTask {
8 8
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 10
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 } else if (constant.isSentinel()) { 1831 } else if (constant.isSentinel()) {
1832 // TODO(floitsch): get rid of the code buffer. 1832 // TODO(floitsch): get rid of the code buffer.
1833 CodeBuffer buffer = new CodeBuffer(); 1833 CodeBuffer buffer = new CodeBuffer();
1834 backend.emitter.writeConstantToBuffer(constant, buffer); 1834 backend.emitter.writeConstantToBuffer(constant, buffer);
1835 push(new js.VariableUse(buffer.toString())); 1835 push(new js.VariableUse(buffer.toString()));
1836 } else { 1836 } else {
1837 compiler.internalError( 1837 compiler.internalError(
1838 "The compiler does not know how generate code for " 1838 "The compiler does not know how generate code for "
1839 "constant $constant"); 1839 "constant $constant");
1840 } 1840 }
1841 } else if (constant.isType) {
floitsch 2012/11/16 13:53:31 isn't this doing exactly the same thing as the 'el
karlklose 2012/11/19 15:08:58 Yes. Removed.
1842 String name = namer.constantName(constant);
1843 js.VariableUse currentIsolateUse =
1844 new js.VariableUse(backend.namer.CURRENT_ISOLATE);
1845 push(new js.PropertyAccess.field(currentIsolateUse, name));
1841 } else { 1846 } else {
1842 String name = namer.constantName(constant); 1847 String name = namer.constantName(constant);
1843 js.VariableUse currentIsolateUse = 1848 js.VariableUse currentIsolateUse =
1844 new js.VariableUse(backend.namer.CURRENT_ISOLATE); 1849 new js.VariableUse(backend.namer.CURRENT_ISOLATE);
1845 push(new js.PropertyAccess.field(currentIsolateUse, name)); 1850 push(new js.PropertyAccess.field(currentIsolateUse, name));
1846 } 1851 }
1847 } 1852 }
1848 1853
1849 visitConstant(HConstant node) { 1854 visitConstant(HConstant node) {
1850 assert(isGenerateAtUseSite(node)); 1855 assert(isGenerateAtUseSite(node));
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 if (leftType.canBeNull() && rightType.canBeNull()) { 3109 if (leftType.canBeNull() && rightType.canBeNull()) {
3105 if (left.isConstantNull() || right.isConstantNull() || 3110 if (left.isConstantNull() || right.isConstantNull() ||
3106 (leftType.isPrimitive() && leftType == rightType)) { 3111 (leftType.isPrimitive() && leftType == rightType)) {
3107 return '=='; 3112 return '==';
3108 } 3113 }
3109 return null; 3114 return null;
3110 } else { 3115 } else {
3111 return '==='; 3116 return '===';
3112 } 3117 }
3113 } 3118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698