Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java @ 21900:cb051c368c80
Truffle: move property notification hook to shared data, and call it on remove as well
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Wed, 10 Jun 2015 20:05:52 +0200 |
parents | c76742cc2c6f |
children | 19340125f182 |
comparison
equal
deleted
inserted
replaced
21899:4663ad4f9fbf | 21900:cb051c368c80 |
---|---|
330 */ | 330 */ |
331 @TruffleBoundary | 331 @TruffleBoundary |
332 @Override | 332 @Override |
333 public ShapeImpl addProperty(Property property) { | 333 public ShapeImpl addProperty(Property property) { |
334 assert isValid(); | 334 assert isValid(); |
335 ShapeImpl nextShape = addPropertyInternal(property); | 335 onPropertyTransition(property); |
336 objectType.onPropertyAdded(property, this, nextShape); | 336 return addPropertyInternal(property); |
337 return nextShape; | 337 } |
338 | |
339 protected final void onPropertyTransition(Property property) { | |
340 if (sharedData instanceof ShapeListener) { | |
341 ((ShapeListener) sharedData).onPropertyTransition(property.getKey()); | |
342 } | |
338 } | 343 } |
339 | 344 |
340 /** | 345 /** |
341 * Add a new property in the map, yielding a new or cached Shape object. | 346 * Add a new property in the map, yielding a new or cached Shape object. |
342 * | 347 * |
625 } | 630 } |
626 | 631 |
627 @TruffleBoundary | 632 @TruffleBoundary |
628 @Override | 633 @Override |
629 public final ShapeImpl removeProperty(Property prop) { | 634 public final ShapeImpl removeProperty(Property prop) { |
635 onPropertyTransition(prop); | |
636 | |
630 RemovePropertyTransition transition = new RemovePropertyTransition(prop); | 637 RemovePropertyTransition transition = new RemovePropertyTransition(prop); |
631 ShapeImpl cachedShape = queryTransition(transition); | 638 ShapeImpl cachedShape = queryTransition(transition); |
632 if (cachedShape != null) { | 639 if (cachedShape != null) { |
633 return cachedShape; | 640 return cachedShape; |
634 } | 641 } |