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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1175973005: dart2js cps: Introduce some built-in operators in type propagation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Status files Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closurelib; 7 import '../closure.dart' as closurelib;
8 import '../closure.dart' hide ClosureScope; 8 import '../closure.dart' hide ClosureScope;
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 755
756 @override 756 @override
757 ir.Primitive visitIsNot(ast.Send node, 757 ir.Primitive visitIsNot(ast.Send node,
758 ast.Node expression, DartType type, _) { 758 ast.Node expression, DartType type, _) {
759 ir.Primitive value = visit(expression); 759 ir.Primitive value = visit(expression);
760 ir.Primitive check = irBuilder.buildTypeOperator( 760 ir.Primitive check = irBuilder.buildTypeOperator(
761 value, type, isTypeTest: true); 761 value, type, isTypeTest: true);
762 return irBuilder.buildNegation(check); 762 return irBuilder.buildNegation(check);
763 } 763 }
764 764
765 ir.Primitive translateBinary(ast.Node left, 765 ir.Primitive translateBinary(ast.Send node,
766 ast.Node left,
766 op.BinaryOperator operator, 767 op.BinaryOperator operator,
767 ast.Node right) { 768 ast.Node right) {
768 Selector selector = new Selector.binaryOperator(operator.selectorName); 769 Selector selector = useSelectorTypeOfNode(
770 new Selector.binaryOperator(operator.selectorName),
771 node);
769 ir.Primitive receiver = visit(left); 772 ir.Primitive receiver = visit(left);
770 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)]; 773 List<ir.Primitive> arguments = <ir.Primitive>[visit(right)];
771 arguments = normalizeDynamicArguments(selector.callStructure, arguments); 774 arguments = normalizeDynamicArguments(selector.callStructure, arguments);
772 return irBuilder.buildDynamicInvocation(receiver, selector, arguments); 775 return irBuilder.buildDynamicInvocation(receiver, selector, arguments);
773 } 776 }
774 777
775 @override 778 @override
776 ir.Primitive visitBinary(ast.Send node, 779 ir.Primitive visitBinary(ast.Send node,
777 ast.Node left, 780 ast.Node left,
778 op.BinaryOperator operator, 781 op.BinaryOperator operator,
779 ast.Node right, _) { 782 ast.Node right, _) {
780 return translateBinary(left, operator, right); 783 return translateBinary(node, left, operator, right);
781 } 784 }
782 785
783 @override 786 @override
784 ir.Primitive visitIndex(ast.Send node, 787 ir.Primitive visitIndex(ast.Send node,
785 ast.Node receiver, 788 ast.Node receiver,
786 ast.Node index, _) { 789 ast.Node index, _) {
787 Selector selector = new Selector.index(); 790 Selector selector = useSelectorTypeOfNode(new Selector.index(), node);
788 ir.Primitive target = visit(receiver); 791 ir.Primitive target = visit(receiver);
789 List<ir.Primitive> arguments = <ir.Primitive>[visit(index)]; 792 List<ir.Primitive> arguments = <ir.Primitive>[visit(index)];
790 arguments = normalizeDynamicArguments(selector.callStructure, arguments); 793 arguments = normalizeDynamicArguments(selector.callStructure, arguments);
791 return irBuilder.buildDynamicInvocation(target, selector, arguments); 794 return irBuilder.buildDynamicInvocation(target, selector, arguments);
792 } 795 }
793 796
794 ir.Primitive translateSuperBinary(FunctionElement function, 797 ir.Primitive translateSuperBinary(FunctionElement function,
795 op.BinaryOperator operator, 798 op.BinaryOperator operator,
796 ast.Node argument) { 799 ast.Node argument) {
797 CallStructure callStructure = CallStructure.ONE_ARG; 800 CallStructure callStructure = CallStructure.ONE_ARG;
(...skipping 21 matching lines...) Expand all
819 _) { 822 _) {
820 return irBuilder.buildSuperIndex(function, visit(index)); 823 return irBuilder.buildSuperIndex(function, visit(index));
821 } 824 }
822 825
823 @override 826 @override
824 ir.Primitive visitEquals( 827 ir.Primitive visitEquals(
825 ast.Send node, 828 ast.Send node,
826 ast.Node left, 829 ast.Node left,
827 ast.Node right, 830 ast.Node right,
828 _) { 831 _) {
829 return translateBinary(left, op.BinaryOperator.EQ, right); 832 return translateBinary(node, left, op.BinaryOperator.EQ, right);
830 } 833 }
831 834
832 @override 835 @override
833 ir.Primitive visitSuperEquals( 836 ir.Primitive visitSuperEquals(
834 ast.Send node, 837 ast.Send node,
835 FunctionElement function, 838 FunctionElement function,
836 ast.Node argument, 839 ast.Node argument,
837 _) { 840 _) {
838 return translateSuperBinary(function, op.BinaryOperator.EQ, argument); 841 return translateSuperBinary(function, op.BinaryOperator.EQ, argument);
839 } 842 }
840 843
841 @override 844 @override
842 ir.Primitive visitNot( 845 ir.Primitive visitNot(
843 ast.Send node, 846 ast.Send node,
844 ast.Node expression, 847 ast.Node expression,
845 _) { 848 _) {
846 return irBuilder.buildNegation(visit(expression)); 849 return irBuilder.buildNegation(visit(expression));
847 } 850 }
848 851
849 @override 852 @override
850 ir.Primitive visitNotEquals( 853 ir.Primitive visitNotEquals(
851 ast.Send node, 854 ast.Send node,
852 ast.Node left, 855 ast.Node left,
853 ast.Node right, 856 ast.Node right,
854 _) { 857 _) {
855 return irBuilder.buildNegation( 858 return irBuilder.buildNegation(
856 translateBinary(left, op.BinaryOperator.NOT_EQ, right)); 859 translateBinary(node, left, op.BinaryOperator.NOT_EQ, right));
857 } 860 }
858 861
859 @override 862 @override
860 ir.Primitive visitSuperNotEquals( 863 ir.Primitive visitSuperNotEquals(
861 ast.Send node, 864 ast.Send node,
862 FunctionElement function, 865 FunctionElement function,
863 ast.Node argument, 866 ast.Node argument,
864 _) { 867 _) {
865 return irBuilder.buildNegation( 868 return irBuilder.buildNegation(
866 translateSuperBinary(function, op.BinaryOperator.NOT_EQ, argument)); 869 translateSuperBinary(function, op.BinaryOperator.NOT_EQ, argument));
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 } 2860 }
2858 2861
2859 processSetStatic(ir.SetStatic node) { 2862 processSetStatic(ir.SetStatic node) {
2860 node.body = replacementFor(node.body); 2863 node.body = replacementFor(node.body);
2861 } 2864 }
2862 2865
2863 processContinuation(ir.Continuation node) { 2866 processContinuation(ir.Continuation node) {
2864 node.body = replacementFor(node.body); 2867 node.body = replacementFor(node.body);
2865 } 2868 }
2866 } 2869 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/builtin_operator.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698