OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 659 |
660 Handle<JSObject> object = Handle<JSObject>::cast(receiver); | 660 Handle<JSObject> object = Handle<JSObject>::cast(receiver); |
661 Handle<FixedArrayBase> elms(object->elements(), isolate); | 661 Handle<FixedArrayBase> elms(object->elements(), isolate); |
662 | 662 |
663 ElementsKind kind = object->GetElementsKind(); | 663 ElementsKind kind = object->GetElementsKind(); |
664 if (IsHoleyElementsKind(kind)) { | 664 if (IsHoleyElementsKind(kind)) { |
665 DisallowHeapAllocation no_gc; | 665 DisallowHeapAllocation no_gc; |
666 bool packed = true; | 666 bool packed = true; |
667 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); | 667 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); |
668 for (int i = k; i < final; i++) { | 668 for (int i = k; i < final; i++) { |
669 if (!accessor->HasElement(object, object, i, elms)) { | 669 if (!accessor->HasElement(object, i, elms)) { |
670 packed = false; | 670 packed = false; |
671 break; | 671 break; |
672 } | 672 } |
673 } | 673 } |
674 if (packed) { | 674 if (packed) { |
675 kind = GetPackedElementsKind(kind); | 675 kind = GetPackedElementsKind(kind); |
676 } else if (!receiver->IsJSArray()) { | 676 } else if (!receiver->IsJSArray()) { |
677 AllowHeapAllocation allow_allocation; | 677 AllowHeapAllocation allow_allocation; |
678 return CallJsBuiltin(isolate, "ArraySlice", args); | 678 return CallJsBuiltin(isolate, "ArraySlice", args); |
679 } | 679 } |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 } | 1640 } |
1641 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1641 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1642 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1642 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1643 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1643 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1644 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1644 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1645 #undef DEFINE_BUILTIN_ACCESSOR_C | 1645 #undef DEFINE_BUILTIN_ACCESSOR_C |
1646 #undef DEFINE_BUILTIN_ACCESSOR_A | 1646 #undef DEFINE_BUILTIN_ACCESSOR_A |
1647 | 1647 |
1648 | 1648 |
1649 } } // namespace v8::internal | 1649 } } // namespace v8::internal |
OLD | NEW |