| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 // ---------------------------------------------------------------------------- | 227 // ---------------------------------------------------------------------------- |
| 228 // Object | 228 // Object |
| 229 | 229 |
| 230 $Object.prototype.constructor = $Object; | 230 $Object.prototype.constructor = $Object; |
| 231 | 231 |
| 232 // ECMA-262 - 15.2.4.2 | 232 // ECMA-262 - 15.2.4.2 |
| 233 function ObjectToString() { | 233 function ObjectToString() { |
| 234 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; | 234 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; |
| 235 if (IS_NULL(this)) return "[object Null]"; | 235 if (IS_NULL(this)) return "[object Null]"; |
| 236 if (IS_SYMBOL(this)) return "[object Symbol]"; | |
| 237 return "[object " + %_ClassOf(ToObject(this)) + "]"; | 236 return "[object " + %_ClassOf(ToObject(this)) + "]"; |
| 238 } | 237 } |
| 239 | 238 |
| 240 | 239 |
| 241 // ECMA-262 - 15.2.4.3 | 240 // ECMA-262 - 15.2.4.3 |
| 242 function ObjectToLocaleString() { | 241 function ObjectToLocaleString() { |
| 243 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 242 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { |
| 244 throw MakeTypeError("called_on_null_or_undefined", | 243 throw MakeTypeError("called_on_null_or_undefined", |
| 245 ["Object.prototype.toLocaleString"]); | 244 ["Object.prototype.toLocaleString"]); |
| 246 } | 245 } |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 } | 857 } |
| 859 | 858 |
| 860 | 859 |
| 861 // ES5 section 15.4.5.1. | 860 // ES5 section 15.4.5.1. |
| 862 function DefineArrayProperty(obj, p, desc, should_throw) { | 861 function DefineArrayProperty(obj, p, desc, should_throw) { |
| 863 // Note that the length of an array is not actually stored as part of the | 862 // Note that the length of an array is not actually stored as part of the |
| 864 // property, hence we use generated code throughout this function instead of | 863 // property, hence we use generated code throughout this function instead of |
| 865 // DefineObjectProperty() to modify its value. | 864 // DefineObjectProperty() to modify its value. |
| 866 | 865 |
| 867 // Step 3 - Special handling for length property. | 866 // Step 3 - Special handling for length property. |
| 868 if (p == "length") { | 867 if (p === "length") { |
| 869 var length = obj.length; | 868 var length = obj.length; |
| 870 if (!desc.hasValue()) { | 869 if (!desc.hasValue()) { |
| 871 return DefineObjectProperty(obj, "length", desc, should_throw); | 870 return DefineObjectProperty(obj, "length", desc, should_throw); |
| 872 } | 871 } |
| 873 var new_length = ToUint32(desc.getValue()); | 872 var new_length = ToUint32(desc.getValue()); |
| 874 if (new_length != ToNumber(desc.getValue())) { | 873 if (new_length != ToNumber(desc.getValue())) { |
| 875 throw new $RangeError('defineProperty() array length out of range'); | 874 throw new $RangeError('defineProperty() array length out of range'); |
| 876 } | 875 } |
| 877 var length_desc = GetOwnProperty(obj, "length"); | 876 var length_desc = GetOwnProperty(obj, "length"); |
| 878 if (new_length != length && !length_desc.isWritable()) { | 877 if (new_length != length && !length_desc.isWritable()) { |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 | 1731 |
| 1733 function SetUpFunction() { | 1732 function SetUpFunction() { |
| 1734 %CheckIsBootstrapping(); | 1733 %CheckIsBootstrapping(); |
| 1735 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1734 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1736 "bind", FunctionBind, | 1735 "bind", FunctionBind, |
| 1737 "toString", FunctionToString | 1736 "toString", FunctionToString |
| 1738 )); | 1737 )); |
| 1739 } | 1738 } |
| 1740 | 1739 |
| 1741 SetUpFunction(); | 1740 SetUpFunction(); |
| OLD | NEW |