| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Helper function used to install functions on objects. | 48 // Helper function used to install functions on objects. |
| 49 function InstallFunctions(object, attributes, functions) { | 49 function InstallFunctions(object, attributes, functions) { |
| 50 if (functions.length >= 8) { | 50 if (functions.length >= 8) { |
| 51 %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1); | 51 %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1); |
| 52 } | 52 } |
| 53 for (var i = 0; i < functions.length; i += 2) { | 53 for (var i = 0; i < functions.length; i += 2) { |
| 54 var key = functions[i]; | 54 var key = functions[i]; |
| 55 var f = functions[i + 1]; | 55 var f = functions[i + 1]; |
| 56 %FunctionSetName(f, key); | 56 %FunctionSetName(f, key); |
| 57 %FunctionRemovePrototype(f); | 57 %FunctionRemovePrototype(f); |
| 58 // We match firefox on this, but not Safari (which does not have the |
| 59 // property at all). |
| 60 %IgnoreAttributesAndSetProperty(f, "caller", |
| 61 null, |
| 62 DONT_ENUM | DONT_DELETE); |
| 63 %IgnoreAttributesAndSetProperty(f, "arguments", |
| 64 null, |
| 65 DONT_ENUM | DONT_DELETE); |
| 66 |
| 58 %SetProperty(object, key, f, attributes); | 67 %SetProperty(object, key, f, attributes); |
| 59 %SetNativeFlag(f); | 68 %SetNativeFlag(f); |
| 60 } | 69 } |
| 61 %ToFastProperties(object); | 70 %ToFastProperties(object); |
| 62 } | 71 } |
| 63 | 72 |
| 64 // Emulates JSC by installing functions on a hidden prototype that | 73 // Emulates JSC by installing functions on a hidden prototype that |
| 65 // lies above the current object/prototype. This lets you override | 74 // lies above the current object/prototype. This lets you override |
| 66 // functions on String.prototype etc. and then restore the old function | 75 // functions on String.prototype etc. and then restore the old function |
| 67 // with delete. See http://code.google.com/p/chromium/issues/detail?id=1717 | 76 // with delete. See http://code.google.com/p/chromium/issues/detail?id=1717 |
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 // ---------------------------------------------------------------------------- | 1532 // ---------------------------------------------------------------------------- |
| 1524 | 1533 |
| 1525 function SetupFunction() { | 1534 function SetupFunction() { |
| 1526 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1535 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1527 "bind", FunctionBind, | 1536 "bind", FunctionBind, |
| 1528 "toString", FunctionToString | 1537 "toString", FunctionToString |
| 1529 )); | 1538 )); |
| 1530 } | 1539 } |
| 1531 | 1540 |
| 1532 SetupFunction(); | 1541 SetupFunction(); |
| OLD | NEW |