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

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

Issue 60293003: Version 0.8.10.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 visitLogicalAndOr(node, op); 2905 visitLogicalAndOr(node, op);
2906 } else if ("!" == op.source) { 2906 } else if ("!" == op.source) {
2907 visitLogicalNot(node); 2907 visitLogicalNot(node);
2908 } else if (node.argumentsNode is Prefix) { 2908 } else if (node.argumentsNode is Prefix) {
2909 visitUnary(node, op); 2909 visitUnary(node, op);
2910 } else if ("is" == op.source) { 2910 } else if ("is" == op.source) {
2911 visitIsSend(node); 2911 visitIsSend(node);
2912 } else if ("as" == op.source) { 2912 } else if ("as" == op.source) {
2913 visit(node.receiver); 2913 visit(node.receiver);
2914 HInstruction expression = pop(); 2914 HInstruction expression = pop();
2915 Node argument = node.arguments.head; 2915 DartType type = elements.getType(node.typeAnnotationFromIsCheckOrCast);
2916 TypeAnnotation typeAnnotation = argument.asTypeAnnotation(); 2916 if (type.kind == TypeKind.MALFORMED_TYPE) {
2917 DartType type = elements.getType(typeAnnotation); 2917 ErroneousElement element = type.element;
2918 HInstruction converted = buildTypeConversion( 2918 generateTypeError(node, element.message);
2919 expression, type, HTypeConversion.CAST_TYPE_CHECK); 2919 } else {
2920 if (converted != expression) add(converted); 2920 HInstruction converted = buildTypeConversion(
2921 stack.add(converted); 2921 expression, type, HTypeConversion.CAST_TYPE_CHECK);
2922 if (converted != expression) add(converted);
2923 stack.add(converted);
2924 }
2922 } else { 2925 } else {
2923 visit(node.receiver); 2926 visit(node.receiver);
2924 visit(node.argumentsNode); 2927 visit(node.argumentsNode);
2925 var right = pop(); 2928 var right = pop();
2926 var left = pop(); 2929 var left = pop();
2927 visitBinary(left, op, right, elements.getSelector(node), node); 2930 visitBinary(left, op, right, elements.getSelector(node), node);
2928 } 2931 }
2929 } 2932 }
2930 2933
2931 void visitIsSend(Send node) { 2934 void visitIsSend(Send node) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 HInstruction asFieldName = compiler.world.hasAnySubtype(element) 3019 HInstruction asFieldName = compiler.world.hasAnySubtype(element)
3017 ? addConstantString(node, backend.namer.substitutionName(element)) 3020 ? addConstantString(node, backend.namer.substitutionName(element))
3018 : graph.addConstantNull(compiler); 3021 : graph.addConstantNull(compiler);
3019 List<HInstruction> inputs = <HInstruction>[expression, 3022 List<HInstruction> inputs = <HInstruction>[expression,
3020 isFieldName, 3023 isFieldName,
3021 representations, 3024 representations,
3022 asFieldName]; 3025 asFieldName];
3023 pushInvokeStatic(node, helper, inputs, backend.boolType); 3026 pushInvokeStatic(node, helper, inputs, backend.boolType);
3024 HInstruction call = pop(); 3027 HInstruction call = pop();
3025 return new HIs.compound(type, expression, call, backend.boolType); 3028 return new HIs.compound(type, expression, call, backend.boolType);
3029 } else if (type.kind == TypeKind.MALFORMED_TYPE) {
3030 ErroneousElement element = type.element;
3031 generateTypeError(node, element.message);
3032 HInstruction call = pop();
3033 return new HIs.compound(type, expression, call, backend.boolType);
3026 } else { 3034 } else {
3027 if (backend.hasDirectCheckFor(type)) { 3035 if (backend.hasDirectCheckFor(type)) {
3028 return new HIs.direct(type, expression, backend.boolType); 3036 return new HIs.direct(type, expression, backend.boolType);
3029 } 3037 }
3030 // TODO(johnniwinther): Avoid interceptor if unneeded. 3038 // TODO(johnniwinther): Avoid interceptor if unneeded.
3031 return new HIs.raw( 3039 return new HIs.raw(
3032 type, expression, invokeInterceptor(expression), backend.boolType); 3040 type, expression, invokeInterceptor(expression), backend.boolType);
3033 } 3041 }
3034 } 3042 }
3035 3043
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
4164 } 4172 }
4165 } 4173 }
4166 4174
4167 HInstruction buildInvokeSuper(Selector selector, 4175 HInstruction buildInvokeSuper(Selector selector,
4168 Element element, 4176 Element element,
4169 List<HInstruction> arguments) { 4177 List<HInstruction> arguments) {
4170 HInstruction receiver = localsHandler.readThis(); 4178 HInstruction receiver = localsHandler.readThis();
4171 // TODO(5346): Try to avoid the need for calling [declaration] before 4179 // TODO(5346): Try to avoid the need for calling [declaration] before
4172 // creating an [HStatic]. 4180 // creating an [HStatic].
4173 List<HInstruction> inputs = <HInstruction>[]; 4181 List<HInstruction> inputs = <HInstruction>[];
4174 if (backend.isInterceptedSelector(selector)) { 4182 if (backend.isInterceptedSelector(selector) &&
4183 // Fields don't need an interceptor; consider generating HFieldGet/Set
4184 // instead.
4185 element.kind != ElementKind.FIELD) {
4175 inputs.add(invokeInterceptor(receiver)); 4186 inputs.add(invokeInterceptor(receiver));
4176 } 4187 }
4177 inputs.add(receiver); 4188 inputs.add(receiver);
4178 inputs.addAll(arguments); 4189 inputs.addAll(arguments);
4179 TypeMask type; 4190 TypeMask type;
4180 if (!element.isGetter() && selector.isGetter()) { 4191 if (!element.isGetter() && selector.isGetter()) {
4181 type = TypeMaskFactory.inferredTypeForElement(element, compiler); 4192 type = TypeMaskFactory.inferredTypeForElement(element, compiler);
4182 } else { 4193 } else {
4183 type = TypeMaskFactory.inferredReturnTypeForElement(element, compiler); 4194 type = TypeMaskFactory.inferredReturnTypeForElement(element, compiler);
4184 } 4195 }
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
5760 new HSubGraphBlockInformation(elseBranch.graph)); 5771 new HSubGraphBlockInformation(elseBranch.graph));
5761 5772
5762 HBasicBlock conditionStartBlock = conditionBranch.block; 5773 HBasicBlock conditionStartBlock = conditionBranch.block;
5763 conditionStartBlock.setBlockFlow(info, joinBlock); 5774 conditionStartBlock.setBlockFlow(info, joinBlock);
5764 SubGraph conditionGraph = conditionBranch.graph; 5775 SubGraph conditionGraph = conditionBranch.graph;
5765 HIf branch = conditionGraph.end.last; 5776 HIf branch = conditionGraph.end.last;
5766 assert(branch is HIf); 5777 assert(branch is HIf);
5767 branch.blockInformation = conditionStartBlock.blockFlow; 5778 branch.blockInformation = conditionStartBlock.blockFlow;
5768 } 5779 }
5769 } 5780 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698