| 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 | 998 |
| 999 | 999 |
| 1000 function UpdateFunctionLengths(lengths) { | 1000 function UpdateFunctionLengths(lengths) { |
| 1001 for (var key in lengths) { | 1001 for (var key in lengths) { |
| 1002 %FunctionSetLength(this[key], lengths[key]); | 1002 %FunctionSetLength(this[key], lengths[key]); |
| 1003 } | 1003 } |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 | 1006 |
| 1007 // ------------------------------------------------------------------- | 1007 // ------------------------------------------------------------------- |
| 1008 | |
| 1009 function SetupArray() { | 1008 function SetupArray() { |
| 1010 // Setup non-enumerable constructor property on the Array.prototype | 1009 // Setup non-enumerable constructor property on the Array.prototype |
| 1011 // object. | 1010 // object. |
| 1012 %SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM); | 1011 %SetProperty($Array.prototype, "constructor", $Array, DONT_ENUM); |
| 1013 | 1012 |
| 1014 // Setup non-enumerable functions of the Array.prototype object and | 1013 // Setup non-enumerable functions of the Array.prototype object and |
| 1015 // set their names. | 1014 // set their names. |
| 1016 InstallFunctions($Array.prototype, DONT_ENUM, $Array( | 1015 InstallFunctionsOnHiddenPrototype($Array.prototype, DONT_ENUM, $Array( |
| 1017 "toString", ArrayToString, | 1016 "toString", ArrayToString, |
| 1018 "toLocaleString", ArrayToLocaleString, | 1017 "toLocaleString", ArrayToLocaleString, |
| 1019 "join", ArrayJoin, | 1018 "join", ArrayJoin, |
| 1020 "pop", ArrayPop, | 1019 "pop", ArrayPop, |
| 1021 "push", ArrayPush, | 1020 "push", ArrayPush, |
| 1022 "concat", ArrayConcat, | 1021 "concat", ArrayConcat, |
| 1023 "reverse", ArrayReverse, | 1022 "reverse", ArrayReverse, |
| 1024 "shift", ArrayShift, | 1023 "shift", ArrayShift, |
| 1025 "unshift", ArrayUnshift, | 1024 "unshift", ArrayUnshift, |
| 1026 "slice", ArraySlice, | 1025 "slice", ArraySlice, |
| 1027 "splice", ArraySplice, | 1026 "splice", ArraySplice, |
| 1028 "sort", ArraySort, | 1027 "sort", ArraySort, |
| 1029 "filter", ArrayFilter, | 1028 "filter", ArrayFilter, |
| 1030 "forEach", ArrayForEach, | 1029 "forEach", ArrayForEach, |
| 1031 "some", ArraySome, | 1030 "some", ArraySome, |
| 1032 "every", ArrayEvery, | 1031 "every", ArrayEvery, |
| 1033 "map", ArrayMap, | 1032 "map", ArrayMap, |
| 1034 "indexOf", ArrayIndexOf, | 1033 "indexOf", ArrayIndexOf, |
| 1035 "lastIndexOf", ArrayLastIndexOf, | 1034 "lastIndexOf", ArrayLastIndexOf, |
| 1036 "reduce", ArrayReduce, | 1035 "reduce", ArrayReduce, |
| 1037 "reduceRight", ArrayReduceRight | 1036 "reduceRight", ArrayReduceRight)); |
| 1038 )); | |
| 1039 | 1037 |
| 1040 // Manipulate the length of some of the functions to meet | 1038 // Manipulate the length of some of the functions to meet |
| 1041 // expectations set by ECMA-262 or Mozilla. | 1039 // expectations set by ECMA-262 or Mozilla. |
| 1042 UpdateFunctionLengths({ | 1040 UpdateFunctionLengths({ |
| 1043 ArrayFilter: 1, | 1041 ArrayFilter: 1, |
| 1044 ArrayForEach: 1, | 1042 ArrayForEach: 1, |
| 1045 ArraySome: 1, | 1043 ArraySome: 1, |
| 1046 ArrayEvery: 1, | 1044 ArrayEvery: 1, |
| 1047 ArrayMap: 1, | 1045 ArrayMap: 1, |
| 1048 ArrayIndexOf: 1, | 1046 ArrayIndexOf: 1, |
| 1049 ArrayLastIndexOf: 1, | 1047 ArrayLastIndexOf: 1, |
| 1050 ArrayPush: 1, | 1048 ArrayPush: 1, |
| 1051 ArrayReduce: 1, | 1049 ArrayReduce: 1, |
| 1052 ArrayReduceRight: 1 | 1050 ArrayReduceRight: 1 |
| 1053 }); | 1051 }); |
| 1054 } | 1052 } |
| 1055 | 1053 |
| 1056 | 1054 |
| 1057 SetupArray(); | 1055 SetupArray(); |
| OLD | NEW |