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

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: Address comments. 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 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 new js.Binary('||', arrayTest, pop()))); 2348 new js.Binary('||', arrayTest, pop())));
2349 } 2349 }
2350 2350
2351 void visitIs(HIs node) { 2351 void visitIs(HIs node) {
2352 DartType type = node.typeExpression; 2352 DartType type = node.typeExpression;
2353 world.registerIsCheck(type); 2353 world.registerIsCheck(type);
2354 Element element = type.element; 2354 Element element = type.element;
2355 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { 2355 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) {
2356 compiler.unimplemented("visitIs for type variables", 2356 compiler.unimplemented("visitIs for type variables",
2357 instruction: node.expression); 2357 instruction: node.expression);
2358 } else if (identical(element.kind, ElementKind.TYPEDEF)) {
2359 compiler.unimplemented("visitIs for typedefs",
2360 instruction: node.expression);
2361 } 2358 }
2362 LibraryElement coreLibrary = compiler.coreLibrary; 2359 LibraryElement coreLibrary = compiler.coreLibrary;
2363 ClassElement objectClass = compiler.objectClass; 2360 ClassElement objectClass = compiler.objectClass;
2364 HInstruction input = node.expression; 2361 HInstruction input = node.expression;
2365 2362
2366 if (identical(element, objectClass) || identical(element, compiler.dynamicCl ass)) { 2363 if (identical(element, objectClass) ||
2364 identical(element, compiler.dynamicClass)) {
2367 // The constant folder also does this optimization, but we make 2365 // The constant folder also does this optimization, but we make
2368 // it safe by assuming it may have not run. 2366 // it safe by assuming it may have not run.
2369 push(newLiteralBool(true), node); 2367 push(newLiteralBool(true), node);
2370 } else if (element == compiler.stringClass) { 2368 } else if (element == compiler.stringClass) {
2371 checkString(input, '==='); 2369 checkString(input, '===');
2372 attachLocationToLast(node); 2370 attachLocationToLast(node);
2373 } else if (element == compiler.doubleClass) { 2371 } else if (element == compiler.doubleClass) {
2374 checkDouble(input, '==='); 2372 checkDouble(input, '===');
2375 attachLocationToLast(node); 2373 attachLocationToLast(node);
2376 } else if (element == compiler.numClass) { 2374 } else if (element == compiler.numClass) {
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 if (leftType.canBeNull() && rightType.canBeNull()) { 3050 if (leftType.canBeNull() && rightType.canBeNull()) {
3053 if (left.isConstantNull() || right.isConstantNull() || 3051 if (left.isConstantNull() || right.isConstantNull() ||
3054 (leftType.isPrimitive() && leftType == rightType)) { 3052 (leftType.isPrimitive() && leftType == rightType)) {
3055 return '=='; 3053 return '==';
3056 } 3054 }
3057 return null; 3055 return null;
3058 } else { 3056 } else {
3059 return '==='; 3057 return '===';
3060 } 3058 }
3061 } 3059 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698