Mercurial > hg > graal-compiler
changeset 18622:a306a94111a6
OM: iterate over properties using property map instead of parent chain
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Fri, 28 Nov 2014 15:43:49 +0100 |
parents | b3b241bbbbdb |
children | 8bf798e8cf11 |
files | graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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<Property> getPropertyList(Pred<Property> filter) { LinkedList<Property> 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<Property> iter = props.iterator(); iter.hasNext();) { @@ -488,11 +487,11 @@ @Override public final List<Property> getPropertyListInternal(boolean ascending) { LinkedList<Property> 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<Object> getKeyList(Pred<Property> filter) { LinkedList<Object> 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()); }