src/jdk/nashorn/internal/runtime/ScriptObject.java

changeset 380
80c66d3fd872
parent 379
682889823712
child 382
d1886ad46f0c
equal deleted inserted replaced
379:682889823712 380:80c66d3fd872
168 if (Context.DEBUG) { 168 if (Context.DEBUG) {
169 ScriptObject.count++; 169 ScriptObject.count++;
170 } 170 }
171 171
172 this.arrayData = ArrayData.EMPTY_ARRAY; 172 this.arrayData = ArrayData.EMPTY_ARRAY;
173 173 this.setMap(map == null ? PropertyMap.newMap(getClass()) : map);
174 if (map == null) { 174 }
175 this.setMap(PropertyMap.newMap(getClass())); 175
176 return; 176 /**
177 } 177 * Constructor that directly sets the prototype to {@code proto} and property map to
178 178 * {@code map} without invalidating the map as calling {@link #setProto(ScriptObject)}
179 this.setMap(map); 179 * would do. This should only be used for objects that are always constructed with the
180 * same combination of prototype and property map.
181 *
182 * @param proto the prototype object
183 * @param map intial {@link PropertyMap}
184 */
185 protected ScriptObject(final ScriptObject proto, final PropertyMap map) {
186 if (Context.DEBUG) {
187 ScriptObject.count++;
188 }
189
190 this.arrayData = ArrayData.EMPTY_ARRAY;
191 this.setMap(map == null ? PropertyMap.newMap(getClass()) : map);
192 this.proto = proto;
193
194 if (proto != null) {
195 proto.setIsPrototype();
196 }
180 } 197 }
181 198
182 /** 199 /**
183 * Copy all properties from the source object with their receiver bound to the source. 200 * Copy all properties from the source object with their receiver bound to the source.
184 * This function was known as mergeMap 201 * This function was known as mergeMap

mercurial