DescriptionVM library tweaks to avoid megamorphic calls in dart2js
Problems this addresses:
1. dart2js has hashCode functions like
get hashCode = this.x.hashCode + 17 * this.y.hashCode
When x and y are ints or bools VM optimizing compiler inlined the call
to Object.hashCode and generated MegamorphicLookups for
Object._identityHashCode.
2. HashMaps with _Smi keys had a double MegamorphicLookup: The hash
table reasonably calls MegamorphicLookup(get:hashCode) which returns
Object.hashCode; the compiled Object.hashCode is essentially
MegamorphicLookup(get:_identityHashCode), which returns
_Smi._identityHashCode which finally returns 'this'.
3. _interpolateSingle's call to o.toString() is megamorphic. We can
avoid it for the common case of String arguments, this is often
comming from StringBuffer.write() with a literal or interpolated
argument.
R=srdjan@google.com
Committed: https://github.com/dart-lang/sdk/commit/dce10bba79f388932e5fb912db4c78701343c57b
Patch Set 1 #
Messages
Total messages: 7 (3 generated)
|