| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 }); | 233 }); |
| 234 | 234 |
| 235 %FunctionSetPrototype($Boolean, new $Boolean(false)); | 235 %FunctionSetPrototype($Boolean, new $Boolean(false)); |
| 236 | 236 |
| 237 %SetProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); | 237 %SetProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); |
| 238 | 238 |
| 239 // ---------------------------------------------------------------------------- | 239 // ---------------------------------------------------------------------------- |
| 240 // Object | 240 // Object |
| 241 | 241 |
| 242 $Object.prototype.constructor = $Object; | |
| 243 | |
| 244 // ECMA-262 - 15.2.4.2 | 242 // ECMA-262 - 15.2.4.2 |
| 245 function ObjectToString() { | 243 function ObjectToString() { |
| 246 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; | 244 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; |
| 247 if (IS_NULL(this)) return "[object Null]"; | 245 if (IS_NULL(this)) return "[object Null]"; |
| 248 return "[object " + %_ClassOf(ToObject(this)) + "]"; | 246 return "[object " + %_ClassOf(ToObject(this)) + "]"; |
| 249 } | 247 } |
| 250 | 248 |
| 251 | 249 |
| 252 // ECMA-262 - 15.2.4.3 | 250 // ECMA-262 - 15.2.4.3 |
| 253 function ObjectToLocaleString() { | 251 function ObjectToLocaleString() { |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 // ---------------------------------------------------------------------------- | 1369 // ---------------------------------------------------------------------------- |
| 1372 // Object | 1370 // Object |
| 1373 | 1371 |
| 1374 function SetUpObject() { | 1372 function SetUpObject() { |
| 1375 %CheckIsBootstrapping(); | 1373 %CheckIsBootstrapping(); |
| 1376 | 1374 |
| 1377 %FunctionSetName(ObjectPoisonProto, "__proto__"); | 1375 %FunctionSetName(ObjectPoisonProto, "__proto__"); |
| 1378 %FunctionRemovePrototype(ObjectPoisonProto); | 1376 %FunctionRemovePrototype(ObjectPoisonProto); |
| 1379 %SetExpectedNumberOfProperties($Object, 4); | 1377 %SetExpectedNumberOfProperties($Object, 4); |
| 1380 | 1378 |
| 1379 %SetProperty($Object.prototype, "constructor", $Object, DONT_ENUM); |
| 1380 |
| 1381 // Set up non-enumerable functions on the Object.prototype object. | 1381 // Set up non-enumerable functions on the Object.prototype object. |
| 1382 InstallFunctions($Object.prototype, DONT_ENUM, $Array( | 1382 InstallFunctions($Object.prototype, DONT_ENUM, $Array( |
| 1383 "toString", ObjectToString, | 1383 "toString", ObjectToString, |
| 1384 "toLocaleString", ObjectToLocaleString, | 1384 "toLocaleString", ObjectToLocaleString, |
| 1385 "valueOf", ObjectValueOf, | 1385 "valueOf", ObjectValueOf, |
| 1386 "hasOwnProperty", ObjectHasOwnProperty, | 1386 "hasOwnProperty", ObjectHasOwnProperty, |
| 1387 "isPrototypeOf", ObjectIsPrototypeOf, | 1387 "isPrototypeOf", ObjectIsPrototypeOf, |
| 1388 "propertyIsEnumerable", ObjectPropertyIsEnumerable, | 1388 "propertyIsEnumerable", ObjectPropertyIsEnumerable, |
| 1389 "__defineGetter__", ObjectDefineGetter, | 1389 "__defineGetter__", ObjectDefineGetter, |
| 1390 "__lookupGetter__", ObjectLookupGetter, | 1390 "__lookupGetter__", ObjectLookupGetter, |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 "isNaN", NumberIsNaN | 1652 "isNaN", NumberIsNaN |
| 1653 )); | 1653 )); |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 SetUpNumber(); | 1656 SetUpNumber(); |
| 1657 | 1657 |
| 1658 | 1658 |
| 1659 // ---------------------------------------------------------------------------- | 1659 // ---------------------------------------------------------------------------- |
| 1660 // Function | 1660 // Function |
| 1661 | 1661 |
| 1662 $Function.prototype.constructor = $Function; | |
| 1663 | |
| 1664 function FunctionSourceString(func) { | 1662 function FunctionSourceString(func) { |
| 1665 while (%IsJSFunctionProxy(func)) { | 1663 while (%IsJSFunctionProxy(func)) { |
| 1666 func = %GetCallTrap(func); | 1664 func = %GetCallTrap(func); |
| 1667 } | 1665 } |
| 1668 | 1666 |
| 1669 if (!IS_FUNCTION(func)) { | 1667 if (!IS_FUNCTION(func)) { |
| 1670 throw new $TypeError('Function.prototype.toString is not generic'); | 1668 throw new $TypeError('Function.prototype.toString is not generic'); |
| 1671 } | 1669 } |
| 1672 | 1670 |
| 1673 var source = %FunctionGetSourceCode(func); | 1671 var source = %FunctionGetSourceCode(func); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 %FunctionMarkNameShouldPrintAsAnonymous(f); | 1781 %FunctionMarkNameShouldPrintAsAnonymous(f); |
| 1784 return %SetNewFunctionAttributes(f); | 1782 return %SetNewFunctionAttributes(f); |
| 1785 } | 1783 } |
| 1786 | 1784 |
| 1787 %SetCode($Function, NewFunction); | 1785 %SetCode($Function, NewFunction); |
| 1788 | 1786 |
| 1789 // ---------------------------------------------------------------------------- | 1787 // ---------------------------------------------------------------------------- |
| 1790 | 1788 |
| 1791 function SetUpFunction() { | 1789 function SetUpFunction() { |
| 1792 %CheckIsBootstrapping(); | 1790 %CheckIsBootstrapping(); |
| 1791 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM); |
| 1793 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1792 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1794 "bind", FunctionBind, | 1793 "bind", FunctionBind, |
| 1795 "toString", FunctionToString | 1794 "toString", FunctionToString |
| 1796 )); | 1795 )); |
| 1797 } | 1796 } |
| 1798 | 1797 |
| 1799 SetUpFunction(); | 1798 SetUpFunction(); |
| OLD | NEW |