Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 939b4f49748e3ea9acd0c7b6594d1e70e74071ff..e0c49be473fab9074b3f123a5a18163d5fc2031d 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -1622,7 +1622,7 @@ Range* HShl::InferRange(Zone* zone) { |
} |
-Range* HLoadKeyedSpecializedArrayElement::InferRange(Zone* zone) { |
+Range* HLoadKeyed::InferRange(Zone* zone) { |
switch (elements_kind()) { |
case EXTERNAL_PIXEL_ELEMENTS: |
return new(zone) Range(0, 255); |
@@ -1849,8 +1849,17 @@ void HLoadNamedGeneric::PrintDataTo(StringStream* stream) { |
} |
-void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { |
- object()->PrintNameTo(stream); |
+void HLoadKeyed::PrintDataTo(StringStream* stream) { |
+ if (!is_external()) { |
+ elements()->PrintNameTo(stream); |
+ } else { |
+ ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
+ elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); |
+ elements()->PrintNameTo(stream); |
+ stream->Add("."); |
+ stream->Add(ElementsKindToString(elements_kind())); |
+ } |
+ |
stream->Add("["); |
key()->PrintNameTo(stream); |
stream->Add("] "); |
@@ -1861,29 +1870,26 @@ void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) { |
} |
-bool HLoadKeyedFastElement::RequiresHoleCheck() const { |
+bool HLoadKeyed::RequiresHoleCheck() const { |
if (IsFastPackedElementsKind(elements_kind())) { |
return false; |
} |
+ if (IsFastDoubleElementsKind(elements_kind())) { |
+ return true; |
+ } |
+ |
for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
HValue* use = it.value(); |
- if (!use->IsChange()) return true; |
+ if (!use->IsChange()) { |
+ return true; |
+ } |
} |
return false; |
} |
-void HLoadKeyedFastDoubleElement::PrintDataTo(StringStream* stream) { |
- elements()->PrintNameTo(stream); |
- stream->Add("["); |
- key()->PrintNameTo(stream); |
- stream->Add("] "); |
- dependency()->PrintNameTo(stream); |
-} |
- |
- |
void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
object()->PrintNameTo(stream); |
stream->Add("["); |
@@ -1896,21 +1902,22 @@ HValue* HLoadKeyedGeneric::Canonicalize() { |
// Recognize generic keyed loads that use property name generated |
// by for-in statement as a key and rewrite them into fast property load |
// by index. |
- if (key()->IsLoadKeyedFastElement()) { |
- HLoadKeyedFastElement* key_load = HLoadKeyedFastElement::cast(key()); |
- if (key_load->object()->IsForInCacheArray()) { |
+ if (key()->IsLoadKeyed()) { |
+ HLoadKeyed* key_load = HLoadKeyed::cast(key()); |
+ if (key_load->elements()->IsForInCacheArray()) { |
HForInCacheArray* names_cache = |
- HForInCacheArray::cast(key_load->object()); |
+ HForInCacheArray::cast(key_load->elements()); |
if (names_cache->enumerable() == object()) { |
HForInCacheArray* index_cache = |
names_cache->index_cache(); |
HCheckMapValue* map_check = |
new(block()->zone()) HCheckMapValue(object(), names_cache->map()); |
- HInstruction* index = new(block()->zone()) HLoadKeyedFastElement( |
+ HInstruction* index = new(block()->zone()) HLoadKeyed( |
index_cache, |
key_load->key(), |
- key_load->key()); |
+ key_load->key(), |
+ key_load->elements_kind()); |
map_check->InsertBefore(this); |
index->InsertBefore(this); |
HLoadFieldByIndex* load = new(block()->zone()) HLoadFieldByIndex( |
@@ -1925,56 +1932,6 @@ HValue* HLoadKeyedGeneric::Canonicalize() { |
} |
-void HLoadKeyedSpecializedArrayElement::PrintDataTo( |
- StringStream* stream) { |
- external_pointer()->PrintNameTo(stream); |
- stream->Add("."); |
- switch (elements_kind()) { |
- case EXTERNAL_BYTE_ELEMENTS: |
- stream->Add("byte"); |
- break; |
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
- stream->Add("u_byte"); |
- break; |
- case EXTERNAL_SHORT_ELEMENTS: |
- stream->Add("short"); |
- break; |
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
- stream->Add("u_short"); |
- break; |
- case EXTERNAL_INT_ELEMENTS: |
- stream->Add("int"); |
- break; |
- case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
- stream->Add("u_int"); |
- break; |
- case EXTERNAL_FLOAT_ELEMENTS: |
- stream->Add("float"); |
- break; |
- case EXTERNAL_DOUBLE_ELEMENTS: |
- stream->Add("double"); |
- break; |
- case EXTERNAL_PIXEL_ELEMENTS: |
- stream->Add("pixel"); |
- break; |
- case FAST_ELEMENTS: |
- case FAST_SMI_ELEMENTS: |
- case FAST_DOUBLE_ELEMENTS: |
- case FAST_HOLEY_ELEMENTS: |
- case FAST_HOLEY_SMI_ELEMENTS: |
- case FAST_HOLEY_DOUBLE_ELEMENTS: |
- case DICTIONARY_ELEMENTS: |
- case NON_STRICT_ARGUMENTS_ELEMENTS: |
- UNREACHABLE(); |
- break; |
- } |
- stream->Add("["); |
- key()->PrintNameTo(stream); |
- stream->Add("] "); |
- dependency()->PrintNameTo(stream); |
-} |
- |
- |
void HStoreNamedGeneric::PrintDataTo(StringStream* stream) { |
object()->PrintNameTo(stream); |
stream->Add("."); |
@@ -2001,17 +1958,17 @@ void HStoreNamedField::PrintDataTo(StringStream* stream) { |
} |
-void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) { |
- object()->PrintNameTo(stream); |
- stream->Add("["); |
- key()->PrintNameTo(stream); |
- stream->Add("] = "); |
- value()->PrintNameTo(stream); |
-} |
- |
+void HStoreKeyed::PrintDataTo(StringStream* stream) { |
+ if (!is_external()) { |
+ elements()->PrintNameTo(stream); |
+ } else { |
+ elements()->PrintNameTo(stream); |
+ stream->Add("."); |
+ stream->Add(ElementsKindToString(elements_kind())); |
+ ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
+ elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); |
+ } |
-void HStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) { |
- elements()->PrintNameTo(stream); |
stream->Add("["); |
key()->PrintNameTo(stream); |
stream->Add("] = "); |
@@ -2028,56 +1985,6 @@ void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
} |
-void HStoreKeyedSpecializedArrayElement::PrintDataTo( |
- StringStream* stream) { |
- external_pointer()->PrintNameTo(stream); |
- stream->Add("."); |
- switch (elements_kind()) { |
- case EXTERNAL_BYTE_ELEMENTS: |
- stream->Add("byte"); |
- break; |
- case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
- stream->Add("u_byte"); |
- break; |
- case EXTERNAL_SHORT_ELEMENTS: |
- stream->Add("short"); |
- break; |
- case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
- stream->Add("u_short"); |
- break; |
- case EXTERNAL_INT_ELEMENTS: |
- stream->Add("int"); |
- break; |
- case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
- stream->Add("u_int"); |
- break; |
- case EXTERNAL_FLOAT_ELEMENTS: |
- stream->Add("float"); |
- break; |
- case EXTERNAL_DOUBLE_ELEMENTS: |
- stream->Add("double"); |
- break; |
- case EXTERNAL_PIXEL_ELEMENTS: |
- stream->Add("pixel"); |
- break; |
- case FAST_SMI_ELEMENTS: |
- case FAST_ELEMENTS: |
- case FAST_DOUBLE_ELEMENTS: |
- case FAST_HOLEY_SMI_ELEMENTS: |
- case FAST_HOLEY_ELEMENTS: |
- case FAST_HOLEY_DOUBLE_ELEMENTS: |
- case DICTIONARY_ELEMENTS: |
- case NON_STRICT_ARGUMENTS_ELEMENTS: |
- UNREACHABLE(); |
- break; |
- } |
- stream->Add("["); |
- key()->PrintNameTo(stream); |
- stream->Add("] = "); |
- value()->PrintNameTo(stream); |
-} |
- |
- |
void HTransitionElementsKind::PrintDataTo(StringStream* stream) { |
object()->PrintNameTo(stream); |
ElementsKind from_kind = original_map()->elements_kind(); |
@@ -2368,10 +2275,10 @@ HValue* HAdd::EnsureAndPropagateNotMinusZero(BitVector* visited) { |
} |
-bool HStoreKeyedFastDoubleElement::NeedsCanonicalization() { |
- // If value was loaded from unboxed double backing store or |
- // converted from an integer then we don't have to canonicalize it. |
- if (value()->IsLoadKeyedFastDoubleElement() || |
+bool HStoreKeyed::NeedsCanonicalization() { |
+ // If value is an integer or comes from the result of a keyed load |
+ // then it will be a non-hole value: no need for canonicalization. |
+ if (value()->IsLoadKeyed() || |
(value()->IsChange() && HChange::cast(value())->from().IsInteger32())) { |
return false; |
} |