Index: src/elements-kind.cc |
diff --git a/src/elements-kind.cc b/src/elements-kind.cc |
index 0d29c3047238cbcfe6b0df71b196441686fa3e48..07d2837bdc86ca747d1e4468887f6bfa6b049dfd 100644 |
--- a/src/elements-kind.cc |
+++ b/src/elements-kind.cc |
@@ -15,17 +15,26 @@ |
int ElementsKindToShiftSize(ElementsKind elements_kind) { |
switch (elements_kind) { |
+ case EXTERNAL_INT8_ELEMENTS: |
+ case EXTERNAL_UINT8_CLAMPED_ELEMENTS: |
+ case EXTERNAL_UINT8_ELEMENTS: |
case UINT8_ELEMENTS: |
case INT8_ELEMENTS: |
case UINT8_CLAMPED_ELEMENTS: |
return 0; |
+ case EXTERNAL_INT16_ELEMENTS: |
+ case EXTERNAL_UINT16_ELEMENTS: |
case UINT16_ELEMENTS: |
case INT16_ELEMENTS: |
return 1; |
+ case EXTERNAL_INT32_ELEMENTS: |
+ case EXTERNAL_UINT32_ELEMENTS: |
+ case EXTERNAL_FLOAT32_ELEMENTS: |
case UINT32_ELEMENTS: |
case INT32_ELEMENTS: |
case FLOAT32_ELEMENTS: |
return 2; |
+ case EXTERNAL_FLOAT64_ELEMENTS: |
case FAST_DOUBLE_ELEMENTS: |
case FAST_HOLEY_DOUBLE_ELEMENTS: |
case FLOAT64_ELEMENTS: |
@@ -44,10 +53,16 @@ |
} |
+static bool IsTypedArrayElementsKind(ElementsKind elements_kind) { |
+ return IsFixedTypedArrayElementsKind(elements_kind) || |
+ IsExternalArrayElementsKind(elements_kind); |
+} |
+ |
+ |
int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) { |
STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); |
- if (IsFixedTypedArrayElementsKind(elements_kind)) { |
+ if (IsTypedArrayElementsKind(elements_kind)) { |
return 0; |
} else { |
return FixedArray::kHeaderSize - kHeapObjectTag; |
@@ -110,8 +125,17 @@ |
ElementsKind GetNextTransitionElementsKind(ElementsKind kind) { |
- int index = GetSequenceIndexFromFastElementsKind(kind); |
- return GetFastElementsKindFromSequenceIndex(index + 1); |
+ switch (kind) { |
+#define FIXED_TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
+ case TYPE##_ELEMENTS: return EXTERNAL_##TYPE##_ELEMENTS; |
+ |
+ TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE) |
+#undef FIXED_TYPED_ARRAY_CASE |
+ default: { |
+ int index = GetSequenceIndexFromFastElementsKind(kind); |
+ return GetFastElementsKindFromSequenceIndex(index + 1); |
+ } |
+ } |
} |
@@ -122,9 +146,18 @@ |
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, |
ElementsKind to_kind) { |
- if (IsFixedTypedArrayElementsKind(from_kind) || |
- IsFixedTypedArrayElementsKind(to_kind)) { |
- return false; |
+ if (IsTypedArrayElementsKind(from_kind) || |
+ IsTypedArrayElementsKind(to_kind)) { |
+ switch (from_kind) { |
+#define FIXED_TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
+ case TYPE##_ELEMENTS: \ |
+ return to_kind == EXTERNAL_##TYPE##_ELEMENTS; |
+ |
+ TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE); |
+#undef FIXED_TYPED_ARRAY_CASE |
+ default: |
+ return false; |
+ } |
} |
if (IsFastElementsKind(from_kind) && IsFastTransitionTarget(to_kind)) { |
switch (from_kind) { |