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

Issue 754863002: Optimize testing for an index's existence in packed Arrays (Closed)

Created:
6 years ago by adamk
Modified:
6 years ago
CC:
v8-dev, arv (Not doing code reviews)
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Project:
v8
Visibility:
Public.

Description

Optimize testing for an index's existence in packed Arrays This patch introduces a new inline runtime function, %_HasFastPackedElements(), and uses it both in the implementation of the 'in' operator and in the array builtins to speed up testing for the existence of an index in an array. In testing with the microbenchmark on the attached bug, for example, the runtime goes from 326ms to 66ms. A reviewer might ask whether the HAS_INDEX macro is worthwhile, and I tried the same example without it, which pushed the microbenchmark up to 157ms. So it seems it's worth it to avoid the function call to IN() if we know we're dealing with arrays and numbers. BUG=v8:3701 LOG=n

Patch Set 1 #

Patch Set 2 : Made it work better #

Patch Set 3 : Slightly fixed #

Patch Set 4 : Added lots of full codegen #

Patch Set 5 : Remove non-core architectures from patch #

Patch Set 6 : Ready for review #

Patch Set 7 : All fixed #

Total comments: 2

Patch Set 8 : Revert full codegen, make it an INLINE_OPTIMIZED_FUNCTION #

Patch Set 9 : Add smi check and no side effects scope #

Patch Set 10 : Rebased for landing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+70 lines, -15 lines) Patch
M src/array.js View 1 2 3 4 5 6 13 chunks +21 lines, -12 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 9 1 chunk +29 lines, -0 lines 0 comments Download
M src/macros.py View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime.js View 1 chunk +7 lines, -2 lines 0 comments Download
M src/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -1 line 0 comments Download
M src/runtime/runtime-object.cc View 1 2 3 4 5 6 7 1 chunk +9 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (5 generated)
adamk
Hi Toon, not sure who to send this to (it's my first time adding such ...
6 years ago (2014-11-27 00:36:56 UTC) #2
Dmitry Lomov (no reviews)
https://codereview.chromium.org/754863002/diff/120001/src/runtime/runtime.h File src/runtime/runtime.h (right): https://codereview.chromium.org/754863002/diff/120001/src/runtime/runtime.h#newcode708 src/runtime/runtime.h:708: F(HasFastPackedElements, 1, 1) Is it critical for HasFastPackedElements to ...
6 years ago (2014-11-27 07:17:54 UTC) #4
adamk
https://codereview.chromium.org/754863002/diff/120001/src/runtime/runtime.h File src/runtime/runtime.h (right): https://codereview.chromium.org/754863002/diff/120001/src/runtime/runtime.h#newcode708 src/runtime/runtime.h:708: F(HasFastPackedElements, 1, 1) On 2014/11/27 07:17:54, Dmitry Lomov (chromium) ...
6 years ago (2014-12-02 19:36:21 UTC) #5
Dmitry Lomov (no reviews)
On 2014/12/02 19:36:21, adamk wrote: > https://codereview.chromium.org/754863002/diff/120001/src/runtime/runtime.h > File src/runtime/runtime.h (right): > > https://codereview.chromium.org/754863002/diff/120001/src/runtime/runtime.h#newcode708 > ...
6 years ago (2014-12-02 19:59:40 UTC) #6
adamk
Okay, I've reverted the full codegen bits for now (as this particular benchmark doesn't show ...
6 years ago (2014-12-02 21:10:14 UTC) #7
Dmitry Lomov (no reviews)
lgtm
6 years ago (2014-12-04 11:59:41 UTC) #10
Dmitry Lomov (no reviews)
On 2014/12/04 11:59:41, Dmitry Lomov (chromium) wrote: > lgtm (sorry for delay in review, I ...
6 years ago (2014-12-04 12:00:07 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/754863002/180001
6 years ago (2014-12-04 18:20:30 UTC) #13
commit-bot: I haz the power
6 years ago (2014-12-04 18:46:41 UTC) #14
Message was sent while issue was closed.
Committed patchset #10 (id:180001)

Powered by Google App Engine
This is Rietveld 408576698