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

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

Issue 1755823003: Replace TypeMask.isEmpty by isEmptyOrNull, use isEmpty when it's really empty. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/nodes.dart ('k') | pkg/compiler/lib/src/ssa/types.dart » ('j') | 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 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 HInstruction visitBoolify(HBoolify node) { 242 HInstruction visitBoolify(HBoolify node) {
243 List<HInstruction> inputs = node.inputs; 243 List<HInstruction> inputs = node.inputs;
244 assert(inputs.length == 1); 244 assert(inputs.length == 1);
245 HInstruction input = inputs[0]; 245 HInstruction input = inputs[0];
246 if (input.isBoolean(compiler)) return input; 246 if (input.isBoolean(compiler)) return input;
247 247
248 // If the code is unreachable, remove the HBoolify. This can happen when 248 // If the code is unreachable, remove the HBoolify. This can happen when
249 // there is a throw expression in a short-circuit conditional. Removing the 249 // there is a throw expression in a short-circuit conditional. Removing the
250 // unreachable HBoolify makes it easier to reconstruct the short-circuit 250 // unreachable HBoolify makes it easier to reconstruct the short-circuit
251 // operation. 251 // operation.
252 if (input.instructionType.isEmpty && !input.instructionType.isNullable) 252 if (input.instructionType.isEmpty) return input;
253 return input;
254 253
255 // All values that cannot be 'true' are boolified to false. 254 // All values that cannot be 'true' are boolified to false.
256 TypeMask mask = input.instructionType; 255 TypeMask mask = input.instructionType;
257 if (!mask.contains(helpers.jsBoolClass, compiler.world)) { 256 if (!mask.contains(helpers.jsBoolClass, compiler.world)) {
258 return graph.addConstantBool(false, compiler); 257 return graph.addConstantBool(false, compiler);
259 } 258 }
260 return node; 259 return node;
261 } 260 }
262 261
263 HInstruction visitNot(HNot node) { 262 HInstruction visitNot(HNot node) {
(...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 2397
2399 keyedValues.forEach((receiver, values) { 2398 keyedValues.forEach((receiver, values) {
2400 result.keyedValues[receiver] = 2399 result.keyedValues[receiver] =
2401 new Map<HInstruction, HInstruction>.from(values); 2400 new Map<HInstruction, HInstruction>.from(values);
2402 }); 2401 });
2403 2402
2404 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2403 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2405 return result; 2404 return result;
2406 } 2405 }
2407 } 2406 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | pkg/compiler/lib/src/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698