}
+void WeakFixedArray::Compact() {
+ FixedArray* array = FixedArray::cast(this);
+ int new_length = kFirstIndex;
+ for (int i = kFirstIndex; i < array->length(); i++) {
+ Object* element = array->get(i);
+ if (element->IsSmi()) continue;
+ if (WeakCell::cast(element)->cleared()) continue;
+ array->set(new_length++, element);
+ }
+ array->Shrink(new_length);
+ set_last_used_index(0);
+}
+
+
void WeakFixedArray::Remove(Handle<HeapObject> value) {
// Optimize for the most recently added element to be removed again.
int first_index = last_used_index();
void Remove(Handle<HeapObject> value);
+ void Compact();
+
inline Object* Get(int index) const;
inline int Length() const;
// We cannot serialize typed array objects correctly.
DCHECK(!object_->IsJSTypedArray());
+ if (object_->IsPrototypeInfo()) {
+ Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users();
+ if (prototype_users->IsWeakFixedArray()) {
+ WeakFixedArray::cast(prototype_users)->Compact();
+ }
+ }
+
if (object_->IsScript()) {
// Clear cached line ends.
Object* undefined = serializer_->isolate()->heap()->undefined_value();