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

Side by Side Diff: src/objects.cc

Issue 1637753004: [es7] refactor and fix Object.values() / Object.entries() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: keepin it fresh Created 4 years, 10 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
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 <sstream> 9 #include <sstream>
10 10
(...skipping 8903 matching lines...) Expand 10 before | Expand all | Expand 10 after
8914 Isolate* isolate = object->GetIsolate(); 8914 Isolate* isolate = object->GetIsolate();
8915 KeyAccumulator accumulator(isolate, filter); 8915 KeyAccumulator accumulator(isolate, filter);
8916 MAYBE_RETURN( 8916 MAYBE_RETURN(
8917 GetKeys_Internal(isolate, object, object, type, filter, &accumulator), 8917 GetKeys_Internal(isolate, object, object, type, filter, &accumulator),
8918 MaybeHandle<FixedArray>()); 8918 MaybeHandle<FixedArray>());
8919 Handle<FixedArray> keys = accumulator.GetKeys(keys_conversion); 8919 Handle<FixedArray> keys = accumulator.GetKeys(keys_conversion);
8920 DCHECK(ContainsOnlyValidKeys(keys)); 8920 DCHECK(ContainsOnlyValidKeys(keys));
8921 return keys; 8921 return keys;
8922 } 8922 }
8923 8923
8924 MaybeHandle<FixedArray> JSReceiver::GetOwnValues(
8925 Handle<JSReceiver> object, PropertyFilter filter,
8926 GetKeysConversion keys_conversion) {
8927 USE(ContainsOnlyValidKeys);
Camillo Bruni 2016/02/03 12:03:48 Probably you wanted to add a DCHECK(ContainsOnlyVa
caitp (gmail) 2016/02/03 12:57:30 Not sure why I added this, copy/paste code? There
8928 Isolate* isolate = object->GetIsolate();
8929 KeyAccumulator accumulator(isolate, filter);
8930 MAYBE_RETURN(
8931 GetKeys_Internal(isolate, object, object, OWN_ONLY, filter, &accumulator),
8932 MaybeHandle<FixedArray>());
8933 return accumulator.GetValues(object, keys_conversion);
8934 }
8935
8936 MaybeHandle<FixedArray> JSReceiver::GetOwnEntries(
8937 Handle<JSReceiver> object, PropertyFilter filter,
8938 GetKeysConversion keys_conversion) {
8939 USE(ContainsOnlyValidKeys);
Camillo Bruni 2016/02/03 12:03:49 same here :)
8940 Isolate* isolate = object->GetIsolate();
8941 KeyAccumulator accumulator(isolate, filter);
8942 MAYBE_RETURN(
8943 GetKeys_Internal(isolate, object, object, OWN_ONLY, filter, &accumulator),
8944 MaybeHandle<FixedArray>());
8945 return accumulator.GetEntries(object, keys_conversion);
8946 }
8924 8947
8925 bool Map::DictionaryElementsInPrototypeChainOnly() { 8948 bool Map::DictionaryElementsInPrototypeChainOnly() {
8926 if (IsDictionaryElementsKind(elements_kind())) { 8949 if (IsDictionaryElementsKind(elements_kind())) {
8927 return false; 8950 return false;
8928 } 8951 }
8929 8952
8930 for (PrototypeIterator iter(this); !iter.IsAtEnd(); iter.Advance()) { 8953 for (PrototypeIterator iter(this); !iter.IsAtEnd(); iter.Advance()) {
8931 // Be conservative, don't walk into proxies. 8954 // Be conservative, don't walk into proxies.
8932 if (iter.GetCurrent()->IsJSProxy()) return true; 8955 if (iter.GetCurrent()->IsJSProxy()) return true;
8933 // String wrappers have non-configurable, non-writable elements. 8956 // String wrappers have non-configurable, non-writable elements.
(...skipping 10815 matching lines...) Expand 10 before | Expand all | Expand 10 after
19749 if (cell->value() != *new_value) { 19772 if (cell->value() != *new_value) {
19750 cell->set_value(*new_value); 19773 cell->set_value(*new_value);
19751 Isolate* isolate = cell->GetIsolate(); 19774 Isolate* isolate = cell->GetIsolate();
19752 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19775 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19753 isolate, DependentCode::kPropertyCellChangedGroup); 19776 isolate, DependentCode::kPropertyCellChangedGroup);
19754 } 19777 }
19755 } 19778 }
19756 19779
19757 } // namespace internal 19780 } // namespace internal
19758 } // namespace v8 19781 } // namespace v8
OLDNEW
« src/key-accumulator.cc ('K') | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698