| OLD | NEW |
| 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 Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 3995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4006 } | 4006 } |
| 4007 } | 4007 } |
| 4008 | 4008 |
| 4009 /** | 4009 /** |
| 4010 * Visitor that handles generation of string literals (LiteralString, | 4010 * Visitor that handles generation of string literals (LiteralString, |
| 4011 * StringInterpolation), and otherwise delegates to the given visitor for | 4011 * StringInterpolation), and otherwise delegates to the given visitor for |
| 4012 * non-literal subexpressions. | 4012 * non-literal subexpressions. |
| 4013 * TODO(lrn): Consider whether to handle compile time constant int/boolean | 4013 * TODO(lrn): Consider whether to handle compile time constant int/boolean |
| 4014 * expressions as well. | 4014 * expressions as well. |
| 4015 */ | 4015 */ |
| 4016 class StringBuilderVisitor extends AbstractVisitor { | 4016 class StringBuilderVisitor extends Visitor { |
| 4017 final SsaBuilder builder; | 4017 final SsaBuilder builder; |
| 4018 final Node diagnosticNode; | 4018 final Node diagnosticNode; |
| 4019 | 4019 |
| 4020 /** | 4020 /** |
| 4021 * The string value generated so far. | 4021 * The string value generated so far. |
| 4022 */ | 4022 */ |
| 4023 HInstruction result = null; | 4023 HInstruction result = null; |
| 4024 | 4024 |
| 4025 StringBuilderVisitor(this.builder, this.diagnosticNode); | 4025 StringBuilderVisitor(this.builder, this.diagnosticNode); |
| 4026 | 4026 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4059 HInstruction instruction = new HStringConcat(left, right, diagnosticNode); | 4059 HInstruction instruction = new HStringConcat(left, right, diagnosticNode); |
| 4060 builder.add(instruction); | 4060 builder.add(instruction); |
| 4061 return instruction; | 4061 return instruction; |
| 4062 } | 4062 } |
| 4063 } | 4063 } |
| 4064 | 4064 |
| 4065 /** | 4065 /** |
| 4066 * This class visits the method that is a candidate for inlining and | 4066 * This class visits the method that is a candidate for inlining and |
| 4067 * finds whether it is too difficult to inline. | 4067 * finds whether it is too difficult to inline. |
| 4068 */ | 4068 */ |
| 4069 class InlineWeeder extends AbstractVisitor { | 4069 class InlineWeeder extends Visitor { |
| 4070 final TreeElements elements; | 4070 final TreeElements elements; |
| 4071 bool seenReturn = false; | 4071 bool seenReturn = false; |
| 4072 bool tooDifficult = false; | 4072 bool tooDifficult = false; |
| 4073 | 4073 |
| 4074 InlineWeeder(this.elements); | 4074 InlineWeeder(this.elements); |
| 4075 | 4075 |
| 4076 static bool canBeInlined(FunctionExpression functionExpression, | 4076 static bool canBeInlined(FunctionExpression functionExpression, |
| 4077 TreeElements elements) { | 4077 TreeElements elements) { |
| 4078 InlineWeeder weeder = new InlineWeeder(elements); | 4078 InlineWeeder weeder = new InlineWeeder(elements); |
| 4079 weeder.visit(functionExpression.body); | 4079 weeder.visit(functionExpression.body); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4378 new HSubGraphBlockInformation(elseBranch.graph)); | 4378 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4379 | 4379 |
| 4380 HBasicBlock conditionStartBlock = conditionBranch.block; | 4380 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4381 conditionStartBlock.setBlockFlow(info, joinBlock); | 4381 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4382 SubGraph conditionGraph = conditionBranch.graph; | 4382 SubGraph conditionGraph = conditionBranch.graph; |
| 4383 HIf branch = conditionGraph.end.last; | 4383 HIf branch = conditionGraph.end.last; |
| 4384 assert(branch is HIf); | 4384 assert(branch is HIf); |
| 4385 branch.blockInformation = conditionStartBlock.blockFlow; | 4385 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4386 } | 4386 } |
| 4387 } | 4387 } |
| OLD | NEW |