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

Unified Diff: src/collection.js

Issue 355663002: Optimize Map/Set.prototype.forEach (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/collection-iterator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/collection.js
diff --git a/src/collection.js b/src/collection.js
index 8ddf8e1001712e97b9a231d33889a5aa14a9c309..01e7c536f9607f097c906028669f43be3fb0cee2 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -129,11 +129,13 @@ function SetForEach(f, receiver) {
}
var iterator = new SetIterator(this, ITERATOR_KIND_VALUES);
- var entry;
+ var key;
var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
- while (!(entry = %SetIteratorNext(iterator)).done) {
+ var value_array = [UNDEFINED];
+ while (%SetIteratorNext(iterator, value_array)) {
if (stepping) %DebugPrepareStepInIfStepping(f);
- %_CallFunction(receiver, entry.value, entry.value, this, f);
+ key = value_array[0];
+ %_CallFunction(receiver, key, key, this, f);
}
}
@@ -264,11 +266,11 @@ function MapForEach(f, receiver) {
}
var iterator = new MapIterator(this, ITERATOR_KIND_ENTRIES);
- var entry;
var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
- while (!(entry = %MapIteratorNext(iterator)).done) {
+ var value_array = [UNDEFINED, UNDEFINED];
+ while (%MapIteratorNext(iterator, value_array)) {
if (stepping) %DebugPrepareStepInIfStepping(f);
- %_CallFunction(receiver, entry.value[1], entry.value[0], this, f);
+ %_CallFunction(receiver, value_array[1], value_array[0], this, f);
}
}
« no previous file with comments | « no previous file | src/collection-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698