| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This files contains runtime support implemented in JavaScript. | 5 // This files contains runtime support implemented in JavaScript. |
| 6 | 6 |
| 7 // CAUTION: Some of the functions specified in this file are called | 7 // CAUTION: Some of the functions specified in this file are called |
| 8 // directly from compiled code. These are the functions with names in | 8 // directly from compiled code. These are the functions with names in |
| 9 // ALL CAPS. The compiled code passes the first argument in 'this'. | 9 // ALL CAPS. The compiled code passes the first argument in 'this'. |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // ---------------------------------------------------------------------------- | 37 // ---------------------------------------------------------------------------- |
| 38 | 38 |
| 39 /* ------------------------------------- | 39 /* ------------------------------------- |
| 40 - - - C o n v e r s i o n s - - - | 40 - - - C o n v e r s i o n s - - - |
| 41 ------------------------------------- | 41 ------------------------------------- |
| 42 */ | 42 */ |
| 43 | 43 |
| 44 // ES5, section 9.12 | 44 // ES5, section 9.12 |
| 45 function SameValue(x, y) { | 45 function SameValue(x, y) { |
| 46 if (typeof x != typeof y) return false; | 46 if (typeof x !== typeof y) return false; |
| 47 if (IS_NUMBER(x)) { | 47 if (IS_NUMBER(x)) { |
| 48 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; | 48 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; |
| 49 // x is +0 and y is -0 or vice versa. | 49 // x is +0 and y is -0 or vice versa. |
| 50 if (x === 0 && y === 0 && %_IsMinusZero(x) != %_IsMinusZero(y)) { | 50 if (x === 0 && y === 0 && 1/x !== 1/y) { |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 if (IS_SIMD_VALUE(x)) return %SimdSameValue(x, y); | 54 if (IS_SIMD_VALUE(x)) return %SimdSameValue(x, y); |
| 55 return x === y; | 55 return x === y; |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 // ES6, section 7.2.4 | 59 // ES6, section 7.2.4 |
| 60 function SameValueZero(x, y) { | 60 function SameValueZero(x, y) { |
| 61 if (typeof x != typeof y) return false; | 61 if (typeof x !== typeof y) return false; |
| 62 if (IS_NUMBER(x)) { | 62 if (IS_NUMBER(x)) { |
| 63 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; | 63 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; |
| 64 } | 64 } |
| 65 if (IS_SIMD_VALUE(x)) return %SimdSameValueZero(x, y); | 65 if (IS_SIMD_VALUE(x)) return %SimdSameValueZero(x, y); |
| 66 return x === y; | 66 return x === y; |
| 67 } | 67 } |
| 68 | 68 |
| 69 | 69 |
| 70 function ConcatIterableToArray(target, iterable) { | 70 function ConcatIterableToArray(target, iterable) { |
| 71 var index = target.length; | 71 var index = target.length; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 to.SameValueZero = SameValueZero; | 168 to.SameValueZero = SameValueZero; |
| 169 to.ToPositiveInteger = ToPositiveInteger; | 169 to.ToPositiveInteger = ToPositiveInteger; |
| 170 to.SpeciesConstructor = SpeciesConstructor; | 170 to.SpeciesConstructor = SpeciesConstructor; |
| 171 }); | 171 }); |
| 172 | 172 |
| 173 %InstallToContext([ | 173 %InstallToContext([ |
| 174 "concat_iterable_to_array", ConcatIterableToArray, | 174 "concat_iterable_to_array", ConcatIterableToArray, |
| 175 ]); | 175 ]); |
| 176 | 176 |
| 177 }) | 177 }) |
| OLD | NEW |