Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.object/src/com/oracle/truffle/object/DynamicObjectImpl.java @ 22145:72a6b0e49d31
remove DynamicObject#changeFlags convenience method
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Sat, 12 Sep 2015 22:47:16 +0200 |
parents | 55a3e72fe241 |
children | dc83cc1f94f2 |
comparison
equal
deleted
inserted
replaced
22144:657d37ff352e | 22145:72a6b0e49d31 |
---|---|
182 fromMap = fromMap.getParentMap(); | 182 fromMap = fromMap.getParentMap(); |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 @Override | |
188 @TruffleBoundary | 187 @TruffleBoundary |
189 public boolean changeFlags(Object id, int newFlags) { | 188 public boolean changeFlags(Object id, int newFlags) { |
190 Shape oldShape = getShape(); | 189 Shape oldShape = getShape(); |
191 Property existing = oldShape.getProperty(id); | 190 Property existing = oldShape.getProperty(id); |
192 if (existing != null) { | 191 if (existing != null) { |
193 if (existing.getFlags() != newFlags) { | |
194 Property newProperty = existing.copyWithFlags(newFlags); | |
195 Shape newShape = oldShape.replaceProperty(existing, newProperty); | |
196 this.setShape(newShape); | |
197 } | |
198 return true; | |
199 } else { | |
200 return false; | |
201 } | |
202 } | |
203 | |
204 @Override | |
205 @TruffleBoundary | |
206 public boolean changeFlags(Object id, FlagsFunction updateFunction) { | |
207 Shape oldShape = getShape(); | |
208 Property existing = oldShape.getProperty(id); | |
209 if (existing != null) { | |
210 int newFlags = updateFunction.apply(existing.getFlags()); | |
211 if (existing.getFlags() != newFlags) { | 192 if (existing.getFlags() != newFlags) { |
212 Property newProperty = existing.copyWithFlags(newFlags); | 193 Property newProperty = existing.copyWithFlags(newFlags); |
213 Shape newShape = oldShape.replaceProperty(existing, newProperty); | 194 Shape newShape = oldShape.replaceProperty(existing, newProperty); |
214 this.setShape(newShape); | 195 this.setShape(newShape); |
215 } | 196 } |