Chromium Code Reviews| 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 802 // the emitter. | 802 // the emitter. |
| 803 List<HInstruction> constructorArguments = <HInstruction>[]; | 803 List<HInstruction> constructorArguments = <HInstruction>[]; |
| 804 ClassElement element = classElement; | 804 ClassElement element = classElement; |
| 805 while (element != null) { | 805 while (element != null) { |
| 806 for (Element member in element.members) { | 806 for (Element member in element.members) { |
| 807 if (member.isInstanceMember() && member.kind == ElementKind.FIELD) { | 807 if (member.isInstanceMember() && member.kind == ElementKind.FIELD) { |
| 808 HInstruction value; | 808 HInstruction value; |
| 809 if (localsHandler.hasValueForDirectLocal(member)) { | 809 if (localsHandler.hasValueForDirectLocal(member)) { |
| 810 value = localsHandler.readLocal(member); | 810 value = localsHandler.readLocal(member); |
| 811 } else { | 811 } else { |
| 812 // TODO(karlklose): get default value. | 812 var fieldValue = |
| 813 value = graph.addNewLiteralNull(); | 813 compiler.compileTimeConstantHandler.compileVariable(member); |
| 814 // TODO(floitsch): this constant should be treated like all | |
| 815 // other constants and should be at the top of the graph. | |
|
ngeoffray
2012/02/28 09:48:26
Why can't you do it?
floitsch
2012/02/28 10:19:01
We could, but it would be tedious and I'm about to
| |
| 816 value = new HLiteral.internal(fieldValue, HType.UNKNOWN); | |
| 817 add(value); | |
| 814 } | 818 } |
| 815 constructorArguments.add(value); | 819 constructorArguments.add(value); |
| 816 } | 820 } |
| 817 } | 821 } |
| 818 element = element.superclass; | 822 element = element.superclass; |
| 819 } | 823 } |
| 820 HForeignNew newObject = new HForeignNew(classElement, constructorArguments); | 824 HForeignNew newObject = new HForeignNew(classElement, constructorArguments); |
| 821 add(newObject); | 825 add(newObject); |
| 822 // Generate calls to the constructor bodies. | 826 // Generate calls to the constructor bodies. |
| 823 for (int index = constructors.length - 1; index >= 0; index--) { | 827 for (int index = constructors.length - 1; index >= 0; index--) { |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2274 } | 2278 } |
| 2275 | 2279 |
| 2276 visitCatchBlock(CatchBlock node) { | 2280 visitCatchBlock(CatchBlock node) { |
| 2277 visit(node.block); | 2281 visit(node.block); |
| 2278 } | 2282 } |
| 2279 | 2283 |
| 2280 visitTypedef(Typedef node) { | 2284 visitTypedef(Typedef node) { |
| 2281 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 2285 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 2282 } | 2286 } |
| 2283 } | 2287 } |
| OLD | NEW |