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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 var key = functions[i]; | 53 var key = functions[i]; |
54 var f = functions[i + 1]; | 54 var f = functions[i + 1]; |
55 %FunctionSetName(f, key); | 55 %FunctionSetName(f, key); |
56 %FunctionRemovePrototype(f); | 56 %FunctionRemovePrototype(f); |
57 %SetProperty(object, key, f, attributes); | 57 %SetProperty(object, key, f, attributes); |
58 %SetNativeFlag(f); | 58 %SetNativeFlag(f); |
59 } | 59 } |
60 %ToFastProperties(object); | 60 %ToFastProperties(object); |
61 } | 61 } |
62 | 62 |
63 // Prevents changes to the prototype of a built-infunction. | 63 // Prevents changes to the prototype of a built-in function. |
64 // The "prototype" property of the function object is made non-configurable, | 64 // The "prototype" property of the function object is made non-configurable, |
65 // and the prototype object is made non-extensible. The latter prevents | 65 // and the prototype object is made non-extensible. The latter prevents |
66 // changing the __proto__ property. | 66 // changing the __proto__ property. |
67 function SetUpLockedPrototype(constructor, fields, methods) { | 67 function SetUpLockedPrototype(constructor, fields, methods) { |
68 %CheckIsBootstrapping(); | 68 %CheckIsBootstrapping(); |
69 var prototype = constructor.prototype; | 69 var prototype = constructor.prototype; |
70 // Install functions first, because this function is used to initialize | 70 // Install functions first, because this function is used to initialize |
71 // PropertyDescriptor itself. | 71 // PropertyDescriptor itself. |
72 var property_count = (methods.length >> 1) + (fields ? fields.length : 0); | 72 var property_count = (methods.length >> 1) + (fields ? fields.length : 0); |
73 if (property_count >= 4) { | 73 if (property_count >= 4) { |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 | 1667 |
1668 function SetUpFunction() { | 1668 function SetUpFunction() { |
1669 %CheckIsBootstrapping(); | 1669 %CheckIsBootstrapping(); |
1670 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1670 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1671 "bind", FunctionBind, | 1671 "bind", FunctionBind, |
1672 "toString", FunctionToString | 1672 "toString", FunctionToString |
1673 )); | 1673 )); |
1674 } | 1674 } |
1675 | 1675 |
1676 SetUpFunction(); | 1676 SetUpFunction(); |
OLD | NEW |