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

Side by Side Diff: frog/leg/ssa/nodes.dart

Issue 9427012: Allow binary operators on compile-time-constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file.wq Created 8 years, 10 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 | « frog/leg/compiler.dart ('k') | frog/leg/tree/nodes.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 HVisitor<R> { 5 interface HVisitor<R> {
6 R visitAdd(HAdd node); 6 R visitAdd(HAdd node);
7 R visitBailoutTarget(HBailoutTarget node); 7 R visitBailoutTarget(HBailoutTarget node);
8 R visitBitAnd(HBitAnd node); 8 R visitBitAnd(HBitAnd node);
9 R visitBitNot(HBitNot node); 9 R visitBitNot(HBitNot node);
10 R visitBitOr(HBitOr node); 10 R visitBitOr(HBitOr node);
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 } 1419 }
1420 return super.fold(graph); 1420 return super.fold(graph);
1421 } 1421 }
1422 1422
1423 num evaluate(num a, num b) => a ~/ b; 1423 num evaluate(num a, num b) => a ~/ b;
1424 bool typeEquals(other) => other is HTruncatingDivide; 1424 bool typeEquals(other) => other is HTruncatingDivide;
1425 bool dataEquals(HInstruction other) => true; 1425 bool dataEquals(HInstruction other) => true;
1426 } 1426 }
1427 1427
1428 1428
1429 class ConsDartStringIterator implements Iterator<int> {
1430 Iterator<int> current;
1431 DartString right;
1432 bool hasNextLookAhead;
1433 ConsDartStringIterator(ConsDartString cons)
1434 : current = cons.left.iterator(),
1435 right = cons.right {
1436 hasNextLookAhead = current.hasNext();
1437 if (!hasNextLookAhead) {
1438 nextPart();
1439 }
1440 }
1441 bool hasNext() {
1442 return hasNextLookAhead;
1443 }
1444 int next() {
1445 assert(hasNextLookAhead);
1446 int result = current.next();
1447 hasNextLookAhead = current.hasNext();
1448 if (!hasNextLookAhead) {
1449 nextPart();
1450 }
1451 return result;
1452 }
1453 void nextPart() {
1454 if (right !== null) {
1455 current = right.iterator();
1456 right = null;
1457 hasNextLookAhead = current.hasNext();
1458 }
1459 }
1460 }
1461
1462 class ConsDartString extends DartString {
1463 final DartString left;
1464 final DartString right;
1465 final int length;
1466 int hashCache = null;
1467 String toStringCache;
1468 ConsDartString(DartString left, DartString right)
1469 : this.left = left,
1470 this.right = right,
1471 length = left.length + right.length;
1472
1473 Iterator<int> iterator() => new ConsDartStringIterator(this);
1474
1475 String toString() {
1476 if (toStringCache !== null) return toStringCache;
1477 toStringCache = left.toString().concat(right.toString());
1478 return toStringCache;
1479 }
1480 }
1481
1482
1483 // TODO(floitsch): Should HBinaryArithmetic really be the super class of 1429 // TODO(floitsch): Should HBinaryArithmetic really be the super class of
1484 // HBinaryBitOp? 1430 // HBinaryBitOp?
1485 class HBinaryBitOp extends HBinaryArithmetic { 1431 class HBinaryBitOp extends HBinaryArithmetic {
1486 HBinaryBitOp(HStatic target, HInstruction left, HInstruction right) 1432 HBinaryBitOp(HStatic target, HInstruction left, HInstruction right)
1487 : super(target, left, right); 1433 : super(target, left, right);
1488 1434
1489 HType computeType() { 1435 HType computeType() {
1490 HType type = computeInputsType(); 1436 HType type = computeInputsType();
1491 builtin = type.isInteger(); 1437 builtin = type.isInteger();
1492 if (!type.isUnknown()) return type; 1438 if (!type.isUnknown()) return type;
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 2140
2195 HInstruction get expression() => inputs[0]; 2141 HInstruction get expression() => inputs[0];
2196 2142
2197 HType computeType() => HType.BOOLEAN; 2143 HType computeType() => HType.BOOLEAN;
2198 bool hasExpectedType() => true; 2144 bool hasExpectedType() => true;
2199 2145
2200 accept(HVisitor visitor) => visitor.visitIs(this); 2146 accept(HVisitor visitor) => visitor.visitIs(this);
2201 2147
2202 toString() => "$expression is $typeExpression"; 2148 toString() => "$expression is $typeExpression";
2203 } 2149 }
OLDNEW
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698