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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 indices->Clear(); | 430 indices->Clear(); |
431 } | 431 } |
432 for (uint32_t i = 0; i < length; i++) { | 432 for (uint32_t i = 0; i < length; i++) { |
433 indices->Add(i); | 433 indices->Add(i); |
434 } | 434 } |
435 if (length == range) return; // All indices accounted for already. | 435 if (length == range) return; // All indices accounted for already. |
436 break; | 436 break; |
437 } | 437 } |
438 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 438 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
439 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { | 439 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { |
440 MaybeHandle<Object> length_obj = | |
441 Object::GetProperty(object, isolate->factory()->length_string()); | |
442 double length_num = length_obj.ToHandleChecked()->Number(); | |
443 uint32_t length = static_cast<uint32_t>(DoubleToInt32(length_num)); | |
444 ElementsAccessor* accessor = object->GetElementsAccessor(); | 440 ElementsAccessor* accessor = object->GetElementsAccessor(); |
445 for (uint32_t i = 0; i < length; i++) { | 441 for (uint32_t i = 0; i < range; i++) { |
446 if (accessor->HasElement(object, i)) { | 442 if (accessor->HasElement(object, i)) { |
447 indices->Add(i); | 443 indices->Add(i); |
448 } | 444 } |
449 } | 445 } |
450 break; | 446 break; |
451 } | 447 } |
452 } | 448 } |
453 | 449 |
454 PrototypeIterator iter(isolate, object); | 450 PrototypeIterator iter(isolate, object); |
455 if (!iter.IsAtEnd()) { | 451 if (!iter.IsAtEnd()) { |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 | 1264 |
1269 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1265 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
1270 SealHandleScope shs(isolate); | 1266 SealHandleScope shs(isolate); |
1271 DCHECK(args.length() == 2); | 1267 DCHECK(args.length() == 2); |
1272 // Returning undefined means that this fast path fails and one has to resort | 1268 // Returning undefined means that this fast path fails and one has to resort |
1273 // to a slow path. | 1269 // to a slow path. |
1274 return isolate->heap()->undefined_value(); | 1270 return isolate->heap()->undefined_value(); |
1275 } | 1271 } |
1276 } // namespace internal | 1272 } // namespace internal |
1277 } // namespace v8 | 1273 } // namespace v8 |
OLD | NEW |