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

Side by Side Diff: lib/compiler/implementation/constant_system_dart.dart

Issue 10986085: Deal with more conditional expressions in the value range analyzer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/value_range_analyzer.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 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); 5 const DART_CONSTANT_SYSTEM = const DartConstantSystem();
6 6
7 class BitNotOperation implements UnaryOperation { 7 class BitNotOperation implements UnaryOperation {
8 final SourceString name = const SourceString('~'); 8 final SourceString name = const SourceString('~');
9 bool isUserDefinable() => true; 9 bool isUserDefinable() => true;
10 const BitNotOperation(); 10 const BitNotOperation();
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 final SourceString name = const SourceString('>'); 273 final SourceString name = const SourceString('>');
274 const GreaterOperation(); 274 const GreaterOperation();
275 bool foldNums(num left, num right) => left > right; 275 bool foldNums(num left, num right) => left > right;
276 apply(left, right) => left > right; 276 apply(left, right) => left > right;
277 } 277 }
278 278
279 class GreaterEqualOperation extends RelationalNumOperation { 279 class GreaterEqualOperation extends RelationalNumOperation {
280 final SourceString name = const SourceString('>='); 280 final SourceString name = const SourceString('>=');
281 const GreaterEqualOperation(); 281 const GreaterEqualOperation();
282 bool foldNums(num left, num right) => left >= right; 282 bool foldNums(num left, num right) => left >= right;
283 apply(left, right) => left <= right; 283 apply(left, right) => left >= right;
284 } 284 }
285 285
286 class EqualsOperation implements BinaryOperation { 286 class EqualsOperation implements BinaryOperation {
287 final SourceString name = const SourceString('=='); 287 final SourceString name = const SourceString('==');
288 bool isUserDefinable() => true; 288 bool isUserDefinable() => true;
289 const EqualsOperation(); 289 const EqualsOperation();
290 Constant fold(Constant left, Constant right) { 290 Constant fold(Constant left, Constant right) {
291 if (left.isNum() && right.isNum()) { 291 if (left.isNum() && right.isNum()) {
292 // Numbers need to be treated specially because: NaN != NaN, -0.0 == 0.0, 292 // Numbers need to be treated specially because: NaN != NaN, -0.0 == 0.0,
293 // and 1 == 1.0. 293 // and 1 == 1.0.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 bool isInt(Constant constant) => constant.isInt(); 362 bool isInt(Constant constant) => constant.isInt();
363 bool isDouble(Constant constant) => constant.isDouble(); 363 bool isDouble(Constant constant) => constant.isDouble();
364 bool isString(Constant constant) => constant.isString(); 364 bool isString(Constant constant) => constant.isString();
365 bool isBool(Constant constant) => constant.isBool(); 365 bool isBool(Constant constant) => constant.isBool();
366 bool isNull(Constant constant) => constant.isNull(); 366 bool isNull(Constant constant) => constant.isNull();
367 367
368 bool isSubtype(Compiler compiler, DartType s, DartType t) { 368 bool isSubtype(Compiler compiler, DartType s, DartType t) {
369 return compiler.types.isSubtype(s, t); 369 return compiler.types.isSubtype(s, t);
370 } 370 }
371 } 371 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/value_range_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698