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/elements-kind.h" | 5 #include "src/elements-kind.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 case SLOPPY_ARGUMENTS_ELEMENTS: | 47 case SLOPPY_ARGUMENTS_ELEMENTS: |
48 return kPointerSizeLog2; | 48 return kPointerSizeLog2; |
49 } | 49 } |
50 UNREACHABLE(); | 50 UNREACHABLE(); |
51 return 0; | 51 return 0; |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) { | 55 int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) { |
56 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); | 56 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); |
57 return IsExternalArrayElementsKind(elements_kind) | 57 |
58 ? 0 : (FixedArray::kHeaderSize - kHeapObjectTag); | 58 if (IsExternalArrayElementsKind(elements_kind)) { |
| 59 return 0; |
| 60 } else if (IsFixedTypedArrayElementsKind(elements_kind)) { |
| 61 return FixedTypedArrayBase::kDataOffset - kHeapObjectTag; |
| 62 } else { |
| 63 return FixedArray::kHeaderSize - kHeapObjectTag; |
| 64 } |
59 } | 65 } |
60 | 66 |
61 | 67 |
62 const char* ElementsKindToString(ElementsKind kind) { | 68 const char* ElementsKindToString(ElementsKind kind) { |
63 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); | 69 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); |
64 return accessor->name(); | 70 return accessor->name(); |
65 } | 71 } |
66 | 72 |
67 | 73 |
68 struct InitializeFastElementsKindSequence { | 74 struct InitializeFastElementsKindSequence { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 default: | 196 default: |
191 return false; | 197 return false; |
192 } | 198 } |
193 } | 199 } |
194 return false; | 200 return false; |
195 } | 201 } |
196 | 202 |
197 | 203 |
198 } // namespace internal | 204 } // namespace internal |
199 } // namespace v8 | 205 } // namespace v8 |
OLD | NEW |