Commit d66c832e authored by dslomov@chromium.org's avatar dslomov@chromium.org

Harden IsMoreGeneralElementsKindTransition.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/213783004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20489 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 69df3564
...@@ -178,6 +178,11 @@ static bool IsTypedArrayElementsKind(ElementsKind elements_kind) { ...@@ -178,6 +178,11 @@ static bool IsTypedArrayElementsKind(ElementsKind elements_kind) {
} }
static inline bool IsFastTransitionTarget(ElementsKind elements_kind) {
return IsFastElementsKind(elements_kind) ||
elements_kind == DICTIONARY_ELEMENTS;
}
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
ElementsKind to_kind) { ElementsKind to_kind) {
if (IsTypedArrayElementsKind(from_kind) || if (IsTypedArrayElementsKind(from_kind) ||
...@@ -193,26 +198,29 @@ bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ...@@ -193,26 +198,29 @@ bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind,
return false; return false;
} }
} }
switch (from_kind) { if (IsFastElementsKind(from_kind) && IsFastTransitionTarget(to_kind)) {
case FAST_SMI_ELEMENTS: switch (from_kind) {
return to_kind != FAST_SMI_ELEMENTS; case FAST_SMI_ELEMENTS:
case FAST_HOLEY_SMI_ELEMENTS: return to_kind != FAST_SMI_ELEMENTS;
return to_kind != FAST_SMI_ELEMENTS && case FAST_HOLEY_SMI_ELEMENTS:
to_kind != FAST_HOLEY_SMI_ELEMENTS; return to_kind != FAST_SMI_ELEMENTS &&
case FAST_DOUBLE_ELEMENTS: to_kind != FAST_HOLEY_SMI_ELEMENTS;
return to_kind != FAST_SMI_ELEMENTS && case FAST_DOUBLE_ELEMENTS:
to_kind != FAST_HOLEY_SMI_ELEMENTS && return to_kind != FAST_SMI_ELEMENTS &&
to_kind != FAST_DOUBLE_ELEMENTS; to_kind != FAST_HOLEY_SMI_ELEMENTS &&
case FAST_HOLEY_DOUBLE_ELEMENTS: to_kind != FAST_DOUBLE_ELEMENTS;
return to_kind == FAST_ELEMENTS || case FAST_HOLEY_DOUBLE_ELEMENTS:
to_kind == FAST_HOLEY_ELEMENTS; return to_kind == FAST_ELEMENTS ||
case FAST_ELEMENTS: to_kind == FAST_HOLEY_ELEMENTS;
return to_kind == FAST_HOLEY_ELEMENTS; case FAST_ELEMENTS:
case FAST_HOLEY_ELEMENTS: return to_kind == FAST_HOLEY_ELEMENTS;
return false; case FAST_HOLEY_ELEMENTS:
default: return false;
return false; default:
return false;
}
} }
return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment