OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 var m = %_ArgumentsLength(); | 411 var m = %_ArgumentsLength(); |
412 for (var i = 0; i < m; i++) { | 412 for (var i = 0; i < m; i++) { |
413 this[i+n] = %_Arguments(i); | 413 this[i+n] = %_Arguments(i); |
414 } | 414 } |
415 this.length = n + m; | 415 this.length = n + m; |
416 return this.length; | 416 return this.length; |
417 } | 417 } |
418 | 418 |
419 | 419 |
420 function ArrayConcat(arg1) { // length == 1 | 420 function ArrayConcat(arg1) { // length == 1 |
421 // TODO: can we just use arguments? | |
422 var arg_count = %_ArgumentsLength(); | 421 var arg_count = %_ArgumentsLength(); |
423 var arrays = new $Array(1 + arg_count); | 422 var arrays = new $Array(1 + arg_count); |
424 arrays[0] = this; | 423 arrays[0] = this; |
425 for (var i = 0; i < arg_count; i++) { | 424 for (var i = 0; i < arg_count; i++) { |
426 arrays[i + 1] = %_Arguments(i); | 425 arrays[i + 1] = %_Arguments(i); |
427 } | 426 } |
428 | 427 |
429 return %ArrayConcat(arrays); | 428 return %ArrayConcat(arrays); |
430 } | 429 } |
431 | 430 |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), | 1222 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), |
1224 "reduce", getFunction("reduce", ArrayReduce, 1), | 1223 "reduce", getFunction("reduce", ArrayReduce, 1), |
1225 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) | 1224 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) |
1226 )); | 1225 )); |
1227 | 1226 |
1228 %FinishArrayPrototypeSetup($Array.prototype); | 1227 %FinishArrayPrototypeSetup($Array.prototype); |
1229 } | 1228 } |
1230 | 1229 |
1231 | 1230 |
1232 SetupArray(); | 1231 SetupArray(); |
OLD | NEW |