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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 %SetProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); | 225 %SetProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); |
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)) { | 234 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; |
235 return '[object Undefined]'; | 235 if (IS_NULL(this)) return "[object Null]"; |
236 } | 236 if (IS_SYMBOL(this)) return "[object Symbol]"; |
237 if (IS_NULL(this)) return '[object Null]'; | |
238 return "[object " + %_ClassOf(ToObject(this)) + "]"; | 237 return "[object " + %_ClassOf(ToObject(this)) + "]"; |
239 } | 238 } |
240 | 239 |
241 | 240 |
242 // ECMA-262 - 15.2.4.3 | 241 // ECMA-262 - 15.2.4.3 |
243 function ObjectToLocaleString() { | 242 function ObjectToLocaleString() { |
244 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 243 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { |
245 throw MakeTypeError("called_on_null_or_undefined", | 244 throw MakeTypeError("called_on_null_or_undefined", |
246 ["Object.prototype.toLocaleString"]); | 245 ["Object.prototype.toLocaleString"]); |
247 } | 246 } |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 | 1717 |
1719 function SetUpFunction() { | 1718 function SetUpFunction() { |
1720 %CheckIsBootstrapping(); | 1719 %CheckIsBootstrapping(); |
1721 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1720 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1722 "bind", FunctionBind, | 1721 "bind", FunctionBind, |
1723 "toString", FunctionToString | 1722 "toString", FunctionToString |
1724 )); | 1723 )); |
1725 } | 1724 } |
1726 | 1725 |
1727 SetUpFunction(); | 1726 SetUpFunction(); |
OLD | NEW |