| 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 js_backend; | |
| 6 | |
| 7 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); | 5 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); |
| 8 | 6 |
| 9 class JavaScriptBitNotOperation extends BitNotOperation { | 7 class JavaScriptBitNotOperation extends BitNotOperation { |
| 10 const JavaScriptBitNotOperation(); | 8 const JavaScriptBitNotOperation(); |
| 11 | 9 |
| 12 Constant fold(Constant constant) { | 10 Constant fold(Constant constant) { |
| 13 if (JAVA_SCRIPT_CONSTANT_SYSTEM.isInt(constant)) { | 11 if (JAVA_SCRIPT_CONSTANT_SYSTEM.isInt(constant)) { |
| 14 // In JavaScript we don't check for -0 and treat it as if it was zero. | 12 // In JavaScript we don't check for -0 and treat it as if it was zero. |
| 15 if (constant.isMinusZero()) constant = DART_CONSTANT_SYSTEM.createInt(0); | 13 if (constant.isMinusZero()) constant = DART_CONSTANT_SYSTEM.createInt(0); |
| 16 IntConstant intConstant = constant; | 14 IntConstant intConstant = constant; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // At runtime, an integer is both an integer and a double: the | 229 // At runtime, an integer is both an integer and a double: the |
| 232 // integer type check is Math.floor, which will return true only | 230 // integer type check is Math.floor, which will return true only |
| 233 // for real integers, and our double type check is 'typeof number' | 231 // for real integers, and our double type check is 'typeof number' |
| 234 // which will return true for both integers and doubles. | 232 // which will return true for both integers and doubles. |
| 235 if (s.element == compiler.intClass && t.element == compiler.doubleClass) { | 233 if (s.element == compiler.intClass && t.element == compiler.doubleClass) { |
| 236 return true; | 234 return true; |
| 237 } | 235 } |
| 238 return compiler.types.isSubtype(s, t); | 236 return compiler.types.isSubtype(s, t); |
| 239 } | 237 } |
| 240 } | 238 } |
| OLD | NEW |