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

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

Issue 9618053: Introduce the TYPEDEF element, and use it in order to catch passing closures to the DOM. I make the… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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/ssa/builder.dart ('k') | frog/tests/native/src/NativeWrappingFunctionFrogTest.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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 String generate(WorkItem work, HGraph graph) { 9 String generate(WorkItem work, HGraph graph) {
10 return measure(() { 10 return measure(() {
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 } 927 }
928 928
929 void checkArray(HInstruction input, String cmp) { 929 void checkArray(HInstruction input, String cmp) {
930 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE); 930 beginExpression(JSPrecedence.EQUALITY_PRECEDENCE);
931 use(input, JSPrecedence.MEMBER_PRECEDENCE); 931 use(input, JSPrecedence.MEMBER_PRECEDENCE);
932 buffer.add('.constructor $cmp Array'); 932 buffer.add('.constructor $cmp Array');
933 endExpression(JSPrecedence.EQUALITY_PRECEDENCE); 933 endExpression(JSPrecedence.EQUALITY_PRECEDENCE);
934 } 934 }
935 935
936 void visitIs(HIs node) { 936 void visitIs(HIs node) {
937 ClassElement element = node.typeExpression; 937 Element element = node.typeExpression;
938 LibraryElement coreLibrary = compiler.coreLibrary; 938 LibraryElement coreLibrary = compiler.coreLibrary;
939 ClassElement objectClass = coreLibrary.find(const SourceString('Object')); 939 ClassElement objectClass = coreLibrary.find(const SourceString('Object'));
940 HInstruction input = node.expression; 940 HInstruction input = node.expression;
941 if (node.nullOk) { 941 if (node.nullOk) {
942 use(input, JSPrecedence.EQUALITY_PRECEDENCE); 942 use(input, JSPrecedence.EQUALITY_PRECEDENCE);
943 buffer.add(' === (void 0) || ('); 943 buffer.add(' === (void 0) || (');
944 } 944 }
945 if (element == objectClass) { 945 if (element == objectClass) {
946 // TODO(ahe): This probably belongs in the constant folder. 946 // TODO(ahe): This probably belongs in the constant folder.
947 buffer.add('true'); 947 buffer.add('true');
(...skipping 21 matching lines...) Expand all
969 buffer.add(' && '); 969 buffer.add(' && ');
970 int precedence = JSPrecedence.PREFIX_PRECEDENCE; 970 int precedence = JSPrecedence.PREFIX_PRECEDENCE;
971 bool endParen = false; 971 bool endParen = false;
972 if (isListOrSupertype(element)) { 972 if (isListOrSupertype(element)) {
973 buffer.add("("); 973 buffer.add("(");
974 endParen = true; 974 endParen = true;
975 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE); 975 beginExpression(JSPrecedence.LOGICAL_OR_PRECEDENCE);
976 checkArray(input, '==='); 976 checkArray(input, '===');
977 buffer.add(' || '); 977 buffer.add(' || ');
978 precedence = JSPrecedence.LOGICAL_OR_PRECEDENCE; 978 precedence = JSPrecedence.LOGICAL_OR_PRECEDENCE;
979 } else if (element.isNative() || isSupertypeOfNativeClass(element)) { 979 } else if (element.isClass() && (element.dynamic.isNative()
980 || isSupertypeOfNativeClass(element))) {
980 buffer.add("("); 981 buffer.add("(");
981 endParen = true; 982 endParen = true;
982 } else { 983 } else {
983 beginExpression(precedence); 984 beginExpression(precedence);
984 } 985 }
985 buffer.add('!!'); 986 buffer.add('!!');
986 use(input, JSPrecedence.MEMBER_PRECEDENCE); 987 use(input, JSPrecedence.MEMBER_PRECEDENCE);
987 buffer.add('.'); 988 buffer.add('.');
988 buffer.add(compiler.namer.operatorIs(node.typeExpression)); 989 buffer.add(compiler.namer.operatorIs(node.typeExpression));
989 if (element.isNative() || isSupertypeOfNativeClass(element)) { 990 if (element.isNative() || isSupertypeOfNativeClass(element)) {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 startBailoutSwitch(); 1392 startBailoutSwitch();
1392 } 1393 }
1393 } 1394 }
1394 1395
1395 void endElse(HIf node) { 1396 void endElse(HIf node) {
1396 if (node.elseBlock.hasBailouts()) { 1397 if (node.elseBlock.hasBailouts()) {
1397 endBailoutSwitch(); 1398 endBailoutSwitch();
1398 } 1399 }
1399 } 1400 }
1400 } 1401 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | frog/tests/native/src/NativeWrappingFunctionFrogTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698