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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 return %NumberToJSInt32(ToNumber(x)); | 599 return %NumberToJSInt32(ToNumber(x)); |
600 } | 600 } |
601 | 601 |
602 | 602 |
603 // ES5, section 9.12 | 603 // ES5, section 9.12 |
604 function SameValue(x, y) { | 604 function SameValue(x, y) { |
605 if (typeof x != typeof y) return false; | 605 if (typeof x != typeof y) return false; |
606 if (IS_NUMBER(x)) { | 606 if (IS_NUMBER(x)) { |
607 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; | 607 if (NUMBER_IS_NAN(x) && NUMBER_IS_NAN(y)) return true; |
608 // x is +0 and y is -0 or vice versa. | 608 // x is +0 and y is -0 or vice versa. |
609 if (x === 0 && y === 0 && (1 / x) != (1 / y)) return false; | 609 if (x === 0 && y === 0 && %_IsMinusZero(x) != %_IsMinusZero(y)) { |
| 610 return false; |
| 611 } |
610 } | 612 } |
611 return x === y; | 613 return x === y; |
612 } | 614 } |
613 | 615 |
614 | 616 |
615 /* --------------------------------- | 617 /* --------------------------------- |
616 - - - U t i l i t i e s - - - | 618 - - - U t i l i t i e s - - - |
617 --------------------------------- | 619 --------------------------------- |
618 */ | 620 */ |
619 | 621 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 return i; | 669 return i; |
668 } | 670 } |
669 | 671 |
670 | 672 |
671 // NOTE: Setting the prototype for Array must take place as early as | 673 // NOTE: Setting the prototype for Array must take place as early as |
672 // possible due to code generation for array literals. When | 674 // possible due to code generation for array literals. When |
673 // generating code for a array literal a boilerplate array is created | 675 // generating code for a array literal a boilerplate array is created |
674 // that is cloned when running the code. It is essential that the | 676 // that is cloned when running the code. It is essential that the |
675 // boilerplate gets the right prototype. | 677 // boilerplate gets the right prototype. |
676 %FunctionSetPrototype($Array, new $Array(0)); | 678 %FunctionSetPrototype($Array, new $Array(0)); |
OLD | NEW |