Review request for JDK-8006766: Array-like access to characters of a string is slow
Hannes Wallnoefer
hannes.wallnoefer at oracle.com
Fri Jan 25 05:49:14 PST 2013
I've uploaded a new patch based on feedback by Marcus (static
NativeString.get methods are now private).
http://cr.openjdk.java.net/~hannesw/8006766/
Attila: I found that both CallSiteDescriptor and LinkRequest parameters
are actually required in ScriptObject.lookup() as
ScriptObject.findCallMethodMethod() calls findGetMethod() with a
*modified* CallSiteDescriptor (ScriptObject.java line 1587) which,
through overridden noSuchProperty/noSuchMethod methods, may get fed back
to lookup().
Hannes
Am 2013-01-24 15:35, schrieb Hannes Wallnoefer:
> Please review JDK-8006766 (Array-like access to characters of a string
> is slow) at
>
> http://cr.openjdk.java.net/~hannesw/8006766/
>
> This overrides ScriptObject.findGetIndexMethod() in NativeString to
> avoid creating a NativeString wrapper for array-like access to the
> characters of a string (e.g. "foo"[0]). Performance gain as measured
> by test/examples/string-micro.js is about 3x.
>
> The larger part of this patch involves changing the signature of
> ScriptObject.lookup() and related methods to take the LinkRequest
> object as second parameter.
>
> This is necessary to make sure we're actually dealing with a primitive
> JS string vs. a wrapped String object in
> NativeString.findGetIndexMethod(). It also helped rewrite my patch for
> JDK-8006570 (this-value for non-strict functions should be converted
> to object) in a much nicer way, doing it locally in
> ScriptFunction.findCallMethod() rather than centrally in
> NashornLinker.getGuardedInvocation().
>
> Hannes
>
More information about the nashorn-dev
mailing list