Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1444)

Unified Diff: src/elements-kind.cc

Issue 1257223002: Revert of Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/elements-kind.h ('k') | src/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/elements-kind.h ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698