Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/objects.cc

Issue 2737373003: Move CopyValuesTo to SeededNumberDictionary. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 15792 matching lines...) Expand 10 before | Expand all | Expand 10 after
15803 } 15803 }
15804 } 15804 }
15805 template <typename Derived, typename Shape, typename Key> 15805 template <typename Derived, typename Shape, typename Key>
15806 void Dictionary<Derived, Shape, Key>::Print() { 15806 void Dictionary<Derived, Shape, Key>::Print() {
15807 OFStream os(stdout); 15807 OFStream os(stdout);
15808 Print(os); 15808 Print(os);
15809 } 15809 }
15810 #endif 15810 #endif
15811 15811
15812 15812
15813 template<typename Derived, typename Shape, typename Key>
15814 void Dictionary<Derived, Shape, Key>::CopyValuesTo(FixedArray* elements) {
15815 Isolate* isolate = this->GetIsolate();
15816 int pos = 0;
15817 int capacity = this->Capacity();
15818 DisallowHeapAllocation no_gc;
15819 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
15820 for (int i = 0; i < capacity; i++) {
15821 Object* k = this->KeyAt(i);
15822 if (this->IsKey(isolate, k)) {
15823 elements->set(pos++, this->ValueAt(i), mode);
15824 }
15825 }
15826 DCHECK(pos == elements->length());
15827 }
15828
15829
15830 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it, 15813 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it,
15831 bool* done) { 15814 bool* done) {
15832 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state()); 15815 DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state());
15833 return GetPropertyWithInterceptorInternal(it, it->GetInterceptor(), done); 15816 return GetPropertyWithInterceptorInternal(it, it->GetInterceptor(), done);
15834 } 15817 }
15835 15818
15836 Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object, 15819 Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object,
15837 Handle<Name> name) { 15820 Handle<Name> name) {
15838 LookupIterator it = LookupIterator::PropertyOrElement( 15821 LookupIterator it = LookupIterator::PropertyOrElement(
15839 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); 15822 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
17973 return dictionary->Shrink(dictionary, key); 17956 return dictionary->Shrink(dictionary, key);
17974 } 17957 }
17975 17958
17976 Handle<SeededNumberDictionary> SeededNumberDictionary::AtNumberPut( 17959 Handle<SeededNumberDictionary> SeededNumberDictionary::AtNumberPut(
17977 Handle<SeededNumberDictionary> dictionary, uint32_t key, 17960 Handle<SeededNumberDictionary> dictionary, uint32_t key,
17978 Handle<Object> value, Handle<JSObject> dictionary_holder) { 17961 Handle<Object> value, Handle<JSObject> dictionary_holder) {
17979 dictionary->UpdateMaxNumberKey(key, dictionary_holder); 17962 dictionary->UpdateMaxNumberKey(key, dictionary_holder);
17980 return AtPut(dictionary, key, value); 17963 return AtPut(dictionary, key, value);
17981 } 17964 }
17982 17965
17966 void SeededNumberDictionary::CopyValuesTo(FixedArray* elements) {
17967 Isolate* isolate = this->GetIsolate();
17968 int pos = 0;
17969 int capacity = this->Capacity();
17970 DisallowHeapAllocation no_gc;
17971 WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
17972 for (int i = 0; i < capacity; i++) {
17973 Object* k = this->KeyAt(i);
17974 if (this->IsKey(isolate, k)) {
17975 elements->set(pos++, this->ValueAt(i), mode);
17976 }
17977 }
17978 DCHECK(pos == elements->length());
17979 }
17983 17980
17984 Handle<UnseededNumberDictionary> UnseededNumberDictionary::AtNumberPut( 17981 Handle<UnseededNumberDictionary> UnseededNumberDictionary::AtNumberPut(
17985 Handle<UnseededNumberDictionary> dictionary, 17982 Handle<UnseededNumberDictionary> dictionary,
17986 uint32_t key, 17983 uint32_t key,
17987 Handle<Object> value) { 17984 Handle<Object> value) {
17988 return AtPut(dictionary, key, value); 17985 return AtPut(dictionary, key, value);
17989 } 17986 }
17990 17987
17991 Handle<SeededNumberDictionary> SeededNumberDictionary::Set( 17988 Handle<SeededNumberDictionary> SeededNumberDictionary::Set(
17992 Handle<SeededNumberDictionary> dictionary, uint32_t key, 17989 Handle<SeededNumberDictionary> dictionary, uint32_t key,
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after
20245 // depend on this. 20242 // depend on this.
20246 return DICTIONARY_ELEMENTS; 20243 return DICTIONARY_ELEMENTS;
20247 } 20244 }
20248 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20245 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20249 return kind; 20246 return kind;
20250 } 20247 }
20251 } 20248 }
20252 20249
20253 } // namespace internal 20250 } // namespace internal
20254 } // namespace v8 20251 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698