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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 85663003: We can actually map the Dart shift right to the JavaScript one under certain conditions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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
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 HVisitor<R> { 7 abstract class HVisitor<R> {
8 R visitAdd(HAdd node); 8 R visitAdd(HAdd node);
9 R visitBitAnd(HBitAnd node); 9 R visitBitAnd(HBitAnd node);
10 R visitBitNot(HBitNot node); 10 R visitBitNot(HBitNot node);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 R visitLoopBranch(HLoopBranch node); 48 R visitLoopBranch(HLoopBranch node);
49 R visitMultiply(HMultiply node); 49 R visitMultiply(HMultiply node);
50 R visitNegate(HNegate node); 50 R visitNegate(HNegate node);
51 R visitNot(HNot node); 51 R visitNot(HNot node);
52 R visitOneShotInterceptor(HOneShotInterceptor node); 52 R visitOneShotInterceptor(HOneShotInterceptor node);
53 R visitParameterValue(HParameterValue node); 53 R visitParameterValue(HParameterValue node);
54 R visitPhi(HPhi node); 54 R visitPhi(HPhi node);
55 R visitRangeConversion(HRangeConversion node); 55 R visitRangeConversion(HRangeConversion node);
56 R visitReturn(HReturn node); 56 R visitReturn(HReturn node);
57 R visitShiftLeft(HShiftLeft node); 57 R visitShiftLeft(HShiftLeft node);
58 R visitShiftRight(HShiftRight node);
58 R visitStatic(HStatic node); 59 R visitStatic(HStatic node);
59 R visitStaticStore(HStaticStore node); 60 R visitStaticStore(HStaticStore node);
60 R visitStringConcat(HStringConcat node); 61 R visitStringConcat(HStringConcat node);
61 R visitStringify(HStringify node); 62 R visitStringify(HStringify node);
62 R visitSubtract(HSubtract node); 63 R visitSubtract(HSubtract node);
63 R visitSwitch(HSwitch node); 64 R visitSwitch(HSwitch node);
64 R visitThis(HThis node); 65 R visitThis(HThis node);
65 R visitThrow(HThrow node); 66 R visitThrow(HThrow node);
66 R visitThrowExpression(HThrowExpression node); 67 R visitThrowExpression(HThrowExpression node);
67 R visitTry(HTry node); 68 R visitTry(HTry node);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 visitNegate(HNegate node) => visitInvokeUnary(node); 330 visitNegate(HNegate node) => visitInvokeUnary(node);
330 visitNot(HNot node) => visitInstruction(node); 331 visitNot(HNot node) => visitInstruction(node);
331 visitOneShotInterceptor(HOneShotInterceptor node) 332 visitOneShotInterceptor(HOneShotInterceptor node)
332 => visitInvokeDynamic(node); 333 => visitInvokeDynamic(node);
333 visitPhi(HPhi node) => visitInstruction(node); 334 visitPhi(HPhi node) => visitInstruction(node);
334 visitMultiply(HMultiply node) => visitBinaryArithmetic(node); 335 visitMultiply(HMultiply node) => visitBinaryArithmetic(node);
335 visitParameterValue(HParameterValue node) => visitLocalValue(node); 336 visitParameterValue(HParameterValue node) => visitLocalValue(node);
336 visitRangeConversion(HRangeConversion node) => visitCheck(node); 337 visitRangeConversion(HRangeConversion node) => visitCheck(node);
337 visitReturn(HReturn node) => visitControlFlow(node); 338 visitReturn(HReturn node) => visitControlFlow(node);
338 visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node); 339 visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node);
340 visitShiftRight(HShiftRight node) => visitBinaryBitOp(node);
339 visitSubtract(HSubtract node) => visitBinaryArithmetic(node); 341 visitSubtract(HSubtract node) => visitBinaryArithmetic(node);
340 visitSwitch(HSwitch node) => visitControlFlow(node); 342 visitSwitch(HSwitch node) => visitControlFlow(node);
341 visitStatic(HStatic node) => visitInstruction(node); 343 visitStatic(HStatic node) => visitInstruction(node);
342 visitStaticStore(HStaticStore node) => visitInstruction(node); 344 visitStaticStore(HStaticStore node) => visitInstruction(node);
343 visitStringConcat(HStringConcat node) => visitInstruction(node); 345 visitStringConcat(HStringConcat node) => visitInstruction(node);
344 visitStringify(HStringify node) => visitInstruction(node); 346 visitStringify(HStringify node) => visitInstruction(node);
345 visitThis(HThis node) => visitParameterValue(node); 347 visitThis(HThis node) => visitParameterValue(node);
346 visitThrow(HThrow node) => visitControlFlow(node); 348 visitThrow(HThrow node) => visitControlFlow(node);
347 visitThrowExpression(HThrowExpression node) => visitInstruction(node); 349 visitThrowExpression(HThrowExpression node) => visitInstruction(node);
348 visitTry(HTry node) => visitControlFlow(node); 350 visitTry(HTry node) => visitControlFlow(node);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 static const int LESS_EQUAL_TYPECODE = 20; 796 static const int LESS_EQUAL_TYPECODE = 20;
795 static const int STATIC_TYPECODE = 21; 797 static const int STATIC_TYPECODE = 21;
796 static const int STATIC_STORE_TYPECODE = 22; 798 static const int STATIC_STORE_TYPECODE = 22;
797 static const int FIELD_GET_TYPECODE = 23; 799 static const int FIELD_GET_TYPECODE = 23;
798 static const int TYPE_CONVERSION_TYPECODE = 24; 800 static const int TYPE_CONVERSION_TYPECODE = 24;
799 static const int TYPE_KNOWN_TYPECODE = 25; 801 static const int TYPE_KNOWN_TYPECODE = 25;
800 static const int INVOKE_STATIC_TYPECODE = 26; 802 static const int INVOKE_STATIC_TYPECODE = 26;
801 static const int INDEX_TYPECODE = 27; 803 static const int INDEX_TYPECODE = 27;
802 static const int IS_TYPECODE = 28; 804 static const int IS_TYPECODE = 28;
803 static const int INVOKE_DYNAMIC_TYPECODE = 29; 805 static const int INVOKE_DYNAMIC_TYPECODE = 29;
806 static const int SHIFT_RIGHT_TYPECODE = 30;
804 807
805 HInstruction(this.inputs, this.instructionType) 808 HInstruction(this.inputs, this.instructionType)
806 : id = idCounter++, usedBy = <HInstruction>[] { 809 : id = idCounter++, usedBy = <HInstruction>[] {
807 assert(inputs.every((e) => e != null)); 810 assert(inputs.every((e) => e != null));
808 } 811 }
809 812
810 int get hashCode => id; 813 int get hashCode => id;
811 814
812 bool useGvn() => _useGvn; 815 bool useGvn() => _useGvn;
813 void setUseGvn() { _useGvn = true; } 816 void setUseGvn() { _useGvn = true; }
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 HShiftLeft(left, right, selector, type) : super(left, right, selector, type); 1723 HShiftLeft(left, right, selector, type) : super(left, right, selector, type);
1721 accept(HVisitor visitor) => visitor.visitShiftLeft(this); 1724 accept(HVisitor visitor) => visitor.visitShiftLeft(this);
1722 1725
1723 BinaryOperation operation(ConstantSystem constantSystem) 1726 BinaryOperation operation(ConstantSystem constantSystem)
1724 => constantSystem.shiftLeft; 1727 => constantSystem.shiftLeft;
1725 int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE; 1728 int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE;
1726 bool typeEquals(other) => other is HShiftLeft; 1729 bool typeEquals(other) => other is HShiftLeft;
1727 bool dataEquals(HInstruction other) => true; 1730 bool dataEquals(HInstruction other) => true;
1728 } 1731 }
1729 1732
1733 class HShiftRight extends HBinaryBitOp {
1734 HShiftRight(left, right, selector, type) : super(left, right, selector, type);
1735 accept(HVisitor visitor) => visitor.visitShiftRight(this);
1736
1737 BinaryOperation operation(ConstantSystem constantSystem)
1738 => constantSystem.shiftRight;
1739 int typeCode() => HInstruction.SHIFT_RIGHT_TYPECODE;
1740 bool typeEquals(other) => other is HShiftRight;
1741 bool dataEquals(HInstruction other) => true;
1742 }
1743
1730 class HBitOr extends HBinaryBitOp { 1744 class HBitOr extends HBinaryBitOp {
1731 HBitOr(left, right, selector, type) : super(left, right, selector, type); 1745 HBitOr(left, right, selector, type) : super(left, right, selector, type);
1732 accept(HVisitor visitor) => visitor.visitBitOr(this); 1746 accept(HVisitor visitor) => visitor.visitBitOr(this);
1733 1747
1734 BinaryOperation operation(ConstantSystem constantSystem) 1748 BinaryOperation operation(ConstantSystem constantSystem)
1735 => constantSystem.bitOr; 1749 => constantSystem.bitOr;
1736 int typeCode() => HInstruction.BIT_OR_TYPECODE; 1750 int typeCode() => HInstruction.BIT_OR_TYPECODE;
1737 bool typeEquals(other) => other is HBitOr; 1751 bool typeEquals(other) => other is HBitOr;
1738 bool dataEquals(HInstruction other) => true; 1752 bool dataEquals(HInstruction other) => true;
1739 } 1753 }
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2824 HBasicBlock get start => expression.start; 2838 HBasicBlock get start => expression.start;
2825 HBasicBlock get end { 2839 HBasicBlock get end {
2826 // We don't create a switch block if there are no cases. 2840 // We don't create a switch block if there are no cases.
2827 assert(!statements.isEmpty); 2841 assert(!statements.isEmpty);
2828 return statements.last.end; 2842 return statements.last.end;
2829 } 2843 }
2830 2844
2831 bool accept(HStatementInformationVisitor visitor) => 2845 bool accept(HStatementInformationVisitor visitor) =>
2832 visitor.visitSwitchInfo(this); 2846 visitor.visitSwitchInfo(this);
2833 } 2847 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698