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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 /// A synthetic local variable only used with the SSA graph. | 7 /// A synthetic local variable only used with the SSA graph. |
8 /// | 8 /// |
9 /// For instance used for holding return value of function or the exception of a | 9 /// For instance used for holding return value of function or the exception of a |
10 /// try-catch statement. | 10 /// try-catch statement. |
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 graph.entry.addBefore(graph.entry.last, parameter); | 1485 graph.entry.addBefore(graph.entry.last, parameter); |
1486 HInstruction value = | 1486 HInstruction value = |
1487 potentiallyCheckType(parameter, field.type); | 1487 potentiallyCheckType(parameter, field.type); |
1488 add(new HFieldSet(field, thisInstruction, value)); | 1488 add(new HFieldSet(field, thisInstruction, value)); |
1489 return closeFunction(); | 1489 return closeFunction(); |
1490 } | 1490 } |
1491 | 1491 |
1492 HGraph buildLazyInitializer(VariableElement variable) { | 1492 HGraph buildLazyInitializer(VariableElement variable) { |
1493 ast.Node node = variable.node; | 1493 ast.Node node = variable.node; |
1494 openFunction(variable, node); | 1494 openFunction(variable, node); |
1495 assert(variable.initializer != null); | 1495 assert(invariant(variable, variable.initializer != null, |
| 1496 message: "Non-constant variable $variable has no initializer.")); |
1496 visit(variable.initializer); | 1497 visit(variable.initializer); |
1497 HInstruction value = pop(); | 1498 HInstruction value = pop(); |
1498 value = potentiallyCheckType(value, variable.type); | 1499 value = potentiallyCheckType(value, variable.type); |
1499 closeAndGotoExit(new HReturn(value)); | 1500 closeAndGotoExit(new HReturn(value)); |
1500 return closeFunction(); | 1501 return closeFunction(); |
1501 } | 1502 } |
1502 | 1503 |
1503 /** | 1504 /** |
1504 * Returns the constructor body associated with the given constructor or | 1505 * Returns the constructor body associated with the given constructor or |
1505 * creates a new constructor body, if none can be found. | 1506 * creates a new constructor body, if none can be found. |
(...skipping 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6569 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6570 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
6570 unaliased.accept(this, builder); | 6571 unaliased.accept(this, builder); |
6571 } | 6572 } |
6572 | 6573 |
6573 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6574 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
6574 JavaScriptBackend backend = builder.compiler.backend; | 6575 JavaScriptBackend backend = builder.compiler.backend; |
6575 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6576 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
6576 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6577 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
6577 } | 6578 } |
6578 } | 6579 } |
OLD | NEW |