OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 } | 900 } |
901 | 901 |
902 | 902 |
903 // ------------------------------------------------------------------- | 903 // ------------------------------------------------------------------- |
904 | 904 |
905 function InstallFunctions(prototype, attributes, functions) { | 905 function InstallFunctions(prototype, attributes, functions) { |
906 for (var i = 0; i < functions.length; i += 2) { | 906 for (var i = 0; i < functions.length; i += 2) { |
907 var key = functions[i]; | 907 var key = functions[i]; |
908 var f = functions[i + 1]; | 908 var f = functions[i + 1]; |
909 %FunctionSetName(f, key); | 909 %FunctionSetName(f, key); |
910 %AddProperty(prototype, key, f, attributes); | 910 %SetProperty(prototype, key, f, attributes); |
911 } | 911 } |
912 } | 912 } |
913 | 913 |
914 | 914 |
915 function UpdateFunctionLengths(lengths) { | 915 function UpdateFunctionLengths(lengths) { |
916 for (var key in lengths) { | 916 for (var key in lengths) { |
917 %FunctionSetLength(this[key], lengths[key]); | 917 %FunctionSetLength(this[key], lengths[key]); |
918 } | 918 } |
919 } | 919 } |
920 | 920 |
921 | 921 |
922 // ------------------------------------------------------------------- | 922 // ------------------------------------------------------------------- |
923 | 923 |
924 function SetupArray() { | 924 function SetupArray() { |
925 // Setup non-enumerable constructor property on the Array.prototype | 925 // Setup non-enumerable constructor property on the Array.prototype |
926 // object. | 926 // object. |
927 %AddProperty($Array.prototype, "constructor", $Array, DONT_ENUM); | 927 %SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM); |
928 | 928 |
929 // Setup non-enumerable functions of the Array.prototype object and | 929 // Setup non-enumerable functions of the Array.prototype object and |
930 // set their names. | 930 // set their names. |
931 InstallFunctions($Array.prototype, DONT_ENUM, $Array( | 931 InstallFunctions($Array.prototype, DONT_ENUM, $Array( |
932 "toString", ArrayToString, | 932 "toString", ArrayToString, |
933 "toLocaleString", ArrayToLocaleString, | 933 "toLocaleString", ArrayToLocaleString, |
934 "join", ArrayJoin, | 934 "join", ArrayJoin, |
935 "pop", ArrayPop, | 935 "pop", ArrayPop, |
936 "push", ArrayPush, | 936 "push", ArrayPush, |
937 "concat", ArrayConcat, | 937 "concat", ArrayConcat, |
(...skipping 21 matching lines...) Expand all Loading... |
959 ArrayEvery: 1, | 959 ArrayEvery: 1, |
960 ArrayMap: 1, | 960 ArrayMap: 1, |
961 ArrayIndexOf: 1, | 961 ArrayIndexOf: 1, |
962 ArrayLastIndexOf: 1, | 962 ArrayLastIndexOf: 1, |
963 ArrayPush: 1 | 963 ArrayPush: 1 |
964 }); | 964 }); |
965 } | 965 } |
966 | 966 |
967 | 967 |
968 SetupArray(); | 968 SetupArray(); |
OLD | NEW |