OLD | NEW |
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 8047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8058 | 8058 |
8059 MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, | 8059 MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
8060 KeyCollectionType type, | 8060 KeyCollectionType type, |
8061 PropertyFilter filter, | 8061 PropertyFilter filter, |
8062 GetKeysConversion keys_conversion, | 8062 GetKeysConversion keys_conversion, |
8063 bool filter_proxy_keys) { | 8063 bool filter_proxy_keys) { |
8064 USE(ContainsOnlyValidKeys); | 8064 USE(ContainsOnlyValidKeys); |
8065 Isolate* isolate = object->GetIsolate(); | 8065 Isolate* isolate = object->GetIsolate(); |
8066 KeyAccumulator accumulator(isolate, type, filter); | 8066 KeyAccumulator accumulator(isolate, type, filter); |
8067 accumulator.set_filter_proxy_keys(filter_proxy_keys); | 8067 accumulator.set_filter_proxy_keys(filter_proxy_keys); |
8068 MAYBE_RETURN(accumulator.GetKeys_Internal(object, object, type), | 8068 MAYBE_RETURN(accumulator.CollectKeys(object, object), |
8069 MaybeHandle<FixedArray>()); | 8069 MaybeHandle<FixedArray>()); |
8070 Handle<FixedArray> keys = accumulator.GetKeys(keys_conversion); | 8070 Handle<FixedArray> keys = accumulator.GetKeys(keys_conversion); |
8071 DCHECK(ContainsOnlyValidKeys(keys)); | 8071 DCHECK(ContainsOnlyValidKeys(keys)); |
8072 return keys; | 8072 return keys; |
8073 } | 8073 } |
8074 | 8074 |
8075 MUST_USE_RESULT Maybe<bool> FastGetOwnValuesOrEntries( | 8075 MUST_USE_RESULT Maybe<bool> FastGetOwnValuesOrEntries( |
8076 Isolate* isolate, Handle<JSReceiver> receiver, bool get_entries, | 8076 Isolate* isolate, Handle<JSReceiver> receiver, bool get_entries, |
8077 Handle<FixedArray>* result) { | 8077 Handle<FixedArray>* result) { |
8078 Handle<Map> map(JSReceiver::cast(*receiver)->map(), isolate); | 8078 Handle<Map> map(JSReceiver::cast(*receiver)->map(), isolate); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8156 if (filter == ENUMERABLE_STRINGS) { | 8156 if (filter == ENUMERABLE_STRINGS) { |
8157 Maybe<bool> fast_values_or_entries = FastGetOwnValuesOrEntries( | 8157 Maybe<bool> fast_values_or_entries = FastGetOwnValuesOrEntries( |
8158 isolate, object, get_entries, &values_or_entries); | 8158 isolate, object, get_entries, &values_or_entries); |
8159 if (fast_values_or_entries.IsNothing()) return MaybeHandle<FixedArray>(); | 8159 if (fast_values_or_entries.IsNothing()) return MaybeHandle<FixedArray>(); |
8160 if (fast_values_or_entries.FromJust()) return values_or_entries; | 8160 if (fast_values_or_entries.FromJust()) return values_or_entries; |
8161 } | 8161 } |
8162 | 8162 |
8163 PropertyFilter key_filter = | 8163 PropertyFilter key_filter = |
8164 static_cast<PropertyFilter>(filter & ~ONLY_ENUMERABLE); | 8164 static_cast<PropertyFilter>(filter & ~ONLY_ENUMERABLE); |
8165 KeyAccumulator accumulator(isolate, OWN_ONLY, key_filter); | 8165 KeyAccumulator accumulator(isolate, OWN_ONLY, key_filter); |
8166 MAYBE_RETURN(accumulator.GetKeys_Internal(object, object, OWN_ONLY), | 8166 MAYBE_RETURN(accumulator.CollectKeys(object, object), |
8167 MaybeHandle<FixedArray>()); | 8167 MaybeHandle<FixedArray>()); |
8168 Handle<FixedArray> keys = accumulator.GetKeys(CONVERT_TO_STRING); | 8168 Handle<FixedArray> keys = accumulator.GetKeys(CONVERT_TO_STRING); |
8169 DCHECK(ContainsOnlyValidKeys(keys)); | 8169 DCHECK(ContainsOnlyValidKeys(keys)); |
8170 | 8170 |
8171 values_or_entries = isolate->factory()->NewFixedArray(keys->length()); | 8171 values_or_entries = isolate->factory()->NewFixedArray(keys->length()); |
8172 int length = 0; | 8172 int length = 0; |
8173 | 8173 |
8174 for (int i = 0; i < keys->length(); ++i) { | 8174 for (int i = 0; i < keys->length(); ++i) { |
8175 Handle<Name> key = Handle<Name>::cast(handle(keys->get(i), isolate)); | 8175 Handle<Name> key = Handle<Name>::cast(handle(keys->get(i), isolate)); |
8176 | 8176 |
(...skipping 10069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18246 if (cell->value() != *new_value) { | 18246 if (cell->value() != *new_value) { |
18247 cell->set_value(*new_value); | 18247 cell->set_value(*new_value); |
18248 Isolate* isolate = cell->GetIsolate(); | 18248 Isolate* isolate = cell->GetIsolate(); |
18249 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18249 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
18250 isolate, DependentCode::kPropertyCellChangedGroup); | 18250 isolate, DependentCode::kPropertyCellChangedGroup); |
18251 } | 18251 } |
18252 } | 18252 } |
18253 | 18253 |
18254 } // namespace internal | 18254 } // namespace internal |
18255 } // namespace v8 | 18255 } // namespace v8 |
OLD | NEW |