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

Side by Side Diff: src/array.js

Issue 6606002: Merge revision 6500-6600 from bleeding_edge to the isolates branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 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
OLDNEW
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 var length2 = (length << 1) - 1; 164 var length2 = (length << 1) - 1;
165 var j = length2; 165 var j = length2;
166 var i = length; 166 var i = length;
167 elements[--j] = elements[--i]; 167 elements[--j] = elements[--i];
168 while (i > 0) { 168 while (i > 0) {
169 elements[--j] = separator; 169 elements[--j] = separator;
170 elements[--j] = elements[--i]; 170 elements[--j] = elements[--i];
171 } 171 }
172 return %StringBuilderConcat(elements, length2, ''); 172 return %StringBuilderConcat(elements, length2, '');
173 } finally { 173 } finally {
174 // Make sure to pop the visited array no matter what happens. 174 // Make sure to remove the last element of the visited array no
175 if (is_array) visited_arrays.pop(); 175 // matter what happens.
176 if (is_array) visited_arrays.length = visited_arrays.length - 1;
176 } 177 }
177 } 178 }
178 179
179 180
180 function ConvertToString(x) { 181 function ConvertToString(x) {
181 // Assumes x is a non-string. 182 // Assumes x is a non-string.
182 if (IS_NUMBER(x)) return %_NumberToString(x); 183 if (IS_NUMBER(x)) return %_NumberToString(x);
183 if (IS_BOOLEAN(x)) return x ? 'true' : 'false'; 184 if (IS_BOOLEAN(x)) return x ? 'true' : 'false';
184 return (IS_NULL_OR_UNDEFINED(x)) ? '' : %ToString(%DefaultString(x)); 185 return (IS_NULL_OR_UNDEFINED(x)) ? '' : %ToString(%DefaultString(x));
185 } 186 }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 var start_i = TO_INTEGER(start); 597 var start_i = TO_INTEGER(start);
597 598
598 if (start_i < 0) { 599 if (start_i < 0) {
599 start_i += len; 600 start_i += len;
600 if (start_i < 0) start_i = 0; 601 if (start_i < 0) start_i = 0;
601 } else { 602 } else {
602 if (start_i > len) start_i = len; 603 if (start_i > len) start_i = len;
603 } 604 }
604 605
605 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is 606 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is
606 // given differently from when an undefined delete count is given. 607 // given as a request to delete all the elements from the start.
608 // And it differs from the case of undefined delete count.
607 // This does not follow ECMA-262, but we do the same for 609 // This does not follow ECMA-262, but we do the same for
608 // compatibility. 610 // compatibility.
609 var del_count = 0; 611 var del_count = 0;
610 if (num_arguments > 1) { 612 if (num_arguments == 1) {
613 del_count = len - start_i;
614 } else {
611 del_count = TO_INTEGER(delete_count); 615 del_count = TO_INTEGER(delete_count);
612 if (del_count < 0) del_count = 0; 616 if (del_count < 0) del_count = 0;
613 if (del_count > len - start_i) del_count = len - start_i; 617 if (del_count > len - start_i) del_count = len - start_i;
614 } else {
615 del_count = len - start_i;
616 } 618 }
617 619
618 var deleted_elements = []; 620 var deleted_elements = [];
619 deleted_elements.length = del_count; 621 deleted_elements.length = del_count;
620 622
621 // Number of elements to add. 623 // Number of elements to add.
622 var num_additional_args = 0; 624 var num_additional_args = 0;
623 if (num_arguments > 2) { 625 if (num_arguments > 2) {
624 num_additional_args = num_arguments - 2; 626 num_additional_args = num_arguments - 2;
625 } 627 }
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), 1229 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1),
1228 "reduce", getFunction("reduce", ArrayReduce, 1), 1230 "reduce", getFunction("reduce", ArrayReduce, 1),
1229 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) 1231 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
1230 )); 1232 ));
1231 1233
1232 %FinishArrayPrototypeSetup($Array.prototype); 1234 %FinishArrayPrototypeSetup($Array.prototype);
1233 } 1235 }
1234 1236
1235 1237
1236 SetupArray(); 1238 SetupArray();
OLDNEW
« no previous file with comments | « src/arm/virtual-frame-arm.cc ('k') | src/assembler.h » ('j') | src/ast.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698