8161929: FindProperty.isInherited never used standalone
Reviewed-by: hannesw, sundar
This commit is contained in:
parent
66aefdf36e
commit
1fa516e4cc
@ -127,7 +127,7 @@ public final class FindProperty {
|
||||
// Fold an accessor getter into the method handle of a user accessor property.
|
||||
private MethodHandle insertAccessorsGetter(final UserAccessorProperty uap, final LinkRequest request, final MethodHandle mh) {
|
||||
MethodHandle superGetter = uap.getAccessorsGetter();
|
||||
if (isInherited()) {
|
||||
if (!isSelf()) {
|
||||
superGetter = ScriptObject.addProtoFilter(superGetter, getProtoChainLength());
|
||||
}
|
||||
if (request != null && !(request.getReceiver() instanceof ScriptObject)) {
|
||||
@ -183,11 +183,12 @@ public final class FindProperty {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the property found was inherited, i.e. not directly in the self
|
||||
* @return true if inherited property
|
||||
* Check if the property found was inherited from a prototype and it is an ordinary
|
||||
* property (one that has no accessor function).
|
||||
* @return true if the found property is an inherited ordinary property
|
||||
*/
|
||||
public boolean isInherited() {
|
||||
return self != prototype;
|
||||
public boolean isInheritedOrdinaryProperty() {
|
||||
return !isSelf() && !getProperty().isAccessorProperty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -796,7 +796,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
* @param start the object on which the lookup was originally initiated
|
||||
* @return FindPropertyData or null if not found.
|
||||
*/
|
||||
protected FindProperty findProperty(final Object key, final boolean deep, boolean isScope, final ScriptObject start) {
|
||||
protected FindProperty findProperty(final Object key, final boolean deep, final boolean isScope, final ScriptObject start) {
|
||||
|
||||
final PropertyMap selfMap = getMap();
|
||||
final Property property = selfMap.findProperty(key);
|
||||
@ -2184,7 +2184,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
FindProperty find = findProperty(name, true, NashornCallSiteDescriptor.isScope(desc), this);
|
||||
|
||||
// If it's not a scope search, then we don't want any inherited properties except those with user defined accessors.
|
||||
if (find != null && find.isInherited() && !find.getProperty().isAccessorProperty()) {
|
||||
if (find != null && find.isInheritedOrdinaryProperty()) {
|
||||
// We should still check if inherited data property is not writable
|
||||
if (isExtensible() && !find.getProperty().isWritable()) {
|
||||
return createEmptySetMethod(desc, explicitInstanceOfCheck, "property.not.writable", true);
|
||||
@ -3044,7 +3044,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
|
||||
|
||||
invalidateGlobalConstant(key);
|
||||
|
||||
if (f != null && f.isInherited() && !f.getProperty().isAccessorProperty()) {
|
||||
if (f != null && f.isInheritedOrdinaryProperty()) {
|
||||
final boolean isScope = isScopeFlag(callSiteFlags);
|
||||
// If the start object of the find is not this object it means the property was found inside a
|
||||
// 'with' statement expression (see WithObject.findProperty()). In this case we forward the 'set'
|
||||
|
@ -170,7 +170,7 @@ final class SetMethodCreator {
|
||||
assert property != null;
|
||||
|
||||
final MethodHandle boundHandle;
|
||||
if (!property.isAccessorProperty() && find.isInherited()) {
|
||||
if (find.isInheritedOrdinaryProperty()) {
|
||||
boundHandle = ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength());
|
||||
} else {
|
||||
boundHandle = methodHandle;
|
||||
|
@ -117,7 +117,7 @@ public final class PrimitiveLookup {
|
||||
return new GuardedInvocation(GlobalConstants.staticConstantGetter(find.getObjectValue()), guard, sp, null);
|
||||
}
|
||||
|
||||
if (find.isInherited() && !(find.getProperty().isAccessorProperty())) {
|
||||
if (find.isInheritedOrdinaryProperty()) {
|
||||
// If property is found in the prototype object bind the method handle directly to
|
||||
// the proto filter instead of going through wrapper instantiation below.
|
||||
final ScriptObject proto = wrappedReceiver.getProto();
|
||||
|
Loading…
x
Reference in New Issue
Block a user