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

Side by Side Diff: src/array.js

Issue 5122005: Add a fast case to Array.join when all the elements and the separator are fla... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 1 month 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 | « src/arm/full-codegen-arm.cc ('k') | src/ia32/codegen-ia32.h » ('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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return Join(this, this.length, ',', ConvertToLocaleString); 357 return Join(this, this.length, ',', ConvertToLocaleString);
358 } 358 }
359 359
360 360
361 function ArrayJoin(separator) { 361 function ArrayJoin(separator) {
362 if (IS_UNDEFINED(separator)) { 362 if (IS_UNDEFINED(separator)) {
363 separator = ','; 363 separator = ',';
364 } else if (!IS_STRING(separator)) { 364 } else if (!IS_STRING(separator)) {
365 separator = ToString(separator); 365 separator = ToString(separator);
366 } 366 }
367
368 var result = %_FastAsciiArrayJoin(this, separator);
369 if (typeof result != "undefined") return result;
370
367 var length = TO_UINT32(this.length); 371 var length = TO_UINT32(this.length);
368 return Join(this, length, separator, ConvertToString); 372 return Join(this, length, separator, ConvertToString);
369 } 373 }
370 374
371 375
372 // Removes the last element from the array and returns it. See 376 // Removes the last element from the array and returns it. See
373 // ECMA-262, section 15.4.4.6. 377 // ECMA-262, section 15.4.4.6.
374 function ArrayPop() { 378 function ArrayPop() {
375 var n = TO_UINT32(this.length); 379 var n = TO_UINT32(this.length);
376 if (n == 0) { 380 if (n == 0) {
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), 1168 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1),
1165 "reduce", getFunction("reduce", ArrayReduce, 1), 1169 "reduce", getFunction("reduce", ArrayReduce, 1),
1166 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) 1170 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
1167 )); 1171 ));
1168 1172
1169 %FinishArrayPrototypeSetup($Array.prototype); 1173 %FinishArrayPrototypeSetup($Array.prototype);
1170 } 1174 }
1171 1175
1172 1176
1173 SetupArray(); 1177 SetupArray();
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698