| 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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 "isArray", ArrayIsArray | 1100 "isArray", ArrayIsArray |
| 1101 )); | 1101 )); |
| 1102 | 1102 |
| 1103 var specialFunctions = %SpecialArrayFunctions({}); | 1103 var specialFunctions = %SpecialArrayFunctions({}); |
| 1104 | 1104 |
| 1105 function getFunction(name, jsBuiltin, len) { | 1105 function getFunction(name, jsBuiltin, len) { |
| 1106 var f = jsBuiltin; | 1106 var f = jsBuiltin; |
| 1107 if (specialFunctions.hasOwnProperty(name)) { | 1107 if (specialFunctions.hasOwnProperty(name)) { |
| 1108 f = specialFunctions[name]; | 1108 f = specialFunctions[name]; |
| 1109 } | 1109 } |
| 1110 if (arguments.length == 3) { | 1110 if (!IS_UNDEFINED(len)) { |
| 1111 %FunctionSetLength(f, len); | 1111 %FunctionSetLength(f, len); |
| 1112 } | 1112 } |
| 1113 return f; | 1113 return f; |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 // Setup non-enumerable functions of the Array.prototype object and | 1116 // Setup non-enumerable functions of the Array.prototype object and |
| 1117 // set their names. | 1117 // set their names. |
| 1118 // Manipulate the length of some of the functions to meet | 1118 // Manipulate the length of some of the functions to meet |
| 1119 // expectations set by ECMA-262 or Mozilla. | 1119 // expectations set by ECMA-262 or Mozilla. |
| 1120 InstallFunctionsOnHiddenPrototype($Array.prototype, DONT_ENUM, $Array( | 1120 InstallFunctionsOnHiddenPrototype($Array.prototype, DONT_ENUM, $Array( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1139 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), | 1139 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), |
| 1140 "reduce", getFunction("reduce", ArrayReduce, 1), | 1140 "reduce", getFunction("reduce", ArrayReduce, 1), |
| 1141 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) | 1141 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) |
| 1142 )); | 1142 )); |
| 1143 | 1143 |
| 1144 %FinishArrayPrototypeSetup($Array.prototype); | 1144 %FinishArrayPrototypeSetup($Array.prototype); |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 | 1147 |
| 1148 SetupArray(); | 1148 SetupArray(); |
| OLD | NEW |