Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 374e54c97389e448721421ca80898aeb6d42df1d..480aecea516159b46fc5ecf3071a1daf7b5ee5af 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -2715,17 +2715,18 @@ bool Uint32Analysis::IsSafeUint32Use(HValue* val, HValue* use) { |
| } else if (use->IsChange() || use->IsSimulate()) { |
| // Conversions and deoptimization have special support for unt32. |
| return true; |
| - } else if (use->IsStoreKeyedSpecializedArrayElement()) { |
| - // Storing a value into an external integer array is a bit level operation. |
| - HStoreKeyedSpecializedArrayElement* store = |
| - HStoreKeyedSpecializedArrayElement::cast(use); |
| - |
| - if (store->value() == val) { |
| - // Clamping or a conversion to double should have beed inserted. |
| - ASSERT(store->elements_kind() != EXTERNAL_PIXEL_ELEMENTS); |
| - ASSERT(store->elements_kind() != EXTERNAL_FLOAT_ELEMENTS); |
| - ASSERT(store->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS); |
| - return true; |
| + } else if (use->IsStoreKeyed()) { |
| + HStoreKeyed* store = HStoreKeyed::cast(use); |
| + if (store->is_external()) { |
| + // Storing a value into an external integer array is a |
| + // bit level operation. |
| + if (store->value() == val) { |
| + // Clamping or a conversion to double should have beed inserted. |
| + ASSERT(store->elements_kind() != EXTERNAL_PIXEL_ELEMENTS); |
| + ASSERT(store->elements_kind() != EXTERNAL_FLOAT_ELEMENTS); |
| + ASSERT(store->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS); |
| + return true; |
| + } |
| } |
| } |
| @@ -3743,6 +3744,9 @@ static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) { |
| index->DeleteAndReplaceWith(NULL); |
| } |
| ASSERT(value >= 0); |
| + |
| + // TODO(mvstanton): Now, realistically this is limited to 26 bits. |
| + // What should be done about that? |
|
danno
2012/10/21 20:44:41
Why has the limitation changed?
mvstanton
2012/10/23 23:44:20
Because elements_kind was encoded in 5 bits, but b
|
| array_operation->SetIndexOffset(static_cast<uint32_t>(value)); |
| array_operation->SetDehoisted(true); |
| } |
| @@ -3757,27 +3761,11 @@ void HGraph::DehoistSimpleArrayIndexComputations() { |
| instr != NULL; |
| instr = instr->next()) { |
| ArrayInstructionInterface* array_instruction = NULL; |
| - if (instr->IsLoadKeyedFastElement()) { |
| - HLoadKeyedFastElement* op = HLoadKeyedFastElement::cast(instr); |
| - array_instruction = static_cast<ArrayInstructionInterface*>(op); |
| - } else if (instr->IsLoadKeyedFastDoubleElement()) { |
| - HLoadKeyedFastDoubleElement* op = |
| - HLoadKeyedFastDoubleElement::cast(instr); |
| - array_instruction = static_cast<ArrayInstructionInterface*>(op); |
| - } else if (instr->IsLoadKeyedSpecializedArrayElement()) { |
| - HLoadKeyedSpecializedArrayElement* op = |
| - HLoadKeyedSpecializedArrayElement::cast(instr); |
| - array_instruction = static_cast<ArrayInstructionInterface*>(op); |
| - } else if (instr->IsStoreKeyedFastElement()) { |
| - HStoreKeyedFastElement* op = HStoreKeyedFastElement::cast(instr); |
| + if (instr->IsLoadKeyed()) { |
| + HLoadKeyed* op = HLoadKeyed::cast(instr); |
| array_instruction = static_cast<ArrayInstructionInterface*>(op); |
| - } else if (instr->IsStoreKeyedFastDoubleElement()) { |
| - HStoreKeyedFastDoubleElement* op = |
| - HStoreKeyedFastDoubleElement::cast(instr); |
| - array_instruction = static_cast<ArrayInstructionInterface*>(op); |
| - } else if (instr->IsStoreKeyedSpecializedArrayElement()) { |
| - HStoreKeyedSpecializedArrayElement* op = |
| - HStoreKeyedSpecializedArrayElement::cast(instr); |
| + } else if (instr->IsStoreKeyed()) { |
| + HStoreKeyed* op = HStoreKeyed::cast(instr); |
| array_instruction = static_cast<ArrayInstructionInterface*>(op); |
| } else { |
| continue; |
| @@ -4617,10 +4605,12 @@ void HGraphBuilder::VisitForInStatement(ForInStatement* stmt) { |
| set_current_block(loop_body); |
| HValue* key = AddInstruction( |
| - new(zone()) HLoadKeyedFastElement( |
| + new(zone()) HLoadKeyed( |
| environment()->ExpressionStackAt(2), // Enum cache. |
| environment()->ExpressionStackAt(0), // Iteration index. |
| - environment()->ExpressionStackAt(0))); |
| + environment()->ExpressionStackAt(0), |
| + FAST_ELEMENTS, |
| + false)); |
| // Check if the expected map still matches that of the enumerable. |
| // If not just deoptimize. |
| @@ -5225,17 +5215,13 @@ void HGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { |
| // Fall through. |
| case FAST_ELEMENTS: |
| case FAST_HOLEY_ELEMENTS: |
| - AddInstruction(new(zone()) HStoreKeyedFastElement( |
| + case FAST_DOUBLE_ELEMENTS: |
| + case FAST_HOLEY_DOUBLE_ELEMENTS: |
| + AddInstruction(new(zone()) HStoreKeyed( |
| elements, |
| key, |
| value, |
| - boilerplate_elements_kind)); |
| - break; |
| - case FAST_DOUBLE_ELEMENTS: |
| - case FAST_HOLEY_DOUBLE_ELEMENTS: |
| - AddInstruction(new(zone()) HStoreKeyedFastDoubleElement(elements, |
| - key, |
| - value)); |
| + boilerplate_elements_kind, false)); |
| break; |
| default: |
| UNREACHABLE(); |
| @@ -6085,13 +6071,16 @@ HInstruction* HGraphBuilder::BuildExternalArrayElementAccess( |
| UNREACHABLE(); |
| break; |
| } |
| - return new(zone()) HStoreKeyedSpecializedArrayElement( |
| - external_elements, checked_key, val, elements_kind); |
| + return new(zone()) HStoreKeyed(external_elements, |
| + checked_key, |
| + val, |
| + elements_kind, |
| + true); |
| } else { |
| ASSERT(val == NULL); |
| - HLoadKeyedSpecializedArrayElement* load = |
| - new(zone()) HLoadKeyedSpecializedArrayElement( |
| - external_elements, checked_key, dependency, elements_kind); |
| + HLoadKeyed* load = |
| + new(zone()) HLoadKeyed( |
| + external_elements, checked_key, dependency, elements_kind, true); |
| if (FLAG_opt_safe_uint32_operations && |
| elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
| graph()->RecordUint32Instruction(load); |
| @@ -6112,8 +6101,8 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements, |
| switch (elements_kind) { |
| case FAST_DOUBLE_ELEMENTS: |
| case FAST_HOLEY_DOUBLE_ELEMENTS: |
| - return new(zone()) HStoreKeyedFastDoubleElement( |
| - elements, checked_key, val); |
| + return new(zone()) HStoreKeyed( |
| + elements, checked_key, val, elements_kind, false); |
| case FAST_SMI_ELEMENTS: |
| case FAST_HOLEY_SMI_ELEMENTS: |
| // Smi-only arrays need a smi check. |
| @@ -6121,24 +6110,19 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements, |
| // Fall through. |
| case FAST_ELEMENTS: |
| case FAST_HOLEY_ELEMENTS: |
| - return new(zone()) HStoreKeyedFastElement( |
| - elements, checked_key, val, elements_kind); |
| + return new(zone()) HStoreKeyed( |
| + elements, checked_key, val, elements_kind, false); |
| default: |
| UNREACHABLE(); |
| return NULL; |
| } |
| } |
| // It's an element load (!is_store). |
| - HoleCheckMode mode = IsFastPackedElementsKind(elements_kind) ? |
| - OMIT_HOLE_CHECK : |
| - PERFORM_HOLE_CHECK; |
| - if (IsFastDoubleElementsKind(elements_kind)) { |
| - return new(zone()) HLoadKeyedFastDoubleElement(elements, checked_key, |
| - load_dependency, mode); |
| - } else { // Smi or Object elements. |
| - return new(zone()) HLoadKeyedFastElement(elements, checked_key, |
| - load_dependency, elements_kind); |
| - } |
| + return new(zone()) HLoadKeyed(elements, |
| + checked_key, |
| + load_dependency, |
| + elements_kind, |
| + false); |
| } |