# HG changeset patch # User Andreas Woess # Date 1417185829 -3600 # Node ID a306a94111a64a461c80800260d173a40785a4f5 # Parent b3b241bbbbdb49e956f8e46866608c5ffbd36fbd OM: iterate over properties using property map instead of parent chain diff -r b3b241bbbbdb -r a306a94111a6 graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java --- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java Thu Dec 04 13:35:36 2014 +0100 +++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java Fri Nov 28 15:43:49 2014 +0100 @@ -455,8 +455,7 @@ @Override public final List getPropertyList(Pred filter) { LinkedList props = new LinkedList<>(); - next: for (ShapeImpl current = this; current != getRoot(); current = current.parent) { - Property currentProperty = current.getLastProperty(); + next: for (Property currentProperty : this.propertyMap.reverseOrderValues()) { if (!currentProperty.isHidden() && filter.test(currentProperty)) { if (currentProperty.getLocation() instanceof DeclaredLocation) { for (Iterator iter = props.iterator(); iter.hasNext();) { @@ -488,11 +487,11 @@ @Override public final List getPropertyListInternal(boolean ascending) { LinkedList props = new LinkedList<>(); - for (ShapeImpl current = this; current != getRoot(); current = current.parent) { + for (Property current : this.propertyMap.reverseOrderValues()) { if (ascending) { - props.addFirst(current.getLastProperty()); + props.addFirst(current); } else { - props.add(current.getLastProperty()); + props.add(current); } } return props; @@ -507,8 +506,7 @@ @Override public final List getKeyList(Pred filter) { LinkedList keys = new LinkedList<>(); - for (ShapeImpl current = this; current != getRoot(); current = current.parent) { - Property currentProperty = current.getLastProperty(); + for (Property currentProperty : this.propertyMap.reverseOrderValues()) { if (!currentProperty.isHidden() && filter.test(currentProperty) && !currentProperty.isShadow()) { keys.addFirst(currentProperty.getKey()); }