| 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; | 5 part of js_backend; |
| 6 | 6 |
| 7 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); | 7 const JAVA_SCRIPT_CONSTANT_SYSTEM = const JavaScriptConstantSystem(); |
| 8 | 8 |
| 9 class JavaScriptBitNotOperation extends BitNotOperation { | 9 class JavaScriptBitNotOperation extends BitNotOperation { |
| 10 const JavaScriptBitNotOperation(); | 10 const JavaScriptBitNotOperation(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return result; | 134 return result; |
| 135 } | 135 } |
| 136 | 136 |
| 137 apply(left, right) => identical(left, right); | 137 apply(left, right) => identical(left, right); |
| 138 } | 138 } |
| 139 | 139 |
| 140 /** | 140 /** |
| 141 * Constant system following the semantics for Dart code that has been | 141 * Constant system following the semantics for Dart code that has been |
| 142 * compiled to JavaScript. | 142 * compiled to JavaScript. |
| 143 */ | 143 */ |
| 144 class JavaScriptConstantSystem implements ConstantSystem { | 144 class JavaScriptConstantSystem extends ConstantSystem { |
| 145 const int BITS31 = 0x8FFFFFFF; | 145 const int BITS31 = 0x8FFFFFFF; |
| 146 const int BITS32 = 0xFFFFFFFF; | 146 const int BITS32 = 0xFFFFFFFF; |
| 147 // The maximum integer value a double can represent without losing | 147 // The maximum integer value a double can represent without losing |
| 148 // precision. | 148 // precision. |
| 149 const int BITS53 = 0x1FFFFFFFFFFFFF; | 149 const int BITS53 = 0x1FFFFFFFFFFFFF; |
| 150 | 150 |
| 151 final add = const JavaScriptBinaryArithmeticOperation(const AddOperation()); | 151 final add = const JavaScriptBinaryArithmeticOperation(const AddOperation()); |
| 152 final bitAnd = const JavaScriptBinaryBitOperation(const BitAndOperation()); | 152 final bitAnd = const JavaScriptBinaryBitOperation(const BitAndOperation()); |
| 153 final bitNot = const JavaScriptBitNotOperation(); | 153 final bitNot = const JavaScriptBitNotOperation(); |
| 154 final bitOr = const JavaScriptBinaryBitOperation(const BitOrOperation()); | 154 final bitOr = const JavaScriptBinaryBitOperation(const BitOrOperation()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // At runtime, an integer is both an integer and a double: the | 231 // At runtime, an integer is both an integer and a double: the |
| 232 // integer type check is Math.floor, which will return true only | 232 // integer type check is Math.floor, which will return true only |
| 233 // for real integers, and our double type check is 'typeof number' | 233 // for real integers, and our double type check is 'typeof number' |
| 234 // which will return true for both integers and doubles. | 234 // which will return true for both integers and doubles. |
| 235 if (s.element == compiler.intClass && t.element == compiler.doubleClass) { | 235 if (s.element == compiler.intClass && t.element == compiler.doubleClass) { |
| 236 return true; | 236 return true; |
| 237 } | 237 } |
| 238 return compiler.types.isSubtype(s, t); | 238 return compiler.types.isSubtype(s, t); |
| 239 } | 239 } |
| 240 } | 240 } |
| OLD | NEW |