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

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

Issue 2739953002: dart2js: num.compareTo is pure, and a.compareTo(a) is zero (Closed)
Patch Set: Fix merge error Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
6 import '../common/names.dart' show Selectors; 6 import '../common/names.dart' show Selectors;
7 import '../common/tasks.dart' show CompilerTask; 7 import '../common/tasks.dart' show CompilerTask;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../constants/constant_system.dart'; 9 import '../constants/constant_system.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // Try constant folding the instruction. 395 // Try constant folding the instruction.
396 Operation operation = node.specializer.operation(constantSystem); 396 Operation operation = node.specializer.operation(constantSystem);
397 if (operation != null) { 397 if (operation != null) {
398 HInstruction instruction = node.inputs.length == 2 398 HInstruction instruction = node.inputs.length == 2
399 ? foldUnary(operation, node.inputs[1]) 399 ? foldUnary(operation, node.inputs[1])
400 : foldBinary(operation, node.inputs[1], node.inputs[2]); 400 : foldBinary(operation, node.inputs[1], node.inputs[2]);
401 if (instruction != null) return instruction; 401 if (instruction != null) return instruction;
402 } 402 }
403 403
404 // Try converting the instruction to a builtin instruction. 404 // Try converting the instruction to a builtin instruction.
405 HInstruction instruction = node.specializer.tryConvertToBuiltin( 405 HInstruction instruction = node.specializer.tryConvertToBuiltin(node,
406 node, _globalInferenceResults, _options, _helpers, _closedWorld); 406 _graph, _globalInferenceResults, _options, _helpers, _closedWorld);
407 if (instruction != null) return instruction; 407 if (instruction != null) return instruction;
408 408
409 Selector selector = node.selector; 409 Selector selector = node.selector;
410 TypeMask mask = node.mask; 410 TypeMask mask = node.mask;
411 HInstruction input = node.inputs[1]; 411 HInstruction input = node.inputs[1];
412 412
413 bool applies(MemberEntity element) { 413 bool applies(MemberEntity element) {
414 return selector.applies(element) && 414 return selector.applies(element) &&
415 (mask == null || mask.canHit(element, selector, _closedWorld)); 415 (mask == null || mask.canHit(element, selector, _closedWorld));
416 } 416 }
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 // All intercepted classes extend `Interceptor`, so if the receiver can't 1159 // All intercepted classes extend `Interceptor`, so if the receiver can't
1160 // be a class extending `Interceptor` then it can be called directly. 1160 // be a class extending `Interceptor` then it can be called directly.
1161 if (new TypeMask.nonNullSubclass( 1161 if (new TypeMask.nonNullSubclass(
1162 _helpers.jsInterceptorClass, _closedWorld) 1162 _helpers.jsInterceptorClass, _closedWorld)
1163 .isDisjoint(input.instructionType, _closedWorld)) { 1163 .isDisjoint(input.instructionType, _closedWorld)) {
1164 var inputs = <HInstruction>[input, input]; // [interceptor, receiver]. 1164 var inputs = <HInstruction>[input, input]; // [interceptor, receiver].
1165 HInstruction result = new HInvokeDynamicMethod( 1165 HInstruction result = new HInvokeDynamicMethod(
1166 selector, 1166 selector,
1167 input.instructionType, // receiver mask. 1167 input.instructionType, // receiver mask.
1168 inputs, 1168 inputs,
1169 toStringType)..sourceInformation = node.sourceInformation; 1169 toStringType)
1170 ..sourceInformation = node.sourceInformation;
1170 return result; 1171 return result;
1171 } 1172 }
1172 return null; 1173 return null;
1173 } 1174 }
1174 1175
1175 return tryConstant() ?? tryToString() ?? node; 1176 return tryConstant() ?? tryToString() ?? node;
1176 } 1177 }
1177 1178
1178 HInstruction visitOneShotInterceptor(HOneShotInterceptor node) { 1179 HInstruction visitOneShotInterceptor(HOneShotInterceptor node) {
1179 return handleInterceptedCall(node); 1180 return handleInterceptedCall(node);
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 2837
2837 keyedValues.forEach((receiver, values) { 2838 keyedValues.forEach((receiver, values) {
2838 result.keyedValues[receiver] = 2839 result.keyedValues[receiver] =
2839 new Map<HInstruction, HInstruction>.from(values); 2840 new Map<HInstruction, HInstruction>.from(values);
2840 }); 2841 });
2841 2842
2842 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2843 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2843 return result; 2844 return result;
2844 } 2845 }
2845 } 2846 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698