| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 | 356 |
| 357 // ECMA-262, section 11.8.6, page 54. To make the implementation more | 357 // ECMA-262, section 11.8.6, page 54. To make the implementation more |
| 358 // efficient, the return value should be zero if the 'this' is an | 358 // efficient, the return value should be zero if the 'this' is an |
| 359 // instance of F, and non-zero if not. This makes it possible to avoid | 359 // instance of F, and non-zero if not. This makes it possible to avoid |
| 360 // an expensive ToBoolean conversion in the generated code. | 360 // an expensive ToBoolean conversion in the generated code. |
| 361 function INSTANCE_OF(F) { | 361 function INSTANCE_OF(F) { |
| 362 var V = this; | 362 var V = this; |
| 363 if (!IS_SPEC_FUNCTION(F)) { | 363 if (!IS_SPEC_FUNCTION(F)) { |
| 364 throw %MakeTypeError('instanceof_function_expected', [V]); | 364 throw %MakeTypeError('instanceof_function_expected', [F]); |
| 365 } | 365 } |
| 366 | 366 |
| 367 // If V is not an object, return false. | 367 // If V is not an object, return false. |
| 368 if (!IS_SPEC_OBJECT(V)) { | 368 if (!IS_SPEC_OBJECT(V)) { |
| 369 return 1; | 369 return 1; |
| 370 } | 370 } |
| 371 | 371 |
| 372 // Check if function is bound, if so, get [[BoundFunction]] from it | 372 // Check if function is bound, if so, get [[BoundFunction]] from it |
| 373 // and use that instead of F. | 373 // and use that instead of F. |
| 374 var bindings = %BoundFunctionGetBindings(F); | 374 var bindings = %BoundFunctionGetBindings(F); |
| (...skipping 224 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 |