147 }
148 private static MethodHandle objectGetter(final int slot) {
149 return Accessors.getCached(slot, false, true);
150 }
151 private static MethodHandle objectSetter(final int slot) {
152 return Accessors.getCached(slot, false, false);
153 }
154
155 /**
156 * Constructor for spill properties. Array getters and setters will be created on demand.
157 *
158 * @param key the property key
159 * @param flags the property flags
160 * @param slot spill slot
161 */
162 public SpillProperty(final String key, final int flags, final int slot) {
163 super(key, flags, slot, primitiveGetter(slot), primitiveSetter(slot), objectGetter(slot), objectSetter(slot));
164 assert !OBJECT_FIELDS_ONLY || getLocalType() == Object.class;
165 }
166
167 SpillProperty(final String key, final int flags, final int slot, final Class<?> initialType) {
168 this(key, flags, slot);
169 setType(OBJECT_FIELDS_ONLY ? Object.class : initialType);
170 }
171
172 SpillProperty(final String key, final int flags, final int slot, final ScriptObject owner, final Object initialValue) {
173 this(key, flags, slot);
174 setInitialValue(owner, initialValue);
175 }
176
177 /**
178 * Copy constructor
179 * @param property other property
180 */
181 protected SpillProperty(final SpillProperty property) {
182 super(property);
183 }
184
185 /**
186 * Copy constructor
187 * @param newType new type
|
147 }
148 private static MethodHandle objectGetter(final int slot) {
149 return Accessors.getCached(slot, false, true);
150 }
151 private static MethodHandle objectSetter(final int slot) {
152 return Accessors.getCached(slot, false, false);
153 }
154
155 /**
156 * Constructor for spill properties. Array getters and setters will be created on demand.
157 *
158 * @param key the property key
159 * @param flags the property flags
160 * @param slot spill slot
161 */
162 public SpillProperty(final String key, final int flags, final int slot) {
163 super(key, flags, slot, primitiveGetter(slot), primitiveSetter(slot), objectGetter(slot), objectSetter(slot));
164 assert !OBJECT_FIELDS_ONLY || getLocalType() == Object.class;
165 }
166
167 /**
168 * Constructor for spill properties with an initial type.
169 * @param key the property key
170 * @param flags the property flags
171 * @param slot spill slot
172 * @param initialType initial type
173 */
174 public SpillProperty(final String key, final int flags, final int slot, final Class<?> initialType) {
175 this(key, flags, slot);
176 setType(OBJECT_FIELDS_ONLY ? Object.class : initialType);
177 }
178
179 SpillProperty(final String key, final int flags, final int slot, final ScriptObject owner, final Object initialValue) {
180 this(key, flags, slot);
181 setInitialValue(owner, initialValue);
182 }
183
184 /**
185 * Copy constructor
186 * @param property other property
187 */
188 protected SpillProperty(final SpillProperty property) {
189 super(property);
190 }
191
192 /**
193 * Copy constructor
194 * @param newType new type
|