8134403: Nashorn react.js benchmark performance regression
Reviewed-by: hannesw, sundar
This commit is contained in:
parent
089307f286
commit
d883302b01
@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
package jdk.nashorn.internal.runtime;
|
||||
|
||||
import static jdk.nashorn.internal.lookup.Lookup.MH;
|
||||
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
|
||||
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
|
||||
@ -34,6 +33,7 @@ import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALL
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.util.concurrent.Callable;
|
||||
import jdk.nashorn.internal.lookup.Lookup;
|
||||
import jdk.nashorn.internal.runtime.linker.Bootstrap;
|
||||
import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
|
||||
@ -80,6 +80,15 @@ public final class UserAccessorProperty extends SpillProperty {
|
||||
private final static MethodHandle INVOKE_LONG_SETTER = findOwnMH_S("invokeLongSetter", void.class, Accessors.class, MethodHandle.class, String.class, Object.class, long.class);
|
||||
private final static MethodHandle INVOKE_NUMBER_SETTER = findOwnMH_S("invokeNumberSetter", void.class, Accessors.class, MethodHandle.class, String.class, Object.class, double.class);
|
||||
|
||||
private static final Object OBJECT_GETTER_INVOKER_KEY = new Object();
|
||||
private static MethodHandle getObjectGetterInvoker() {
|
||||
return Context.getGlobal().getDynamicInvoker(OBJECT_GETTER_INVOKER_KEY, new Callable<MethodHandle>() {
|
||||
@Override
|
||||
public MethodHandle call() throws Exception {
|
||||
return getINVOKE_UA_GETTER(Object.class, INVALID_PROGRAM_POINT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static MethodHandle getINVOKE_UA_GETTER(final Class<?> returnType, final int programPoint) {
|
||||
if (UnwarrantedOptimismException.isValid(programPoint)) {
|
||||
@ -90,6 +99,16 @@ public final class UserAccessorProperty extends SpillProperty {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Object OBJECT_SETTER_INVOKER_KEY = new Object();
|
||||
private static MethodHandle getObjectSetterInvoker() {
|
||||
return Context.getGlobal().getDynamicInvoker(OBJECT_SETTER_INVOKER_KEY, new Callable<MethodHandle>() {
|
||||
@Override
|
||||
public MethodHandle call() throws Exception {
|
||||
return getINVOKE_UA_SETTER(Object.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static MethodHandle getINVOKE_UA_SETTER(final Class<?> valueType) {
|
||||
return Bootstrap.createDynamicInvoker("dyn:call", void.class, Object.class, Object.class, valueType);
|
||||
}
|
||||
@ -181,7 +200,7 @@ public final class UserAccessorProperty extends SpillProperty {
|
||||
@Override
|
||||
public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
|
||||
try {
|
||||
return invokeObjectGetter(getAccessors((owner != null) ? owner : self), getINVOKE_UA_GETTER(Object.class, INVALID_PROGRAM_POINT), self);
|
||||
return invokeObjectGetter(getAccessors((owner != null) ? owner : self), getObjectGetterInvoker(), self);
|
||||
} catch (final Error | RuntimeException t) {
|
||||
throw t;
|
||||
} catch (final Throwable t) {
|
||||
@ -207,7 +226,7 @@ public final class UserAccessorProperty extends SpillProperty {
|
||||
@Override
|
||||
public void setValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
|
||||
try {
|
||||
invokeObjectSetter(getAccessors((owner != null) ? owner : self), getINVOKE_UA_SETTER(Object.class), strict ? getKey() : null, self, value);
|
||||
invokeObjectSetter(getAccessors((owner != null) ? owner : self), getObjectSetterInvoker(), strict ? getKey() : null, self, value);
|
||||
} catch (final Error | RuntimeException t) {
|
||||
throw t;
|
||||
} catch (final Throwable t) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user