OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'optimizers.dart' show Pass, ParentVisitor; | 5 import 'optimizers.dart' show Pass, ParentVisitor; |
6 | 6 |
7 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../resolution/operators.dart'; | 9 import '../resolution/operators.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 | 1273 |
1274 void visitSetField(SetField node) { | 1274 void visitSetField(SetField node) { |
1275 setReachable(node.body); | 1275 setReachable(node.body); |
1276 } | 1276 } |
1277 | 1277 |
1278 void visitCreateBox(CreateBox node) { | 1278 void visitCreateBox(CreateBox node) { |
1279 setValue(node, nonConstant(typeSystem.nonNullType)); | 1279 setValue(node, nonConstant(typeSystem.nonNullType)); |
1280 } | 1280 } |
1281 | 1281 |
1282 void visitCreateInstance(CreateInstance node) { | 1282 void visitCreateInstance(CreateInstance node) { |
1283 setValue(node, nonConstant(typeSystem.nonNullExact(node.classElement))); | 1283 setValue(node, nonConstant(typeSystem.nonNullExact(node.classElement.declara
tion))); |
1284 } | 1284 } |
1285 | 1285 |
1286 void visitReifyRuntimeType(ReifyRuntimeType node) { | 1286 void visitReifyRuntimeType(ReifyRuntimeType node) { |
1287 setValue(node, nonConstant(typeSystem.typeType)); | 1287 setValue(node, nonConstant(typeSystem.typeType)); |
1288 } | 1288 } |
1289 | 1289 |
1290 void visitReadTypeVariable(ReadTypeVariable node) { | 1290 void visitReadTypeVariable(ReadTypeVariable node) { |
1291 // TODO(karlklose): come up with a type marker for JS entities or switch to | 1291 // TODO(karlklose): come up with a type marker for JS entities or switch to |
1292 // real constants of type [Type]. | 1292 // real constants of type [Type]. |
1293 setValue(node, nonConstant()); | 1293 setValue(node, nonConstant()); |
1294 } | 1294 } |
1295 | 1295 |
1296 @override | 1296 @override |
1297 visitTypeExpression(TypeExpression node) { | 1297 visitTypeExpression(TypeExpression node) { |
1298 // TODO(karlklose): come up with a type marker for JS entities or switch to | 1298 // TODO(karlklose): come up with a type marker for JS entities or switch to |
1299 // real constants of type [Type]. | 1299 // real constants of type [Type]. |
1300 setValue(node, nonConstant()); | 1300 setValue(node, nonConstant()); |
1301 } | 1301 } |
1302 | 1302 |
1303 void visitCreateInvocationMirror(CreateInvocationMirror node) { | 1303 void visitCreateInvocationMirror(CreateInvocationMirror node) { |
1304 // TODO(asgerf): Expose [Invocation] type. | 1304 // TODO(asgerf): Expose [Invocation] type. |
1305 setValue(node, nonConstant(typeSystem.nonNullType)); | 1305 setValue(node, nonConstant(typeSystem.nonNullType)); |
1306 } | 1306 } |
| 1307 |
| 1308 @override |
| 1309 visitForeignCode(ForeignCode node) { |
| 1310 if (node.continuation != null) { |
| 1311 Continuation continuation = node.continuation.definition; |
| 1312 setReachable(continuation); |
| 1313 |
| 1314 assert(continuation.parameters.length == 1); |
| 1315 Parameter returnValue = continuation.parameters.first; |
| 1316 setValue(returnValue, nonConstant(node.type)); |
| 1317 } |
| 1318 setValue(node, nonConstant()); |
| 1319 } |
1307 } | 1320 } |
1308 | 1321 |
1309 /// Represents the abstract value of a primitive value at some point in the | 1322 /// Represents the abstract value of a primitive value at some point in the |
1310 /// program. Abstract values of all kinds have a type [T]. | 1323 /// program. Abstract values of all kinds have a type [T]. |
1311 /// | 1324 /// |
1312 /// The different kinds of abstract values represents the knowledge about the | 1325 /// The different kinds of abstract values represents the knowledge about the |
1313 /// constness of the value: | 1326 /// constness of the value: |
1314 /// NOTHING: cannot have any value | 1327 /// NOTHING: cannot have any value |
1315 /// CONSTANT: is a constant. The value is stored in the [constant] field, | 1328 /// CONSTANT: is a constant. The value is stored in the [constant] field, |
1316 /// and the type of the constant is in the [type] field. | 1329 /// and the type of the constant is in the [type] field. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 ConstantExpression visitString(StringConstantValue constant, arg) { | 1446 ConstantExpression visitString(StringConstantValue constant, arg) { |
1434 return new StringConstantExpression( | 1447 return new StringConstantExpression( |
1435 constant.primitiveValue.slowToString()); | 1448 constant.primitiveValue.slowToString()); |
1436 } | 1449 } |
1437 | 1450 |
1438 @override | 1451 @override |
1439 ConstantExpression visitType(TypeConstantValue constant, arg) { | 1452 ConstantExpression visitType(TypeConstantValue constant, arg) { |
1440 throw new UnsupportedError("ConstantExpressionCreator.visitType"); | 1453 throw new UnsupportedError("ConstantExpressionCreator.visitType"); |
1441 } | 1454 } |
1442 } | 1455 } |
OLD | NEW |