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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 15744017: Make int a double in argument type checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/native_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 1247
1248 void emitRuntimeTypeSupport(CodeBuffer buffer) { 1248 void emitRuntimeTypeSupport(CodeBuffer buffer) {
1249 RuntimeTypes rti = backend.rti; 1249 RuntimeTypes rti = backend.rti;
1250 TypeChecks typeChecks = rti.requiredChecks; 1250 TypeChecks typeChecks = rti.requiredChecks;
1251 1251
1252 // Add checks to the constructors of instantiated classes. 1252 // Add checks to the constructors of instantiated classes.
1253 for (ClassElement cls in typeChecks) { 1253 for (ClassElement cls in typeChecks) {
1254 String holder = namer.isolateAccess(backend.getImplementationClass(cls)); 1254 String holder = namer.isolateAccess(backend.getImplementationClass(cls));
1255 for (TypeCheck check in typeChecks[cls]) { 1255 for (TypeCheck check in typeChecks[cls]) {
1256 ClassElement cls = check.cls; 1256 ClassElement cls = check.cls;
1257 buffer.write('$holder.${namer.operatorIs(check.cls)}$_=${_}true$N');
1258 buffer.write('$holder.${namer.operatorIs(cls)}$_=${_}true$N'); 1257 buffer.write('$holder.${namer.operatorIs(cls)}$_=${_}true$N');
1259 Substitution substitution = check.substitution; 1258 Substitution substitution = check.substitution;
1260 if (substitution != null) { 1259 if (substitution != null) {
1261 String body = substitution.getCode(rti, false); 1260 String body = substitution.getCode(rti, false);
1262 buffer.write('$holder.${namer.substitutionName(cls)}$_=${_}$body$N'); 1261 buffer.write('$holder.${namer.substitutionName(cls)}$_=${_}$body$N');
1263 } 1262 }
1264 }; 1263 };
1265 } 1264 }
1266 } 1265 }
1267 1266
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 * substitutions, because they may have changed. 1608 * substitutions, because they may have changed.
1610 */ 1609 */
1611 void generateIsTestsOn(ClassElement cls, 1610 void generateIsTestsOn(ClassElement cls,
1612 void emitIsTest(Element element), 1611 void emitIsTest(Element element),
1613 void emitSubstitution(Element element, {emitNull})) { 1612 void emitSubstitution(Element element, {emitNull})) {
1614 if (checkedClasses.contains(cls)) { 1613 if (checkedClasses.contains(cls)) {
1615 emitIsTest(cls); 1614 emitIsTest(cls);
1616 emitSubstitution(cls); 1615 emitSubstitution(cls);
1617 } 1616 }
1618 1617
1618 if (cls == backend.jsIntClass) {
ngeoffray 2013/05/24 09:34:28 I'd prefer if that was put on the interceptor clas
karlklose 2013/05/24 11:10:50 Done.
1619 emitIsTest(compiler.doubleClass);
1620 }
1619 RuntimeTypes rti = backend.rti; 1621 RuntimeTypes rti = backend.rti;
1620 ClassElement superclass = cls.superclass; 1622 ClassElement superclass = cls.superclass;
1621 1623
1622 bool haveSameTypeVariables(ClassElement a, ClassElement b) { 1624 bool haveSameTypeVariables(ClassElement a, ClassElement b) {
1623 if (a.isClosure()) return true; 1625 if (a.isClosure()) return true;
1624 return a.typeVariables == b.typeVariables; 1626 return a.typeVariables == b.typeVariables;
1625 } 1627 }
1626 1628
1627 if (superclass != null && superclass != compiler.objectClass && 1629 if (superclass != null && superclass != compiler.objectClass &&
1628 !haveSameTypeVariables(cls, superclass)) { 1630 !haveSameTypeVariables(cls, superclass)) {
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
3166 """; 3168 """;
3167 const String HOOKS_API_USAGE = """ 3169 const String HOOKS_API_USAGE = """
3168 // The code supports the following hooks: 3170 // The code supports the following hooks:
3169 // dartPrint(message) - if this function is defined it is called 3171 // dartPrint(message) - if this function is defined it is called
3170 // instead of the Dart [print] method. 3172 // instead of the Dart [print] method.
3171 // dartMainRunner(main) - if this function is defined, the Dart [main] 3173 // dartMainRunner(main) - if this function is defined, the Dart [main]
3172 // method will not be invoked directly. 3174 // method will not be invoked directly.
3173 // Instead, a closure that will invoke [main] is 3175 // Instead, a closure that will invoke [main] is
3174 // passed to [dartMainRunner]. 3176 // passed to [dartMainRunner].
3175 """; 3177 """;
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/native_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698