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

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

Issue 11478022: Implement is-checks with typedefs for callable objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 new js.Binary('||', arrayTest, pop()))); 2340 new js.Binary('||', arrayTest, pop())));
2341 } 2341 }
2342 2342
2343 void visitIs(HIs node) { 2343 void visitIs(HIs node) {
2344 DartType type = node.typeExpression; 2344 DartType type = node.typeExpression;
2345 world.registerIsCheck(type); 2345 world.registerIsCheck(type);
2346 Element element = type.element; 2346 Element element = type.element;
2347 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { 2347 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) {
2348 compiler.unimplemented("visitIs for type variables", 2348 compiler.unimplemented("visitIs for type variables",
2349 instruction: node.expression); 2349 instruction: node.expression);
2350 } else if (identical(element.kind, ElementKind.TYPEDEF)) {
2351 compiler.unimplemented("visitIs for typedefs",
2352 instruction: node.expression);
2353 } 2350 }
2354 LibraryElement coreLibrary = compiler.coreLibrary; 2351 LibraryElement coreLibrary = compiler.coreLibrary;
2355 ClassElement objectClass = compiler.objectClass; 2352 ClassElement objectClass = compiler.objectClass;
2356 HInstruction input = node.expression; 2353 HInstruction input = node.expression;
2357 2354
2358 if (identical(element, objectClass) || identical(element, compiler.dynamicCl ass)) { 2355 if (identical(element, objectClass) || identical(element, compiler.dynamicCl ass)) {
kasperl 2012/12/07 13:41:28 Long line. Not your fault.
karlklose 2012/12/11 08:40:05 Done.
2359 // The constant folder also does this optimization, but we make 2356 // The constant folder also does this optimization, but we make
2360 // it safe by assuming it may have not run. 2357 // it safe by assuming it may have not run.
2361 push(newLiteralBool(true), node); 2358 push(newLiteralBool(true), node);
2362 } else if (element == compiler.stringClass) { 2359 } else if (element == compiler.stringClass) {
2363 checkString(input, '==='); 2360 checkString(input, '===');
2364 attachLocationToLast(node); 2361 attachLocationToLast(node);
2365 } else if (element == compiler.doubleClass) { 2362 } else if (element == compiler.doubleClass) {
2366 checkDouble(input, '==='); 2363 checkDouble(input, '===');
2367 attachLocationToLast(node); 2364 attachLocationToLast(node);
2368 } else if (element == compiler.numClass) { 2365 } else if (element == compiler.numClass) {
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 if (leftType.canBeNull() && rightType.canBeNull()) { 3041 if (leftType.canBeNull() && rightType.canBeNull()) {
3045 if (left.isConstantNull() || right.isConstantNull() || 3042 if (left.isConstantNull() || right.isConstantNull() ||
3046 (leftType.isPrimitive() && leftType == rightType)) { 3043 (leftType.isPrimitive() && leftType == rightType)) {
3047 return '=='; 3044 return '==';
3048 } 3045 }
3049 return null; 3046 return null;
3050 } else { 3047 } else {
3051 return '==='; 3048 return '===';
3052 } 3049 }
3053 } 3050 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698