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 | |
64 // Helper function to install a getter only property. | |
65 function InstallGetter(object, name, getter) { | |
66 %FunctionSetName(getter, name); | |
67 %FunctionRemovePrototype(getter); | |
arv (Not doing code reviews)
2012/11/06 16:02:33
I missed this one last time. The spec says that al
| |
68 %DefineOrRedefineAccessorProperty(object, name, getter, null, DONT_ENUM); | |
69 %SetNativeFlag(getter); | |
70 } | |
71 | |
72 | |
63 // Prevents changes to the prototype of a built-infunction. | 73 // Prevents changes to the prototype of a built-infunction. |
64 // The "prototype" property of the function object is made non-configurable, | 74 // The "prototype" property of the function object is made non-configurable, |
65 // and the prototype object is made non-extensible. The latter prevents | 75 // and the prototype object is made non-extensible. The latter prevents |
66 // changing the __proto__ property. | 76 // changing the __proto__ property. |
67 function SetUpLockedPrototype(constructor, fields, methods) { | 77 function SetUpLockedPrototype(constructor, fields, methods) { |
68 %CheckIsBootstrapping(); | 78 %CheckIsBootstrapping(); |
69 var prototype = constructor.prototype; | 79 var prototype = constructor.prototype; |
70 // Install functions first, because this function is used to initialize | 80 // Install functions first, because this function is used to initialize |
71 // PropertyDescriptor itself. | 81 // PropertyDescriptor itself. |
72 var property_count = (methods.length >> 1) + (fields ? fields.length : 0); | 82 var property_count = (methods.length >> 1) + (fields ? fields.length : 0); |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1667 | 1677 |
1668 function SetUpFunction() { | 1678 function SetUpFunction() { |
1669 %CheckIsBootstrapping(); | 1679 %CheckIsBootstrapping(); |
1670 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1680 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1671 "bind", FunctionBind, | 1681 "bind", FunctionBind, |
1672 "toString", FunctionToString | 1682 "toString", FunctionToString |
1673 )); | 1683 )); |
1674 } | 1684 } |
1675 | 1685 |
1676 SetUpFunction(); | 1686 SetUpFunction(); |
OLD | NEW |