Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: src/array.js

Issue 3277005: Follow Safari and Firefox in returning empty array from array splice... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 559
560 result.length = end_i - start_i; 560 result.length = end_i - start_i;
561 561
562 return result; 562 return result;
563 } 563 }
564 564
565 565
566 function ArraySplice(start, delete_count) { 566 function ArraySplice(start, delete_count) {
567 var num_arguments = %_ArgumentsLength(); 567 var num_arguments = %_ArgumentsLength();
568 568
569 // SpiderMonkey and JSC return undefined in the case where no
570 // arguments are given instead of using the implicit undefined
571 // arguments. This does not follow ECMA-262, but we do the same for
572 // compatibility.
573 // TraceMonkey follows ECMA-262 though.
574 if (num_arguments == 0) return;
575
576 var len = TO_UINT32(this.length); 569 var len = TO_UINT32(this.length);
577 var start_i = TO_INTEGER(start); 570 var start_i = TO_INTEGER(start);
578 571
579 if (start_i < 0) { 572 if (start_i < 0) {
580 start_i += len; 573 start_i += len;
581 if (start_i < 0) start_i = 0; 574 if (start_i < 0) start_i = 0;
582 } else { 575 } else {
583 if (start_i > len) start_i = len; 576 if (start_i > len) start_i = len;
584 } 577 }
585 578
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), 1113 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1),
1121 "reduce", getFunction("reduce", ArrayReduce, 1), 1114 "reduce", getFunction("reduce", ArrayReduce, 1),
1122 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) 1115 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
1123 )); 1116 ));
1124 1117
1125 %FinishArrayPrototypeSetup($Array.prototype); 1118 %FinishArrayPrototypeSetup($Array.prototype);
1126 } 1119 }
1127 1120
1128 1121
1129 SetupArray(); 1122 SetupArray();
OLDNEW
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698