public final ShapeImpl applyTransition(Transition transition, boolean append) { if (transition instanceof AddPropertyTransition) { return append ? append(((AddPropertyTransition) transition).getProperty()) : addProperty(((AddPropertyTransition) transition).getProperty()); } else if (transition instanceof ObjectTypeTransition) { return changeType(((ObjectTypeTransition) transition).getObjectType()); } else if (transition instanceof ReservePrimitiveArrayTransition) { return reservePrimitiveExtensionArray(); } else { throw new UnsupportedOperationException(); } }
/** @since 0.17 or earlier */ @TruffleBoundary @Override public final ShapeImpl append(Property oldProperty) { return addProperty(oldProperty.relocate(allocator().moveLocation(oldProperty.getLocation()))); }
@TruffleBoundary @Override public final ShapeImpl append(Property oldProperty) { return addProperty(oldProperty.relocate(allocator().moveLocation(oldProperty.getLocation()))); }
/** @since 0.17 or earlier */ @TruffleBoundary @Override public final ShapeImpl append(Property oldProperty) { return addProperty(oldProperty.relocate(allocator().moveLocation(oldProperty.getLocation()))); }
Transition transition = iterator.previous(); if (transition instanceof AddPropertyTransition && ((AddPropertyTransition) transition).getProperty().getKey().equals(newProperty.getKey())) { newShape = newShape.addProperty(newProperty); } else { newShape = newShape.applyTransition(transition, false);
/** @since 0.17 or earlier */ protected ShapeImpl defineProperty(ShapeImpl oldShape, Object key, Object value, int flags, LocationFactory locationFactory, Property existing) { if (existing == null) { Property property = Property.create(key, locationFactory.createLocation(oldShape, value), flags); ShapeImpl newShape = oldShape.addProperty(property); return newShape; } else { if (existing.getFlags() == flags) { if (existing.getLocation().canSet(value)) { return oldShape; } else { return definePropertyGeneralize(oldShape, existing, value, locationFactory); } } else { return definePropertyChangeFlags(oldShape, existing, value, flags); } } }
/** @since 0.17 or earlier */ protected ShapeImpl defineProperty(ShapeImpl oldShape, Object key, Object value, int flags, LocationFactory locationFactory, Property existing) { if (existing == null) { Property property = Property.create(key, locationFactory.createLocation(oldShape, value), flags); ShapeImpl newShape = oldShape.addProperty(property); return newShape; } else { if (existing.getFlags() == flags) { if (existing.getLocation().canSet(value)) { return oldShape; } else { return definePropertyGeneralize(oldShape, existing, value, locationFactory); } } else { return definePropertyChangeFlags(oldShape, existing, value, flags); } } }
@Override @TruffleBoundary public void define(Object id, Object value, int flags, LocationFactory locationFactory) { ShapeImpl oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing == null) { updateShape(); oldShape = getShape(); Shape newShape = oldShape.addProperty(Property.create(id, locationFactory.createLocation(oldShape, value), flags)); updateShape(); newShape.getLastProperty().setGeneric(this, value, oldShape, newShape); } else { defineExisting(id, value, flags, existing, oldShape); } }
@Override @TruffleBoundary public void define(Object id, Object value, int flags) { ShapeImpl oldShape = getShape(); Property existing = oldShape.getProperty(id); if (existing == null) { updateShape(); oldShape = getShape(); Shape newShape = oldShape.addProperty(Property.create(id, oldShape.allocator().locationForValue(value, true, true), flags)); updateShape(); newShape.getLastProperty().setGeneric(this, value, oldShape, newShape); } else { defineExisting(id, value, flags, existing, oldShape); } }