| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 7671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7682 HType::Smi())); | 7682 HType::Smi())); |
| 7683 checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); | 7683 checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
| 7684 access = AddInstruction(BuildFastElementAccess( | 7684 access = AddInstruction(BuildFastElementAccess( |
| 7685 elements, checked_key, val, elements_kind_branch, | 7685 elements, checked_key, val, elements_kind_branch, |
| 7686 elements_kind, is_store, STANDARD_STORE)); | 7686 elements_kind, is_store, STANDARD_STORE)); |
| 7687 if (!is_store) { | 7687 if (!is_store) { |
| 7688 Push(access); | 7688 Push(access); |
| 7689 } | 7689 } |
| 7690 | 7690 |
| 7691 *has_side_effects |= access->HasObservableSideEffects(); | 7691 *has_side_effects |= access->HasObservableSideEffects(); |
| 7692 // The caller will use has_side_effects and add correct Simulate. |
| 7693 access->SetFlag(HValue::kHasNoObservableSideEffects); |
| 7692 if (position != -1) { | 7694 if (position != -1) { |
| 7693 access->set_position(position); | 7695 access->set_position(position); |
| 7694 } | 7696 } |
| 7695 if_jsarray->Goto(join); | 7697 if_jsarray->GotoNoSimulate(join); |
| 7696 | 7698 |
| 7697 set_current_block(if_fastobject); | 7699 set_current_block(if_fastobject); |
| 7698 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); | 7700 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
| 7699 checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); | 7701 checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
| 7700 access = AddInstruction(BuildFastElementAccess( | 7702 access = AddInstruction(BuildFastElementAccess( |
| 7701 elements, checked_key, val, elements_kind_branch, | 7703 elements, checked_key, val, elements_kind_branch, |
| 7702 elements_kind, is_store, STANDARD_STORE)); | 7704 elements_kind, is_store, STANDARD_STORE)); |
| 7703 } else if (elements_kind == DICTIONARY_ELEMENTS) { | 7705 } else if (elements_kind == DICTIONARY_ELEMENTS) { |
| 7704 if (is_store) { | 7706 if (is_store) { |
| 7705 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); | 7707 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); |
| 7706 } else { | 7708 } else { |
| 7707 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); | 7709 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); |
| 7708 } | 7710 } |
| 7709 } else { // External array elements. | 7711 } else { // External array elements. |
| 7710 access = AddInstruction(BuildExternalArrayElementAccess( | 7712 access = AddInstruction(BuildExternalArrayElementAccess( |
| 7711 external_elements, checked_key, val, | 7713 external_elements, checked_key, val, |
| 7712 elements_kind_branch, elements_kind, is_store)); | 7714 elements_kind_branch, elements_kind, is_store)); |
| 7713 } | 7715 } |
| 7714 *has_side_effects |= access->HasObservableSideEffects(); | 7716 *has_side_effects |= access->HasObservableSideEffects(); |
| 7717 // The caller will use has_side_effects and add correct Simulate. |
| 7718 access->SetFlag(HValue::kHasNoObservableSideEffects); |
| 7715 if (position != RelocInfo::kNoPosition) access->set_position(position); | 7719 if (position != RelocInfo::kNoPosition) access->set_position(position); |
| 7716 if (!is_store) { | 7720 if (!is_store) { |
| 7717 Push(access); | 7721 Push(access); |
| 7718 } | 7722 } |
| 7719 current_block()->Goto(join); | 7723 current_block()->GotoNoSimulate(join); |
| 7720 set_current_block(if_false); | 7724 set_current_block(if_false); |
| 7721 } | 7725 } |
| 7722 } | 7726 } |
| 7723 | 7727 |
| 7724 // Deopt if none of the cases matched. | 7728 // Deopt if none of the cases matched. |
| 7725 current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses); | 7729 current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses); |
| 7726 join->SetJoinId(ast_id); | |
| 7727 set_current_block(join); | 7730 set_current_block(join); |
| 7728 return is_store ? NULL : Pop(); | 7731 return is_store ? NULL : Pop(); |
| 7729 } | 7732 } |
| 7730 | 7733 |
| 7731 | 7734 |
| 7732 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( | 7735 HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
| 7733 HValue* obj, | 7736 HValue* obj, |
| 7734 HValue* key, | 7737 HValue* key, |
| 7735 HValue* val, | 7738 HValue* val, |
| 7736 Expression* expr, | 7739 Expression* expr, |
| (...skipping 4072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11809 } | 11812 } |
| 11810 } | 11813 } |
| 11811 | 11814 |
| 11812 #ifdef DEBUG | 11815 #ifdef DEBUG |
| 11813 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11816 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 11814 if (allocator_ != NULL) allocator_->Verify(); | 11817 if (allocator_ != NULL) allocator_->Verify(); |
| 11815 #endif | 11818 #endif |
| 11816 } | 11819 } |
| 11817 | 11820 |
| 11818 } } // namespace v8::internal | 11821 } } // namespace v8::internal |
| OLD | NEW |