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

Unified Diff: src/collection.js

Issue 1157843006: Flatten the Arrays returned and consumed by the v8::Map API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reject FromArray args with odd lengths Created 5 years, 7 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
« src/api.cc ('K') | « src/api.cc ('k') | test/cctest/test-api.cc » ('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 1c6b475df6cf4761f4d25738150b1d3bfa3c44d5..86898529c3b7e8289e55b33696307c216eb3dfe5 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -485,9 +485,10 @@ $getExistingHash = GetExistingHash;
$mapFromArray = function(array) {
var map = new GlobalMap;
var length = array.length;
- for (var i = 0; i < length; ++i) {
- var entry = array[i];
- %_CallFunction(map, entry[0], entry[1], MapSet);
+ for (var i = 0; i < length; i += 2) {
+ var key = array[i];
+ var value = array[i + 1];
+ %_CallFunction(map, key, value, MapSet);
}
return map;
};
« src/api.cc ('K') | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698