Reviewers: dstence, Erik Corry Chromium.org, michael_dawson,
Description:
PPC: Move hash code from hidden string to a private symbol
Port eca5b5d7abc0a9028cb9832087fbf2ed59dadf92
Original commit message:
* Hash code is now just done with a private own symbol instead of the hidden
string, which predates symbols.
* In the long run we should do all hidden properties this way and get rid
of the
hidden magic 0-length string with the zero hash code. The advantages
include
less complexity and being able to do things from JS in a natural way.
* Initially, the performance of weak set regressed, because it's a little
harder
to do the lookup in C++. Instead of heroics in C++ to make things faster I
moved some functionality into JS and got the performance back. JS is
supposed to
be good at looking up named properties on objects.
* This also changes hash codes of Smis so that they are always Smis.
Performance figures are in the comments to the code review. Summary: Most
of
js-perf-test/Collections is neutral. Set and Map with object keys are
40-50%
better. WeakMap is -5% and WeakSet is +9%. After the measurements, I fixed
global proxies, which cost 1% on most tests and 5% on the weak ones :-(.
In the code review comments is a patch with an example of the heroics we
could
do in C++ to make lookup faster (I hope we don't have to do this. Instead
of
checking for the property, then doing a new lookup to insert it, we could
do one
lookup and handle the addition immediately). With the current benchmarks
above
this buys us nothing, but if we go back to doing more lookups in C++
instead of
in stubs and JS then it's a win.
In a similar vein we could give the magic zero hash code to the hash code
symbol. Then when we look up the hash code we would sometimes see the table
with all the hidden properties. This dual use of the field for either the
hash
code or the table with all hidden properties and the hash code is rather
ugly,
and this CL gets rid of it. I'd be loath to bring it back. On the
benchmarks
quoted above it's slightly slower than moving the hash code lookup to JS
like in
this CL.
One worry is that the benchmark results above are more monomorphic than real
world code, so may be overstating the performance benefits of moving to
JS. I
think this is part of a general issue we have with handling polymorphic
code in
JS and any solutions there will benefit this solution, which boils down to
regular property access. Any improvement there will lift all boats.
[email protected], [email protected], [email protected]
BUG=
Please review this at https://codereview.chromium.org/1157123002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+2, -0 lines):
M src/ppc/macro-assembler-ppc.cc
Index: src/ppc/macro-assembler-ppc.cc
diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc
index
e075c170145d40c92ff99b1d765986e926294b5f..40b111649b93eb28b37440f6a0416c732e546c2c
100644
--- a/src/ppc/macro-assembler-ppc.cc
+++ b/src/ppc/macro-assembler-ppc.cc
@@ -1222,6 +1222,8 @@ void MacroAssembler::GetNumberHash(Register t0,
Register scratch) {
// hash = hash ^ (hash >> 16);
srwi(scratch, t0, Operand(16));
xor_(t0, t0, scratch);
+ // hash & 0x3fffffff
+ ExtractBitRange(t0, t0, 29, 0);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.