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.declara
tion))); | 1283 setValue(node, nonConstant(typeSystem.nonNullExact(node.classElement))); |
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 Continuation continuation = node.continuation.definition; | |
1311 setReachable(continuation); | |
1312 | |
1313 assert(continuation.parameters.length == 1); | |
1314 Parameter returnValue = continuation.parameters.first; | |
1315 | |
1316 setValue(returnValue, nonConstant(node.type)); | |
1317 } | |
1318 } | 1307 } |
1319 | 1308 |
1320 /// Represents the abstract value of a primitive value at some point in the | 1309 /// Represents the abstract value of a primitive value at some point in the |
1321 /// program. Abstract values of all kinds have a type [T]. | 1310 /// program. Abstract values of all kinds have a type [T]. |
1322 /// | 1311 /// |
1323 /// The different kinds of abstract values represents the knowledge about the | 1312 /// The different kinds of abstract values represents the knowledge about the |
1324 /// constness of the value: | 1313 /// constness of the value: |
1325 /// NOTHING: cannot have any value | 1314 /// NOTHING: cannot have any value |
1326 /// CONSTANT: is a constant. The value is stored in the [constant] field, | 1315 /// CONSTANT: is a constant. The value is stored in the [constant] field, |
1327 /// and the type of the constant is in the [type] field. | 1316 /// and the type of the constant is in the [type] field. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 ConstantExpression visitString(StringConstantValue constant, arg) { | 1433 ConstantExpression visitString(StringConstantValue constant, arg) { |
1445 return new StringConstantExpression( | 1434 return new StringConstantExpression( |
1446 constant.primitiveValue.slowToString()); | 1435 constant.primitiveValue.slowToString()); |
1447 } | 1436 } |
1448 | 1437 |
1449 @override | 1438 @override |
1450 ConstantExpression visitType(TypeConstantValue constant, arg) { | 1439 ConstantExpression visitType(TypeConstantValue constant, arg) { |
1451 throw new UnsupportedError("ConstantExpressionCreator.visitType"); | 1440 throw new UnsupportedError("ConstantExpressionCreator.visitType"); |
1452 } | 1441 } |
1453 } | 1442 } |
OLD | NEW |