Commit 1f2a31c8 authored by yangguo's avatar yangguo Committed by Commit bot

Move CopyValuesTo to SeededNumberDictionary.

R=ishell@chromium.org
BUG=v8:6073

Review-Url: https://codereview.chromium.org/2737373003
Cr-Commit-Position: refs/heads/master@{#43703}
parent 3fae880f
......@@ -15810,23 +15810,6 @@ void Dictionary<Derived, Shape, Key>::Print() {
#endif
template<typename Derived, typename Shape, typename Key>
void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) {
Isolate* isolate = this->GetIsolate();
int pos = 0;
int capacity = this->Capacity();
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
for (int i = 0; i < capacity; i++) {
Object* k = this->KeyAt(i);
if (this->IsKey(isolate, k)) {
elements->set(pos++, this->ValueAt(i), mode);
}
}
DCHECK(pos == elements->length());
}
MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it,
bool* done) {
DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state());
......@@ -17980,6 +17963,20 @@ Handle<SeededNumberDictionary> SeededNumberDictionary::AtNumberPut(
return AtPut(dictionary, key, value);
}
void SeededNumberDictionary::CopyValuesTo(FixedArray* elements) {
Isolate* isolate = this->GetIsolate();
int pos = 0;
int capacity = this->Capacity();
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
for (int i = 0; i < capacity; i++) {
Object* k = this->KeyAt(i);
if (this->IsKey(isolate, k)) {
elements->set(pos++, this->ValueAt(i), mode);
}
}
DCHECK(pos == elements->length());
}
Handle<UnseededNumberDictionary> UnseededNumberDictionary::AtNumberPut(
Handle<UnseededNumberDictionary> dictionary,
......
......@@ -3607,10 +3607,6 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
return DerivedHashTable::Shrink(dictionary, key);
}
// Sorting support
// TODO(dcarney): templatize or move to SeededNumberDictionary
void CopyValuesTo(FixedArray* elements);
// Returns the number of elements in the dictionary filtering out properties
// with the specified attributes.
int NumberOfElementsFilterAttributes(PropertyFilter filter);
......@@ -3877,6 +3873,9 @@ class SeededNumberDictionary
// non-configurable, non-enumerable, or have getters/setters.
bool HasComplexElements();
// Sorting support
void CopyValuesTo(FixedArray* elements);
// If slow elements are required we will never go back to fast-case
// for the elements kept in this dictionary. We require slow
// elements if an element has been added at an index larger than
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment