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

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

Issue 22903036: Use predicates to check simple function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 4 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 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 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 backend.getInterceptorMethod, backend.interceptedClasses); 2253 backend.getInterceptorMethod, backend.interceptedClasses);
2254 backend.registerSpecializedGetInterceptor(backend.interceptedClasses); 2254 backend.registerSpecializedGetInterceptor(backend.interceptedClasses);
2255 backend.registerUseInterceptor(world); 2255 backend.registerUseInterceptor(world);
2256 2256
2257 var isolate = new js.VariableUse(backend.namer.CURRENT_ISOLATE); 2257 var isolate = new js.VariableUse(backend.namer.CURRENT_ISOLATE);
2258 List<js.Expression> arguments = <js.Expression>[pop()]; 2258 List<js.Expression> arguments = <js.Expression>[pop()];
2259 push(jsPropertyCall(isolate, interceptorName, arguments)); 2259 push(jsPropertyCall(isolate, interceptorName, arguments));
2260 world.registerIsCheck(type, work.resolutionTree); 2260 world.registerIsCheck(type, work.resolutionTree);
2261 2261
2262 js.PropertyAccess field = 2262 js.PropertyAccess field =
2263 new js.PropertyAccess.field(pop(), backend.namer.operatorIs(element)); 2263 new js.PropertyAccess.field(pop(), backend.namer.operatorIsType(type));
2264 // We always negate at least once so that the result is boolified. 2264 // We always negate at least once so that the result is boolified.
2265 push(new js.Prefix('!', field)); 2265 push(new js.Prefix('!', field));
2266 // If the result is not negated, put another '!' in front. 2266 // If the result is not negated, put another '!' in front.
2267 if (!negative) push(new js.Prefix('!', pop())); 2267 if (!negative) push(new js.Prefix('!', pop()));
2268 } 2268 }
2269 2269
2270 void handleNumberOrStringSupertypeCheck(HInstruction input, 2270 void handleNumberOrStringSupertypeCheck(HInstruction input,
2271 DartType type, 2271 DartType type,
2272 { bool negative: false }) { 2272 { bool negative: false }) {
2273 assert(!identical(type.element, compiler.listClass) 2273 assert(!identical(type.element, compiler.listClass)
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 if (leftType.canBeNull() && rightType.canBeNull()) { 2989 if (leftType.canBeNull() && rightType.canBeNull()) {
2990 if (left.isConstantNull() || right.isConstantNull() || 2990 if (left.isConstantNull() || right.isConstantNull() ||
2991 (leftType.isPrimitive(compiler) && leftType == rightType)) { 2991 (leftType.isPrimitive(compiler) && leftType == rightType)) {
2992 return '=='; 2992 return '==';
2993 } 2993 }
2994 return null; 2994 return null;
2995 } else { 2995 } else {
2996 return '==='; 2996 return '===';
2997 } 2997 }
2998 } 2998 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | tests/compiler/dart2js/simple_function_subtype_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698