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

Side by Side Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 1173403002: dart2js: Fix hints in code base. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Updated to latest revision Created 5 years, 6 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
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 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // Return types on native methods don't need to be checked, since the 419 // Return types on native methods don't need to be checked, since the
420 // declaration has to be truthful. 420 // declaration has to be truthful.
421 421
422 // The call site might omit optional arguments. The inlined code must 422 // The call site might omit optional arguments. The inlined code must
423 // preserve the number of arguments, so check only the actual arguments. 423 // preserve the number of arguments, so check only the actual arguments.
424 424
425 List<HInstruction> inputs = node.inputs.sublist(1); 425 List<HInstruction> inputs = node.inputs.sublist(1);
426 int inputPosition = 1; // Skip receiver. 426 int inputPosition = 1; // Skip receiver.
427 bool canInline = true; 427 bool canInline = true;
428 signature.forEachParameter((ParameterElement element) { 428 signature.forEachParameter((ParameterElement element) {
429 if (inputPosition < inputs.length && canInline) { 429 if (inputPosition++ < inputs.length && canInline) {
430 HInstruction input = inputs[inputPosition++];
431 DartType type = element.type.unalias(compiler); 430 DartType type = element.type.unalias(compiler);
432 if (type is FunctionType) { 431 if (type is FunctionType) {
433 canInline = false; 432 canInline = false;
434 } 433 }
435 if (compiler.enableTypeAssertions) { 434 if (compiler.enableTypeAssertions) {
436 // TODO(sra): Check if [input] is guaranteed to pass the parameter 435 // TODO(sra): Check if [input] is guaranteed to pass the parameter
437 // type check. Consider using a strengthened type check to avoid 436 // type check. Consider using a strengthened type check to avoid
438 // passing `null` to primitive types since the native methods usually 437 // passing `null` to primitive types since the native methods usually
439 // have non-nullable primitive parameter types. 438 // have non-nullable primitive parameter types.
440 canInline = false; 439 canInline = false;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 return graph.addConstantBool(true, compiler); 689 return graph.addConstantBool(true, compiler);
691 } else if (expressionMask.intersection(typeMask, 690 } else if (expressionMask.intersection(typeMask,
692 compiler.world).isEmpty) { 691 compiler.world).isEmpty) {
693 return graph.addConstantBool(false, compiler); 692 return graph.addConstantBool(false, compiler);
694 } 693 }
695 } 694 }
696 return node; 695 return node;
697 } 696 }
698 697
699 HInstruction visitTypeConversion(HTypeConversion node) { 698 HInstruction visitTypeConversion(HTypeConversion node) {
700 HInstruction value = node.inputs[0];
701 DartType type = node.typeExpression; 699 DartType type = node.typeExpression;
702 if (type != null) { 700 if (type != null) {
703 if (type.isMalformed) { 701 if (type.isMalformed) {
704 // Malformed types are treated as dynamic statically, but should 702 // Malformed types are treated as dynamic statically, but should
705 // throw a type error at runtime. 703 // throw a type error at runtime.
706 return node; 704 return node;
707 } 705 }
708 if (!type.treatAsRaw || type.isTypeVariable) { 706 if (!type.treatAsRaw || type.isTypeVariable) {
709 return node; 707 return node;
710 } 708 }
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 2297
2300 keyedValues.forEach((receiver, values) { 2298 keyedValues.forEach((receiver, values) {
2301 result.keyedValues[receiver] = 2299 result.keyedValues[receiver] =
2302 new Map<HInstruction, HInstruction>.from(values); 2300 new Map<HInstruction, HInstruction>.from(values);
2303 }); 2301 });
2304 2302
2305 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2303 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2306 return result; 2304 return result;
2307 } 2305 }
2308 } 2306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698