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

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

Issue 10968060: Add a value range analysis phase to remove bounds checks. (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/constant_system_dart.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 interface Operation { 5 interface Operation {
6 final SourceString name; 6 final SourceString name;
7 bool isUserDefinable(); 7 bool isUserDefinable();
8 } 8 }
9 9
10 interface UnaryOperation extends Operation { 10 interface UnaryOperation extends Operation {
11 /** Returns [:null:] if it was unable to fold the operation. */ 11 /** Returns [:null:] if it was unable to fold the operation. */
12 Constant fold(Constant constant); 12 Constant fold(Constant constant);
13 apply(value);
13 } 14 }
14 15
15 interface BinaryOperation extends Operation { 16 interface BinaryOperation extends Operation {
16 /** Returns [:null:] if it was unable to fold the operation. */ 17 /** Returns [:null:] if it was unable to fold the operation. */
17 Constant fold(Constant left, Constant right); 18 Constant fold(Constant left, Constant right);
19 apply(left, right);
18 } 20 }
19 21
20 /** 22 /**
21 * A [ConstantSystem] is responsible for creating constants and folding them. 23 * A [ConstantSystem] is responsible for creating constants and folding them.
22 */ 24 */
23 interface ConstantSystem { 25 interface ConstantSystem {
24 BinaryOperation get add; 26 BinaryOperation get add;
25 BinaryOperation get bitAnd; 27 BinaryOperation get bitAnd;
26 UnaryOperation get bitNot; 28 UnaryOperation get bitNot;
27 BinaryOperation get bitOr; 29 BinaryOperation get bitOr;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 bool isInt(Constant constant); 61 bool isInt(Constant constant);
60 /** Returns true if the [constant] is a double at runtime. */ 62 /** Returns true if the [constant] is a double at runtime. */
61 bool isDouble(Constant constant); 63 bool isDouble(Constant constant);
62 /** Returns true if the [constant] is a string at runtime. */ 64 /** Returns true if the [constant] is a string at runtime. */
63 bool isString(Constant constant); 65 bool isString(Constant constant);
64 /** Returns true if the [constant] is a boolean at runtime. */ 66 /** Returns true if the [constant] is a boolean at runtime. */
65 bool isBool(Constant constant); 67 bool isBool(Constant constant);
66 /** Returns true if the [constant] is null at runtime. */ 68 /** Returns true if the [constant] is null at runtime. */
67 bool isNull(Constant constant); 69 bool isNull(Constant constant);
68 } 70 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/constant_system_dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698