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

Unified Diff: src/array.js

Issue 11365189: Optimizing the loop algorithm for Array.prototype.map. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/array.js
===================================================================
--- src/array.js (revision 12923)
+++ src/array.js (working copy)
@@ -1239,8 +1239,8 @@
var accumulator = new InternalArray(length);
if (%DebugCallbackSupportsStepping(f)) {
for (var i = 0; i < length; i++) {
- if (i in array) {
- var element = array[i];
+ var element = array[i];
+ if (!IS_UNDEFINED(element)) {
Sven Panne 2012/11/11 15:51:41 Quick drive-by-comment: I think that this "optimiz
// Prepare break slots for debugger step in.
%DebugPrepareStepInIfStepping(f);
accumulator[i] = %_CallFunction(receiver, element, i, array, f);
@@ -1249,8 +1249,8 @@
} else {
// This is a duplicate of the previous loop sans debug stepping.
for (var i = 0; i < length; i++) {
- if (i in array) {
- var element = array[i];
+ var element = array[i];
+ if (!IS_UNDEFINED(element)) {
accumulator[i] = %_CallFunction(receiver, element, i, array, f);
}
}
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698