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 5824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5835 if (is_store && (fast_elements || fast_smi_only_elements)) { | 5835 if (is_store && (fast_elements || fast_smi_only_elements)) { |
5836 HCheckMaps* check_cow_map = new(zone()) HCheckMaps( | 5836 HCheckMaps* check_cow_map = new(zone()) HCheckMaps( |
5837 elements, isolate()->factory()->fixed_array_map(), zone()); | 5837 elements, isolate()->factory()->fixed_array_map(), zone()); |
5838 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); | 5838 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); |
5839 AddInstruction(check_cow_map); | 5839 AddInstruction(check_cow_map); |
5840 } | 5840 } |
5841 HInstruction* length = NULL; | 5841 HInstruction* length = NULL; |
5842 HInstruction* checked_key = NULL; | 5842 HInstruction* checked_key = NULL; |
5843 if (map->has_external_array_elements()) { | 5843 if (map->has_external_array_elements()) { |
5844 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); | 5844 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
5845 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 5845 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length, |
| 5846 ALLOW_SMI_KEY)); |
5846 HLoadExternalArrayPointer* external_elements = | 5847 HLoadExternalArrayPointer* external_elements = |
5847 new(zone()) HLoadExternalArrayPointer(elements); | 5848 new(zone()) HLoadExternalArrayPointer(elements); |
5848 AddInstruction(external_elements); | 5849 AddInstruction(external_elements); |
5849 return BuildExternalArrayElementAccess(external_elements, checked_key, | 5850 return BuildExternalArrayElementAccess(external_elements, checked_key, |
5850 val, map->elements_kind(), is_store); | 5851 val, map->elements_kind(), is_store); |
5851 } | 5852 } |
5852 ASSERT(fast_smi_only_elements || | 5853 ASSERT(fast_smi_only_elements || |
5853 fast_elements || | 5854 fast_elements || |
5854 map->has_fast_double_elements()); | 5855 map->has_fast_double_elements()); |
5855 if (map->instance_type() == JS_ARRAY_TYPE) { | 5856 if (map->instance_type() == JS_ARRAY_TYPE) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6070 HHasInstanceTypeAndBranch* typecheck = | 6071 HHasInstanceTypeAndBranch* typecheck = |
6071 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE); | 6072 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE); |
6072 typecheck->SetSuccessorAt(0, if_jsarray); | 6073 typecheck->SetSuccessorAt(0, if_jsarray); |
6073 typecheck->SetSuccessorAt(1, if_fastobject); | 6074 typecheck->SetSuccessorAt(1, if_fastobject); |
6074 current_block()->Finish(typecheck); | 6075 current_block()->Finish(typecheck); |
6075 | 6076 |
6076 set_current_block(if_jsarray); | 6077 set_current_block(if_jsarray); |
6077 HInstruction* length; | 6078 HInstruction* length; |
6078 length = AddInstruction(new(zone()) HJSArrayLength(object, typecheck, | 6079 length = AddInstruction(new(zone()) HJSArrayLength(object, typecheck, |
6079 HType::Smi())); | 6080 HType::Smi())); |
6080 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 6081 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length, |
| 6082 ALLOW_SMI_KEY)); |
6081 access = AddInstruction(BuildFastElementAccess( | 6083 access = AddInstruction(BuildFastElementAccess( |
6082 elements, checked_key, val, elements_kind, is_store)); | 6084 elements, checked_key, val, elements_kind, is_store)); |
6083 if (!is_store) { | 6085 if (!is_store) { |
6084 Push(access); | 6086 Push(access); |
6085 } | 6087 } |
6086 | 6088 |
6087 *has_side_effects |= access->HasObservableSideEffects(); | 6089 *has_side_effects |= access->HasObservableSideEffects(); |
6088 if (position != -1) { | 6090 if (position != -1) { |
6089 access->set_position(position); | 6091 access->set_position(position); |
6090 } | 6092 } |
6091 if_jsarray->Goto(join); | 6093 if_jsarray->Goto(join); |
6092 | 6094 |
6093 set_current_block(if_fastobject); | 6095 set_current_block(if_fastobject); |
6094 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); | 6096 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
6095 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 6097 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length, |
| 6098 ALLOW_SMI_KEY)); |
6096 access = AddInstruction(BuildFastElementAccess( | 6099 access = AddInstruction(BuildFastElementAccess( |
6097 elements, checked_key, val, elements_kind, is_store)); | 6100 elements, checked_key, val, elements_kind, is_store)); |
6098 } else if (elements_kind == DICTIONARY_ELEMENTS) { | 6101 } else if (elements_kind == DICTIONARY_ELEMENTS) { |
6099 if (is_store) { | 6102 if (is_store) { |
6100 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); | 6103 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); |
6101 } else { | 6104 } else { |
6102 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); | 6105 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); |
6103 } | 6106 } |
6104 } else { // External array elements. | 6107 } else { // External array elements. |
6105 access = AddInstruction(BuildExternalArrayElementAccess( | 6108 access = AddInstruction(BuildExternalArrayElementAccess( |
(...skipping 3466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9572 } | 9575 } |
9573 } | 9576 } |
9574 | 9577 |
9575 #ifdef DEBUG | 9578 #ifdef DEBUG |
9576 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9579 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9577 if (allocator_ != NULL) allocator_->Verify(); | 9580 if (allocator_ != NULL) allocator_->Verify(); |
9578 #endif | 9581 #endif |
9579 } | 9582 } |
9580 | 9583 |
9581 } } // namespace v8::internal | 9584 } } // namespace v8::internal |
OLD | NEW |