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

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

Issue 11628009: Re-apply "support for typedef in checked mode" and fix the checked mode failures on drt by not shar… (Closed) Base URL: http://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 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 2284
2285 void checkFixedArray(HInstruction input) { 2285 void checkFixedArray(HInstruction input) {
2286 checkFieldExists(input, 'fixed\$length'); 2286 checkFieldExists(input, 'fixed\$length');
2287 } 2287 }
2288 2288
2289 void checkNull(HInstruction input) { 2289 void checkNull(HInstruction input) {
2290 use(input); 2290 use(input);
2291 push(new js.Binary('==', pop(), new js.LiteralNull())); 2291 push(new js.Binary('==', pop(), new js.LiteralNull()));
2292 } 2292 }
2293 2293
2294 void checkNonNull(HInstruction input) {
2295 use(input);
2296 push(new js.Binary('!=', pop(), new js.LiteralNull()));
2297 }
2298
2294 void checkFunction(HInstruction input, DartType type) { 2299 void checkFunction(HInstruction input, DartType type) {
2295 checkTypeOf(input, '===', 'function'); 2300 checkTypeOf(input, '===', 'function');
2296 js.Expression functionTest = pop(); 2301 js.Expression functionTest = pop();
2297 checkObject(input, '==='); 2302 checkObject(input, '===');
2298 js.Expression objectTest = pop(); 2303 js.Expression objectTest = pop();
2299 checkType(input, type); 2304 checkType(input, type);
2300 push(new js.Binary('||', 2305 push(new js.Binary('||',
2301 functionTest, 2306 functionTest,
2302 new js.Binary('&&', objectTest, pop()))); 2307 new js.Binary('&&', objectTest, pop())));
2303 } 2308 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 } else if (Elements.isNumberOrStringSupertype(element, compiler)) { 2413 } else if (Elements.isNumberOrStringSupertype(element, compiler)) {
2409 handleNumberOrStringSupertypeCheck(input, type); 2414 handleNumberOrStringSupertypeCheck(input, type);
2410 attachLocationToLast(node); 2415 attachLocationToLast(node);
2411 } else if (Elements.isStringOnlySupertype(element, compiler)) { 2416 } else if (Elements.isStringOnlySupertype(element, compiler)) {
2412 handleStringSupertypeCheck(input, type); 2417 handleStringSupertypeCheck(input, type);
2413 attachLocationToLast(node); 2418 attachLocationToLast(node);
2414 } else if (identical(element, compiler.listClass) 2419 } else if (identical(element, compiler.listClass)
2415 || Elements.isListSupertype(element, compiler)) { 2420 || Elements.isListSupertype(element, compiler)) {
2416 handleListOrSupertypeCheck(input, type); 2421 handleListOrSupertypeCheck(input, type);
2417 attachLocationToLast(node); 2422 attachLocationToLast(node);
2423 } else if (element.isTypedef()) {
2424 checkNonNull(input);
2425 js.Expression nullTest = pop();
2426 checkType(input, type);
2427 push(new js.Binary('&&', nullTest, pop()));
2428 attachLocationToLast(node);
2418 } else if (types[input].canBePrimitive() || types[input].canBeNull()) { 2429 } else if (types[input].canBePrimitive() || types[input].canBeNull()) {
2419 checkObject(input, '==='); 2430 checkObject(input, '===');
2420 js.Expression objectTest = pop(); 2431 js.Expression objectTest = pop();
2421 checkType(input, type); 2432 checkType(input, type);
2422 push(new js.Binary('&&', objectTest, pop()), node); 2433 push(new js.Binary('&&', objectTest, pop()), node);
2423 } else { 2434 } else {
2424 checkType(input, type); 2435 checkType(input, type);
2425 attachLocationToLast(node); 2436 attachLocationToLast(node);
2426 } 2437 }
2427 if (node.hasArgumentChecks()) { 2438 if (node.hasArgumentChecks()) {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 if (leftType.canBeNull() && rightType.canBeNull()) { 3078 if (leftType.canBeNull() && rightType.canBeNull()) {
3068 if (left.isConstantNull() || right.isConstantNull() || 3079 if (left.isConstantNull() || right.isConstantNull() ||
3069 (leftType.isPrimitive() && leftType == rightType)) { 3080 (leftType.isPrimitive() && leftType == rightType)) {
3070 return '=='; 3081 return '==';
3071 } 3082 }
3072 return null; 3083 return null;
3073 } else { 3084 } else {
3074 return '==='; 3085 return '===';
3075 } 3086 }
3076 } 3087 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698