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

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

Issue 14015004: Remove call-indirections from type tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 push(new js.Conditional( 2236 push(new js.Conditional(
2237 new js.Binary('==', 2237 new js.Binary('==',
2238 new js.Prefix("typeof", pop()), 2238 new js.Prefix("typeof", pop()),
2239 js.string('function')), 2239 js.string('function')),
2240 whenFunction, 2240 whenFunction,
2241 whenNotFunction)); 2241 whenNotFunction));
2242 } 2242 }
2243 2243
2244 js.PropertyAccess field = 2244 js.PropertyAccess field =
2245 new js.PropertyAccess.field(pop(), backend.namer.operatorIs(element)); 2245 new js.PropertyAccess.field(pop(), backend.namer.operatorIs(element));
2246 if (backend.emitter.nativeEmitter.requiresNativeIsCheck(element)) { 2246 // We always negate at least once so that the result is boolified.
2247 push(new js.Call(field, <js.Expression>[])); 2247 push(new js.Prefix('!', field));
2248 if (negative) push(new js.Prefix('!', pop())); 2248 // If the result is not negated, put another '!' in front.
2249 } else { 2249 if (!negative) push(new js.Prefix('!', pop()));
2250 // We always negate at least once so that the result is boolified.
2251 push(new js.Prefix('!', field));
2252 // If the result is not negated, put another '!' in front.
2253 if (!negative) push(new js.Prefix('!', pop()));
2254 }
2255
2256 } 2250 }
2257 2251
2258 void handleNumberOrStringSupertypeCheck(HInstruction input, DartType type) { 2252 void handleNumberOrStringSupertypeCheck(HInstruction input, DartType type) {
2259 assert(!identical(type.element, compiler.listClass) 2253 assert(!identical(type.element, compiler.listClass)
2260 && !Elements.isListSupertype(type.element, compiler) 2254 && !Elements.isListSupertype(type.element, compiler)
2261 && !Elements.isStringOnlySupertype(type.element, compiler)); 2255 && !Elements.isStringOnlySupertype(type.element, compiler));
2262 checkNum(input, '==='); 2256 checkNum(input, '===');
2263 js.Expression numberTest = pop(); 2257 js.Expression numberTest = pop();
2264 checkString(input, '==='); 2258 checkString(input, '===');
2265 js.Expression stringTest = pop(); 2259 js.Expression stringTest = pop();
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2960 if (leftType.canBeNull() && rightType.canBeNull()) { 2954 if (leftType.canBeNull() && rightType.canBeNull()) {
2961 if (left.isConstantNull() || right.isConstantNull() || 2955 if (left.isConstantNull() || right.isConstantNull() ||
2962 (leftType.isPrimitive() && leftType == rightType)) { 2956 (leftType.isPrimitive() && leftType == rightType)) {
2963 return '=='; 2957 return '==';
2964 } 2958 }
2965 return null; 2959 return null;
2966 } else { 2960 } else {
2967 return '==='; 2961 return '===';
2968 } 2962 }
2969 } 2963 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698