Chromium Code Reviews| 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 if (start_i < 0) start_i = 0; | 600 if (start_i < 0) start_i = 0; |
| 601 } else { | 601 } else { |
| 602 if (start_i > len) start_i = len; | 602 if (start_i > len) start_i = len; |
| 603 } | 603 } |
| 604 | 604 |
| 605 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is | 605 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is |
| 606 // given differently from when an undefined delete count is given. | 606 // given differently from when an undefined delete count is given. |
| 607 // This does not follow ECMA-262, but we do the same for | 607 // This does not follow ECMA-262, but we do the same for |
| 608 // compatibility. | 608 // compatibility. |
| 609 var del_count = 0; | 609 var del_count = 0; |
| 610 if (num_arguments > 1) { | 610 if (num_arguments != 1) { |
|
Kevin Millikin (Chromium)
2011/01/31 12:32:03
OK. Now maybe it's clearer to change the comparis
| |
| 611 del_count = TO_INTEGER(delete_count); | 611 del_count = TO_INTEGER(delete_count); |
| 612 if (del_count < 0) del_count = 0; | 612 if (del_count < 0) del_count = 0; |
| 613 if (del_count > len - start_i) del_count = len - start_i; | 613 if (del_count > len - start_i) del_count = len - start_i; |
| 614 } else { | 614 } else { |
| 615 del_count = len - start_i; | 615 del_count = len - start_i; |
| 616 } | 616 } |
| 617 | 617 |
| 618 var deleted_elements = []; | 618 var deleted_elements = []; |
| 619 deleted_elements.length = del_count; | 619 deleted_elements.length = del_count; |
| 620 | 620 |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1227 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), | 1227 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), |
| 1228 "reduce", getFunction("reduce", ArrayReduce, 1), | 1228 "reduce", getFunction("reduce", ArrayReduce, 1), |
| 1229 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) | 1229 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) |
| 1230 )); | 1230 )); |
| 1231 | 1231 |
| 1232 %FinishArrayPrototypeSetup($Array.prototype); | 1232 %FinishArrayPrototypeSetup($Array.prototype); |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 | 1235 |
| 1236 SetupArray(); | 1236 SetupArray(); |
| OLD | NEW |