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 20327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20338 Handle<FunctionTemplateInfo> fti = | 20338 Handle<FunctionTemplateInfo> fti = |
20339 Handle<FunctionTemplateInfo>::cast(getter); | 20339 Handle<FunctionTemplateInfo>::cast(getter); |
20340 // Check if the accessor uses a cached property. | 20340 // Check if the accessor uses a cached property. |
20341 if (!fti->cached_property_name()->IsTheHole(isolate)) { | 20341 if (!fti->cached_property_name()->IsTheHole(isolate)) { |
20342 return handle(Name::cast(fti->cached_property_name())); | 20342 return handle(Name::cast(fti->cached_property_name())); |
20343 } | 20343 } |
20344 } | 20344 } |
20345 return MaybeHandle<Name>(); | 20345 return MaybeHandle<Name>(); |
20346 } | 20346 } |
20347 | 20347 |
| 20348 // static |
| 20349 ElementsKind JSArrayIterator::ElementsKindForInstanceType(InstanceType type) { |
| 20350 DCHECK_GE(type, FIRST_ARRAY_ITERATOR_TYPE); |
| 20351 DCHECK_LE(type, LAST_ARRAY_ITERATOR_TYPE); |
| 20352 |
| 20353 if (type <= LAST_ARRAY_KEY_ITERATOR_TYPE) { |
| 20354 // Should be ignored for key iterators. |
| 20355 return FAST_ELEMENTS; |
| 20356 } else { |
| 20357 ElementsKind kind; |
| 20358 if (type < FIRST_ARRAY_VALUE_ITERATOR_TYPE) { |
| 20359 // Convert `type` to a value iterator from an entries iterator |
| 20360 type = static_cast<InstanceType>(type + |
| 20361 (FIRST_ARRAY_VALUE_ITERATOR_TYPE - |
| 20362 FIRST_ARRAY_KEY_VALUE_ITERATOR_TYPE)); |
| 20363 DCHECK_GE(type, FIRST_ARRAY_VALUE_ITERATOR_TYPE); |
| 20364 DCHECK_LE(type, LAST_ARRAY_ITERATOR_TYPE); |
| 20365 } |
| 20366 |
| 20367 if (type <= JS_UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_TYPE) { |
| 20368 kind = |
| 20369 static_cast<ElementsKind>(FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND + |
| 20370 (type - FIRST_ARRAY_VALUE_ITERATOR_TYPE)); |
| 20371 DCHECK_LE(kind, LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND); |
| 20372 } else if (type < JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE) { |
| 20373 kind = static_cast<ElementsKind>( |
| 20374 FIRST_FAST_ELEMENTS_KIND + |
| 20375 (type - JS_FAST_SMI_ARRAY_VALUE_ITERATOR_TYPE)); |
| 20376 DCHECK_LE(kind, LAST_FAST_ELEMENTS_KIND); |
| 20377 } else { |
| 20378 // For any slow element cases, the actual elements kind is not known. |
| 20379 // Simply |
| 20380 // return a slow elements kind in this case. Users of this function must |
| 20381 // not |
| 20382 // depend on this. |
| 20383 return DICTIONARY_ELEMENTS; |
| 20384 } |
| 20385 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
| 20386 return kind; |
| 20387 } |
| 20388 } |
| 20389 |
20348 } // namespace internal | 20390 } // namespace internal |
20349 } // namespace v8 | 20391 } // namespace v8 |
OLD | NEW |