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

Issue 1157843006: Flatten the Arrays returned and consumed by the v8::Map API (Closed)

Created:
5 years, 6 months ago by adamk
Modified:
5 years, 6 months ago
CC:
Paweł Hajdan Jr., v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Flatten the Arrays returned and consumed by the v8::Map API This will significantly simplify the serialization code, as well as speeding it up (by triggering only a single allocation instead of O(size) allocations). BUG=chromium:478263 LOG=y Committed: https://crrev.com/353310b7c11fcdf7fa41c64d63109e9a017d90b1 Cr-Commit-Position: refs/heads/master@{#28793}

Patch Set 1 #

Total comments: 3

Patch Set 2 : Reject FromArray args with odd lengths #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -28 lines) Patch
M include/v8.h View 2 chunks +4 lines, -4 lines 0 comments Download
M src/api.cc View 1 2 chunks +8 lines, -9 lines 4 comments Download
M src/collection.js View 1 1 chunk +4 lines, -3 lines 0 comments Download
M test/cctest/test-api.cc View 1 1 chunk +12 lines, -12 lines 0 comments Download

Messages

Total messages: 15 (4 generated)
adamk
5 years, 6 months ago (2015-06-02 22:07:55 UTC) #2
arv (Not doing code reviews)
LGTM https://codereview.chromium.org/1157843006/diff/1/src/collection.js File src/collection.js (right): https://codereview.chromium.org/1157843006/diff/1/src/collection.js#newcode488 src/collection.js:488: for (var i = 0; i + 1 ...
5 years, 6 months ago (2015-06-02 22:35:43 UTC) #3
adamk
https://codereview.chromium.org/1157843006/diff/1/src/collection.js File src/collection.js (right): https://codereview.chromium.org/1157843006/diff/1/src/collection.js#newcode488 src/collection.js:488: for (var i = 0; i + 1 < ...
5 years, 6 months ago (2015-06-02 22:40:03 UTC) #4
adamk
https://codereview.chromium.org/1157843006/diff/1/src/collection.js File src/collection.js (right): https://codereview.chromium.org/1157843006/diff/1/src/collection.js#newcode488 src/collection.js:488: for (var i = 0; i + 1 < ...
5 years, 6 months ago (2015-06-02 22:56:12 UTC) #5
jochen (gone - plz use gerrit)
lgtm with question https://codereview.chromium.org/1157843006/diff/20001/src/api.cc File src/api.cc (right): https://codereview.chromium.org/1157843006/diff/20001/src/api.cc#newcode6276 src/api.cc:6276: int length = size * 2; ...
5 years, 6 months ago (2015-06-03 10:44:51 UTC) #6
adamk
https://codereview.chromium.org/1157843006/diff/20001/src/api.cc File src/api.cc (right): https://codereview.chromium.org/1157843006/diff/20001/src/api.cc#newcode6276 src/api.cc:6276: int length = size * 2; On 2015/06/03 10:44:51, ...
5 years, 6 months ago (2015-06-03 15:35:30 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1157843006/20001
5 years, 6 months ago (2015-06-03 15:36:05 UTC) #10
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 6 months ago (2015-06-03 16:32:57 UTC) #11
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/353310b7c11fcdf7fa41c64d63109e9a017d90b1 Cr-Commit-Position: refs/heads/master@{#28793}
5 years, 6 months ago (2015-06-03 16:33:06 UTC) #12
Jakob Kummerow
DBC. https://codereview.chromium.org/1157843006/diff/20001/src/api.cc File src/api.cc (right): https://codereview.chromium.org/1157843006/diff/20001/src/api.cc#newcode6276 src/api.cc:6276: int length = size * 2; On 2015/06/03 ...
5 years, 6 months ago (2015-06-05 15:05:47 UTC) #14
adamk
5 years, 6 months ago (2015-06-05 17:42:20 UTC) #15
Message was sent while issue was closed.
https://codereview.chromium.org/1157843006/diff/20001/src/api.cc
File src/api.cc (right):

https://codereview.chromium.org/1157843006/diff/20001/src/api.cc#newcode6276
src/api.cc:6276: int length = size * 2;
On 2015/06/05 15:05:47, Jakob wrote:
> On 2015/06/03 15:35:30, adamk wrote:
> > On 2015/06/03 10:44:51, jochen wrote:
> > > can this overflow?
> > 
> > NumberOfElements is stored in a Smi and is guaranteed to be positive, so I
> don't
> > think so.
> 
> Uhm... I don't follow this reasoning. On 64-bit platforms, Smis and ints both
> have 32 bits including the sign, so a value close to the maximum can
absolutely
> overflow when you *2 it. Please use CheckedNumerics (from safe_math.h) for
> anything that comes even remotely close to the overflow threshold, and is
> stability/security sensitive like allocations and indexed accesses are.

Sorry, my reason was indeed bogus (I must have been thinking of 31-bit Smis),
but this is safe because OrderedHashTable::kMaxCapacity <
FixedArray::kMaxLength, which itself is already bounded well below int overflow
range.

Powered by Google App Engine
This is Rietveld 408576698