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 <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 20296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20307 Handle<FunctionTemplateInfo> fti = | 20307 Handle<FunctionTemplateInfo> fti = |
20308 Handle<FunctionTemplateInfo>::cast(getter); | 20308 Handle<FunctionTemplateInfo>::cast(getter); |
20309 // Check if the accessor uses a cached property. | 20309 // Check if the accessor uses a cached property. |
20310 if (!fti->cached_property_name()->IsTheHole(isolate)) { | 20310 if (!fti->cached_property_name()->IsTheHole(isolate)) { |
20311 return handle(Name::cast(fti->cached_property_name())); | 20311 return handle(Name::cast(fti->cached_property_name())); |
20312 } | 20312 } |
20313 } | 20313 } |
20314 return MaybeHandle<Name>(); | 20314 return MaybeHandle<Name>(); |
20315 } | 20315 } |
20316 | 20316 |
| 20317 // static |
| 20318 ElementsKind JSArrayIterator::ElementsKindForInstanceType(InstanceType type) { |
| 20319 DCHECK_GE(type, FIRST_ARRAY_ITERATOR_TYPE); |
| 20320 DCHECK_LE(type, LAST_ARRAY_ITERATOR_TYPE); |
| 20321 |
| 20322 if (type <= LAST_ARRAY_KEY_ITERATOR_TYPE) { |
| 20323 // Should be ignored for key iterators. |
| 20324 return FAST_ELEMENTS; |
| 20325 } else { |
| 20326 ElementsKind kind; |
| 20327 if (type < FIRST_ARRAY_VALUE_ITERATOR_TYPE) { |
| 20328 // Convert `type` to a value iterator from an entries iterator |
| 20329 type = static_cast<InstanceType>(type + |
| 20330 (FIRST_ARRAY_VALUE_ITERATOR_TYPE - |
| 20331 FIRST_ARRAY_KEY_VALUE_ITERATOR_TYPE)); |
| 20332 DCHECK_LE(type, LAST_ARRAY_ITERATOR_TYPE); |
| 20333 } |
| 20334 |
| 20335 if (type <= JS_UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_TYPE) { |
| 20336 kind = |
| 20337 static_cast<ElementsKind>(FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND + |
| 20338 (type - FIRST_ARRAY_VALUE_ITERATOR_TYPE)); |
| 20339 DCHECK_LE(kind, LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND); |
| 20340 } else if (type < JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE) { |
| 20341 kind = static_cast<ElementsKind>( |
| 20342 FIRST_FAST_ELEMENTS_KIND + |
| 20343 (type - JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE)); |
| 20344 DCHECK_LE(kind, LAST_FAST_ELEMENTS_KIND); |
| 20345 } else { |
| 20346 // For any slow element cases, the actual elements kind is not known. |
| 20347 // Simply |
| 20348 // return a slow elements kind in this case. Users of this function must |
| 20349 // not |
| 20350 // depend on this. |
| 20351 return DICTIONARY_ELEMENTS; |
| 20352 } |
| 20353 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
| 20354 return kind; |
| 20355 } |
| 20356 } |
| 20357 |
20317 } // namespace internal | 20358 } // namespace internal |
20318 } // namespace v8 | 20359 } // namespace v8 |
OLD | NEW |