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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 1070293004: Use UnaryOperator and BinaryOperator in ConstantSystem. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup Created 5 years, 8 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
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 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 SsaCodeGeneratorTask generator; 8 SsaCodeGeneratorTask generator;
9 SsaBuilderTask builder; 9 SsaBuilderTask builder;
10 SsaOptimizerTask optimizer; 10 SsaOptimizerTask optimizer;
(...skipping 3131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 } 3142 }
3143 3143
3144 void visitUnarySend(ast.Send node, ast.Operator op) { 3144 void visitUnarySend(ast.Send node, ast.Operator op) {
3145 assert(node.argumentsNode is ast.Prefix); 3145 assert(node.argumentsNode is ast.Prefix);
3146 visit(node.receiver); 3146 visit(node.receiver);
3147 assert(!identical(op.token.kind, PLUS_TOKEN)); 3147 assert(!identical(op.token.kind, PLUS_TOKEN));
3148 HInstruction operand = pop(); 3148 HInstruction operand = pop();
3149 3149
3150 // See if we can constant-fold right away. This avoids rewrites later on. 3150 // See if we can constant-fold right away. This avoids rewrites later on.
3151 if (operand is HConstant) { 3151 if (operand is HConstant) {
3152 UnaryOperation operation = constantSystem.lookupUnary(op.source); 3152 UnaryOperation operation = constantSystem.lookupUnary(
3153 UnaryOperator.parse(op.source));
3153 HConstant constant = operand; 3154 HConstant constant = operand;
3154 ConstantValue folded = operation.fold(constant.constant); 3155 ConstantValue folded = operation.fold(constant.constant);
3155 if (folded != null) { 3156 if (folded != null) {
3156 stack.add(graph.addConstant(folded, compiler)); 3157 stack.add(graph.addConstant(folded, compiler));
3157 return; 3158 return;
3158 } 3159 }
3159 } 3160 }
3160 3161
3161 pushInvokeDynamic(node, elements.getSelector(node), [operand]); 3162 pushInvokeDynamic(node, elements.getSelector(node), [operand]);
3162 } 3163 }
(...skipping 3840 matching lines...) Expand 10 before | Expand all | Expand 10 after
7003 if (unaliased is TypedefType) throw 'unable to unalias $type'; 7004 if (unaliased is TypedefType) throw 'unable to unalias $type';
7004 unaliased.accept(this, builder); 7005 unaliased.accept(this, builder);
7005 } 7006 }
7006 7007
7007 void visitDynamicType(DynamicType type, SsaBuilder builder) { 7008 void visitDynamicType(DynamicType type, SsaBuilder builder) {
7008 JavaScriptBackend backend = builder.compiler.backend; 7009 JavaScriptBackend backend = builder.compiler.backend;
7009 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 7010 ClassElement cls = backend.findHelper('DynamicRuntimeType');
7010 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 7011 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
7011 } 7012 }
7012 } 7013 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698