private ShapeImpl addPrimitiveExtensionArray() { assert layout.hasPrimitiveExtensionArray() && !hasPrimitiveArray(); Transition transition = new ReservePrimitiveArrayTransition(); ShapeImpl cachedShape = queryTransition(transition); if (cachedShape != null) { return cachedShape; } ShapeImpl oldShape = (ShapeImpl) layout.getStrategy().ensureSpace(this, layout.getPrimitiveArrayLocation()); ShapeImpl newShape = makeShapeWithPrimitiveExtensionArray(oldShape, transition); oldShape.addDirectTransition(transition, newShape); return newShape; }
/** @since 0.17 or earlier */ protected ShapeImpl addProperty(ShapeImpl shape, Property property, boolean ensureValid) { assert !(shape.hasProperty(property.getKey())) : "duplicate property " + property.getKey(); AddPropertyTransition addTransition = new AddPropertyTransition(property); ShapeImpl cachedShape = shape.queryTransition(addTransition); if (cachedShape != null) { return ensureValid ? ensureValid(cachedShape) : cachedShape; } ShapeImpl oldShape = ensureSpace(shape, property.getLocation()); ShapeImpl newShape = ShapeImpl.makeShapeWithAddedProperty(oldShape, addTransition); oldShape.addDirectTransition(addTransition, newShape); return newShape; }
/** @since 0.17 or earlier */ protected ShapeImpl addProperty(ShapeImpl shape, Property property, boolean ensureValid) { assert !(shape.hasProperty(property.getKey())) : "duplicate property " + property.getKey(); AddPropertyTransition addTransition = new AddPropertyTransition(property); ShapeImpl cachedShape = shape.queryTransition(addTransition); if (cachedShape != null) { return ensureValid ? ensureValid(cachedShape) : cachedShape; } ShapeImpl oldShape = ensureSpace(shape, property.getLocation()); ShapeImpl newShape = ShapeImpl.makeShapeWithAddedProperty(oldShape, addTransition); oldShape.addDirectTransition(addTransition, newShape); return newShape; }
/** @since 0.17 or earlier */ protected ShapeImpl addPrimitiveExtensionArray(ShapeImpl shape) { LayoutImpl layout = shape.getLayout(); assert layout.hasPrimitiveExtensionArray() && !shape.hasPrimitiveArray(); Transition transition = new ReservePrimitiveArrayTransition(); ShapeImpl cachedShape = shape.queryTransition(transition); if (cachedShape != null) { return layout.getStrategy().ensureValid(cachedShape); } ShapeImpl oldShape = ensureSpace(shape, layout.getPrimitiveArrayLocation()); ShapeImpl newShape = ShapeImpl.makeShapeWithPrimitiveExtensionArray(oldShape, transition); oldShape.addDirectTransition(transition, newShape); return newShape; }
/** @since 0.17 or earlier */ protected ShapeImpl addPrimitiveExtensionArray(ShapeImpl shape) { LayoutImpl layout = shape.getLayout(); assert layout.hasPrimitiveExtensionArray() && !shape.hasPrimitiveArray(); Transition transition = new ReservePrimitiveArrayTransition(); ShapeImpl cachedShape = shape.queryTransition(transition); if (cachedShape != null) { return layout.getStrategy().ensureValid(cachedShape); } ShapeImpl oldShape = ensureSpace(shape, layout.getPrimitiveArrayLocation()); ShapeImpl newShape = ShapeImpl.makeShapeWithPrimitiveExtensionArray(oldShape, transition); oldShape.addDirectTransition(transition, newShape); return newShape; }
/** * Add a new property in the map, yielding a new or cached Shape object. * * In contrast to {@link ShapeImpl#addProperty(Property)}, this method does not care about * obsolete shapes. * * @see #addProperty(Property) */ private ShapeImpl addPropertyInternal(Property prop) { CompilerAsserts.neverPartOfCompilation(); assert prop.isShadow() || !(this.hasProperty(prop.getKey())) : "duplicate property " + prop.getKey(); // assertion caused performance issues on e.g. testv8 regress-619.js // assert !getPropertyListInternal(false).contains(prop); AddPropertyTransition addTransition = new AddPropertyTransition(prop); ShapeImpl cachedShape = queryTransition(addTransition); if (cachedShape != null) { return cachedShape; } ShapeImpl oldShape = (ShapeImpl) layout.getStrategy().ensureSpace(this, prop.getLocation()); ShapeImpl newShape = makeShapeWithAddedProperty(oldShape, addTransition); oldShape.addDirectTransition(addTransition, newShape); return newShape; }