Skip to content

Commit 31d7c6a

Browse files
committed
Add condition profile.
1 parent 4fb6794 commit 31d7c6a

File tree

1 file changed

+4
-2
lines changed
  • truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object

1 file changed

+4
-2
lines changed

truffle/src/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObject.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
import com.oracle.truffle.api.nodes.Node;
7373
import com.oracle.truffle.api.nodes.UnexpectedResultException;
7474
import com.oracle.truffle.api.object.DynamicObjectLibraryImpl.RemovePlan;
75+
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
7576

7677
import sun.misc.Unsafe;
7778

@@ -1713,9 +1714,10 @@ static int doCached(DynamicObject receiver, Object key, int defaultValue,
17131714
}
17141715

17151716
@Specialization(replaces = "doCached")
1716-
static int doGeneric(DynamicObject receiver, Object key, int defaultValue) {
1717+
final int doGeneric(DynamicObject receiver, Object key, int defaultValue,
1718+
@Cached InlinedConditionProfile isPropertyNonNull) {
17171719
Property property = receiver.getShape().getProperty(key);
1718-
return property != null ? property.getFlags() : defaultValue;
1720+
return isPropertyNonNull.profile(this, property != null) ? property.getFlags() : defaultValue;
17191721
}
17201722

17211723
/**

0 commit comments

Comments
 (0)