OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/elements.h" | 8 #include "src/elements.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 SeededNumberDictionary::cast(array->elements())); | 288 SeededNumberDictionary::cast(array->elements())); |
289 int capacity = dictionary->Capacity(); | 289 int capacity = dictionary->Capacity(); |
290 for (int i = 0; i < capacity; i++) { | 290 for (int i = 0; i < capacity; i++) { |
291 Handle<Object> key(dictionary->KeyAt(i), array->GetIsolate()); | 291 Handle<Object> key(dictionary->KeyAt(i), array->GetIsolate()); |
292 if (dictionary->IsKey(*key)) { | 292 if (dictionary->IsKey(*key)) { |
293 element_count++; | 293 element_count++; |
294 } | 294 } |
295 } | 295 } |
296 break; | 296 break; |
297 } | 297 } |
298 case SLOPPY_ARGUMENTS_ELEMENTS: | 298 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 299 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
299 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 300 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
300 case EXTERNAL_##TYPE##_ELEMENTS: \ | 301 case EXTERNAL_##TYPE##_ELEMENTS: \ |
301 case TYPE##_ELEMENTS: | 302 case TYPE##_ELEMENTS: |
302 | 303 |
303 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 304 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
304 #undef TYPED_ARRAY_CASE | 305 #undef TYPED_ARRAY_CASE |
305 // External arrays are always dense. | 306 // External arrays are always dense. |
306 return length; | 307 return length; |
307 } | 308 } |
308 // As an estimate, we assume that the prototype doesn't contain any | 309 // As an estimate, we assume that the prototype doesn't contain any |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 // We will add all indices, so we might as well clear it first | 430 // We will add all indices, so we might as well clear it first |
430 // and avoid duplicates. | 431 // and avoid duplicates. |
431 indices->Clear(); | 432 indices->Clear(); |
432 } | 433 } |
433 for (uint32_t i = 0; i < length; i++) { | 434 for (uint32_t i = 0; i < length; i++) { |
434 indices->Add(i); | 435 indices->Add(i); |
435 } | 436 } |
436 if (length == range) return; // All indices accounted for already. | 437 if (length == range) return; // All indices accounted for already. |
437 break; | 438 break; |
438 } | 439 } |
439 case SLOPPY_ARGUMENTS_ELEMENTS: { | 440 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 441 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { |
440 MaybeHandle<Object> length_obj = | 442 MaybeHandle<Object> length_obj = |
441 Object::GetProperty(object, isolate->factory()->length_string()); | 443 Object::GetProperty(object, isolate->factory()->length_string()); |
442 double length_num = length_obj.ToHandleChecked()->Number(); | 444 double length_num = length_obj.ToHandleChecked()->Number(); |
443 uint32_t length = static_cast<uint32_t>(DoubleToInt32(length_num)); | 445 uint32_t length = static_cast<uint32_t>(DoubleToInt32(length_num)); |
444 ElementsAccessor* accessor = object->GetElementsAccessor(); | 446 ElementsAccessor* accessor = object->GetElementsAccessor(); |
445 for (uint32_t i = 0; i < length; i++) { | 447 for (uint32_t i = 0; i < length; i++) { |
446 if (accessor->HasElement(object, i)) { | 448 if (accessor->HasElement(object, i)) { |
447 indices->Add(i); | 449 indices->Add(i); |
448 } | 450 } |
449 } | 451 } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 case EXTERNAL_FLOAT64_ELEMENTS: { | 701 case EXTERNAL_FLOAT64_ELEMENTS: { |
700 IterateTypedArrayElements<ExternalFloat64Array, double>( | 702 IterateTypedArrayElements<ExternalFloat64Array, double>( |
701 isolate, receiver, false, false, visitor); | 703 isolate, receiver, false, false, visitor); |
702 break; | 704 break; |
703 } | 705 } |
704 case FLOAT64_ELEMENTS: { | 706 case FLOAT64_ELEMENTS: { |
705 IterateTypedArrayElements<FixedFloat64Array, double>( | 707 IterateTypedArrayElements<FixedFloat64Array, double>( |
706 isolate, receiver, false, false, visitor); | 708 isolate, receiver, false, false, visitor); |
707 break; | 709 break; |
708 } | 710 } |
709 case SLOPPY_ARGUMENTS_ELEMENTS: { | 711 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 712 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { |
710 for (uint32_t index = 0; index < length; index++) { | 713 for (uint32_t index = 0; index < length; index++) { |
711 HandleScope loop_scope(isolate); | 714 HandleScope loop_scope(isolate); |
712 Handle<Object> element; | 715 Handle<Object> element; |
713 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 716 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
714 isolate, element, Object::GetElement(isolate, receiver, index), | 717 isolate, element, Object::GetElement(isolate, receiver, index), |
715 false); | 718 false); |
716 visitor->visit(index, element); | 719 visitor->visit(index, element); |
717 } | 720 } |
718 break; | 721 break; |
719 } | 722 } |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 | 1320 |
1318 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1321 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
1319 SealHandleScope shs(isolate); | 1322 SealHandleScope shs(isolate); |
1320 DCHECK(args.length() == 2); | 1323 DCHECK(args.length() == 2); |
1321 // Returning undefined means that this fast path fails and one has to resort | 1324 // Returning undefined means that this fast path fails and one has to resort |
1322 // to a slow path. | 1325 // to a slow path. |
1323 return isolate->heap()->undefined_value(); | 1326 return isolate->heap()->undefined_value(); |
1324 } | 1327 } |
1325 } // namespace internal | 1328 } // namespace internal |
1326 } // namespace v8 | 1329 } // namespace v8 |
OLD | NEW |