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

Side by Side Diff: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // SExpressionUnstringifier implements the inverse operation to 5 // SExpressionUnstringifier implements the inverse operation to
6 // [SExpressionStringifier]. 6 // [SExpressionStringifier].
7 7
8 library sexpr_unstringifier; 8 library sexpr_unstringifier;
9 9
10 import 'package:compiler/src/constants/expressions.dart'; 10 import 'package:compiler/src/constants/expressions.dart';
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 // Primitives 143 // Primitives
144 static const String CONSTANT = "Constant"; 144 static const String CONSTANT = "Constant";
145 static const String CREATE_FUNCTION = "CreateFunction"; 145 static const String CREATE_FUNCTION = "CreateFunction";
146 static const String GET_MUTABLE_VARIABLE = "GetMutableVariable"; 146 static const String GET_MUTABLE_VARIABLE = "GetMutableVariable";
147 static const String LITERAL_LIST = "LiteralList"; 147 static const String LITERAL_LIST = "LiteralList";
148 static const String LITERAL_MAP = "LiteralMap"; 148 static const String LITERAL_MAP = "LiteralMap";
149 static const String REIFY_TYPE_VAR = "ReifyTypeVar"; 149 static const String REIFY_TYPE_VAR = "ReifyTypeVar";
150 static const String GET_STATIC = "GetStatic"; 150 static const String GET_STATIC = "GetStatic";
151 static const String TYPE_TEST = "TypeTest"; 151 static const String TYPE_TEST = "TypeTest";
152 static const String APPLY_BUILTIN_OPERATOR = "ApplyBuiltinOperator";
152 153
153 // Other 154 // Other
154 static const String FUNCTION_DEFINITION = "FunctionDefinition"; 155 static const String FUNCTION_DEFINITION = "FunctionDefinition";
155 static const String IS_TRUE = "IsTrue"; 156 static const String IS_TRUE = "IsTrue";
156 157
157 // Constants 158 // Constants
158 static const String BOOL = "Bool"; 159 static const String BOOL = "Bool";
159 static const String DOUBLE = "Double"; 160 static const String DOUBLE = "Double";
160 static const String INT = "Int"; 161 static const String INT = "Int";
161 static const String NULL = "Null"; 162 static const String NULL = "Null";
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 assert(value != null); 584 assert(value != null);
584 585
585 dart_types.DartType type = new DummyNamedType(tokens.read()); 586 dart_types.DartType type = new DummyNamedType(tokens.read());
586 587
587 List<ir.Primitive> typeArguments = parsePrimitiveList(); 588 List<ir.Primitive> typeArguments = parsePrimitiveList();
588 589
589 tokens.consumeEnd(); 590 tokens.consumeEnd();
590 return new TypeTest(value, type, typeArguments); 591 return new TypeTest(value, type, typeArguments);
591 } 592 }
592 593
594 /// (ApplyBuiltinOperator operator args)
595 ApplyBuiltinOperator parseApplyBuiltinOperator() {
596 tokens.consumeStart(APPLY_BUILTIN_OPERATOR);
597
598 String operatorName = tokens.read();
599 BuiltinOperator operator;
600 for (BuiltinOperator op in BuiltinOperator.values) {
601 if (op.toString() == operatorName) {
602 operator = op;
603 break;
604 }
605 }
606 assert(operator != null);
607 List<ir.Primitive> arguments = parsePrimitiveList();
608
609 tokens.consumeEnd();
610 return new ApplyBuiltinOperator(operator, arguments);
611 }
612
593 /// (SetStatic field value body) 613 /// (SetStatic field value body)
594 SetStatic parseSetStatic() { 614 SetStatic parseSetStatic() {
595 tokens.consumeStart(SET_STATIC); 615 tokens.consumeStart(SET_STATIC);
596 616
597 Element fieldElement = new DummyElement(tokens.read()); 617 Element fieldElement = new DummyElement(tokens.read());
598 Primitive value = name2variable[tokens.read()]; 618 Primitive value = name2variable[tokens.read()];
599 assert(value != null); 619 assert(value != null);
600 Expression body = parseExpression(); 620 Expression body = parseExpression();
601 621
602 tokens.consumeEnd(); 622 tokens.consumeEnd();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 case LITERAL_LIST: 675 case LITERAL_LIST:
656 return parseLiteralList(); 676 return parseLiteralList();
657 case LITERAL_MAP: 677 case LITERAL_MAP:
658 return parseLiteralMap(); 678 return parseLiteralMap();
659 case REIFY_TYPE_VAR: 679 case REIFY_TYPE_VAR:
660 return parseReifyTypeVar(); 680 return parseReifyTypeVar();
661 case GET_STATIC: 681 case GET_STATIC:
662 return parseGetStatic(); 682 return parseGetStatic();
663 case TYPE_TEST: 683 case TYPE_TEST:
664 return parseTypeTest(); 684 return parseTypeTest();
685 case APPLY_BUILTIN_OPERATOR:
686 return parseApplyBuiltinOperator();
665 default: 687 default:
666 assert(false); 688 assert(false);
667 } 689 }
668 690
669 return null; 691 return null;
670 } 692 }
671 693
672 /// (Constant (constant)) 694 /// (Constant (constant))
673 Constant parseConstant() { 695 Constant parseConstant() {
674 tokens.consumeStart(CONSTANT); 696 tokens.consumeStart(CONSTANT);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 /// (GetStatic field) 813 /// (GetStatic field)
792 GetStatic parseGetStatic() { 814 GetStatic parseGetStatic() {
793 tokens.consumeStart(GET_STATIC); 815 tokens.consumeStart(GET_STATIC);
794 816
795 Element field = new DummyElement(tokens.read()); 817 Element field = new DummyElement(tokens.read());
796 818
797 tokens.consumeEnd(); 819 tokens.consumeEnd();
798 return new GetStatic(field, null); 820 return new GetStatic(field, null);
799 } 821 }
800 } 822 }
OLDNEW
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698