| 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 3446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3457 HTypeConversion conversion = new HTypeConversion( | 3457 HTypeConversion conversion = new HTypeConversion( |
| 3458 null, | 3458 null, |
| 3459 HTypeConversion.ARGUMENT_TYPE_CHECK, | 3459 HTypeConversion.ARGUMENT_TYPE_CHECK, |
| 3460 commonMasks.numType, | 3460 commonMasks.numType, |
| 3461 inputs[0]); | 3461 inputs[0]); |
| 3462 add(conversion); | 3462 add(conversion); |
| 3463 inputs[0] = conversion; | 3463 inputs[0] = conversion; |
| 3464 } | 3464 } |
| 3465 js.Template code = js.js.parseForeignJS('new Array(#)'); | 3465 js.Template code = js.js.parseForeignJS('new Array(#)'); |
| 3466 var behavior = new native.NativeBehavior(); | 3466 var behavior = new native.NativeBehavior(); |
| 3467 behavior.typesInstantiated.add(expectedType); |
| 3467 behavior.typesReturned.add(expectedType); | 3468 behavior.typesReturned.add(expectedType); |
| 3468 // The allocation can throw only if the given length is a double or | 3469 // The allocation can throw only if the given length is a double or |
| 3469 // outside the unsigned 32 bit range. | 3470 // outside the unsigned 32 bit range. |
| 3470 // TODO(sra): Array allocation should be an instruction so that canThrow | 3471 // TODO(sra): Array allocation should be an instruction so that canThrow |
| 3471 // can depend on a length type discovered in optimization. | 3472 // can depend on a length type discovered in optimization. |
| 3472 bool canThrow = true; | 3473 bool canThrow = true; |
| 3473 if (inputs[0].isInteger(closedWorld) && inputs[0] is HConstant) { | 3474 if (inputs[0].isInteger(closedWorld) && inputs[0] is HConstant) { |
| 3474 var constant = inputs[0]; | 3475 var constant = inputs[0]; |
| 3475 int value = constant.constant.primitiveValue; | 3476 int value = constant.constant.primitiveValue; |
| 3476 if (0 <= value && value < 0x100000000) canThrow = false; | 3477 if (0 <= value && value < 0x100000000) canThrow = false; |
| (...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6769 this.oldReturnLocal, | 6770 this.oldReturnLocal, |
| 6770 this.oldReturnType, | 6771 this.oldReturnType, |
| 6771 this.oldResolvedAst, | 6772 this.oldResolvedAst, |
| 6772 this.oldStack, | 6773 this.oldStack, |
| 6773 this.oldLocalsHandler, | 6774 this.oldLocalsHandler, |
| 6774 this.inTryStatement, | 6775 this.inTryStatement, |
| 6775 this.allFunctionsCalledOnce, | 6776 this.allFunctionsCalledOnce, |
| 6776 this.oldElementInferenceResults) | 6777 this.oldElementInferenceResults) |
| 6777 : super(function); | 6778 : super(function); |
| 6778 } | 6779 } |
| OLD | NEW |