OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3914 AddInstruction(elements); | 3914 AddInstruction(elements); |
3915 length = AddInstruction(new(zone()) HExternalArrayLength(elements)); | 3915 length = AddInstruction(new(zone()) HExternalArrayLength(elements)); |
3916 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3916 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3917 HLoadExternalArrayPointer* external_elements = | 3917 HLoadExternalArrayPointer* external_elements = |
3918 new(zone()) HLoadExternalArrayPointer(elements); | 3918 new(zone()) HLoadExternalArrayPointer(elements); |
3919 AddInstruction(external_elements); | 3919 AddInstruction(external_elements); |
3920 return BuildExternalArrayElementAccess(external_elements, checked_key, | 3920 return BuildExternalArrayElementAccess(external_elements, checked_key, |
3921 val, map->elements_kind(), is_store); | 3921 val, map->elements_kind(), is_store); |
3922 } | 3922 } |
3923 ASSERT(map->has_fast_elements()); | 3923 ASSERT(map->has_fast_elements()); |
3924 HInstruction* elements_cow_map_check = new(zone()) HCheckMap( | |
Vyacheslav Egorov (Chromium)
2011/07/14 13:03:44
I find the name of the variable confusing. We are
Jakob Kummerow
2011/07/14 14:44:49
Done, sort of: I've removed the variable completel
| |
3925 elements, isolate()->factory()->fixed_array_map()); | |
3924 if (map->instance_type() == JS_ARRAY_TYPE) { | 3926 if (map->instance_type() == JS_ARRAY_TYPE) { |
3925 length = AddInstruction(new(zone()) HJSArrayLength(object)); | 3927 length = AddInstruction(new(zone()) HJSArrayLength(object)); |
3926 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3928 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3927 AddInstruction(elements); | 3929 AddInstruction(elements); |
3930 AddInstruction(elements_cow_map_check); | |
Vyacheslav Egorov (Chromium)
2011/07/14 13:03:44
This map check is redundant if !is_store.
Can you
Jakob Kummerow
2011/07/14 14:44:49
Done.
| |
3928 } else { | 3931 } else { |
3929 AddInstruction(elements); | 3932 AddInstruction(elements); |
3933 AddInstruction(elements_cow_map_check); | |
Vyacheslav Egorov (Chromium)
2011/07/14 13:03:44
Ditto.
Jakob Kummerow
2011/07/14 14:44:49
Done.
| |
3930 length = AddInstruction(new(zone()) HFixedArrayLength(elements)); | 3934 length = AddInstruction(new(zone()) HFixedArrayLength(elements)); |
3931 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3935 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3932 } | 3936 } |
3933 if (is_store) { | 3937 if (is_store) { |
3934 return new(zone()) HStoreKeyedFastElement(elements, checked_key, val); | 3938 return new(zone()) HStoreKeyedFastElement(elements, checked_key, val); |
3935 } else { | 3939 } else { |
3936 return new(zone()) HLoadKeyedFastElement(elements, checked_key); | 3940 return new(zone()) HLoadKeyedFastElement(elements, checked_key); |
3937 } | 3941 } |
3938 } | 3942 } |
3939 | 3943 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4025 typecheck->SetSuccessorAt(1, if_fastobject); | 4029 typecheck->SetSuccessorAt(1, if_fastobject); |
4026 current_block()->Finish(typecheck); | 4030 current_block()->Finish(typecheck); |
4027 | 4031 |
4028 set_current_block(if_jsarray); | 4032 set_current_block(if_jsarray); |
4029 HInstruction* length = new(zone()) HJSArrayLength(object); | 4033 HInstruction* length = new(zone()) HJSArrayLength(object); |
4030 AddInstruction(length); | 4034 AddInstruction(length); |
4031 length->ClearFlag(HValue::kUseGVN); | 4035 length->ClearFlag(HValue::kUseGVN); |
4032 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 4036 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
4033 elements = AddInstruction(new(zone()) HLoadElements(object)); | 4037 elements = AddInstruction(new(zone()) HLoadElements(object)); |
4034 elements->ClearFlag(HValue::kUseGVN); | 4038 elements->ClearFlag(HValue::kUseGVN); |
4039 AddInstruction(new(zone()) HCheckMap( | |
Vyacheslav Egorov (Chromium)
2011/07/14 13:03:44
redundant if !is_store
Jakob Kummerow
2011/07/14 14:44:49
Done.
| |
4040 elements, isolate()->factory()->fixed_array_map())); | |
4035 if (is_store) { | 4041 if (is_store) { |
4036 access = AddInstruction( | 4042 access = AddInstruction( |
4037 new(zone()) HStoreKeyedFastElement(elements, checked_key, val)); | 4043 new(zone()) HStoreKeyedFastElement(elements, checked_key, val)); |
4038 } else { | 4044 } else { |
4039 access = AddInstruction( | 4045 access = AddInstruction( |
4040 new(zone()) HLoadKeyedFastElement(elements, checked_key)); | 4046 new(zone()) HLoadKeyedFastElement(elements, checked_key)); |
4041 Push(access); | 4047 Push(access); |
4042 } | 4048 } |
4043 *has_side_effects |= access->HasSideEffects(); | 4049 *has_side_effects |= access->HasSideEffects(); |
4044 if (position != -1) { | 4050 if (position != -1) { |
4045 access->set_position(position); | 4051 access->set_position(position); |
4046 } | 4052 } |
4047 if_jsarray->Goto(join); | 4053 if_jsarray->Goto(join); |
4048 | 4054 |
4049 set_current_block(if_fastobject); | 4055 set_current_block(if_fastobject); |
4050 elements = AddInstruction(new(zone()) HLoadElements(object)); | 4056 elements = AddInstruction(new(zone()) HLoadElements(object)); |
4051 elements->ClearFlag(HValue::kUseGVN); | 4057 elements->ClearFlag(HValue::kUseGVN); |
4058 AddInstruction(new(zone()) HCheckMap( | |
Vyacheslav Egorov (Chromium)
2011/07/14 13:03:44
This map check is redundant if !is_store
Jakob Kummerow
2011/07/14 14:44:49
Done.
| |
4059 elements, isolate()->factory()->fixed_array_map())); | |
4052 length = AddInstruction(new(zone()) HFixedArrayLength(elements)); | 4060 length = AddInstruction(new(zone()) HFixedArrayLength(elements)); |
4053 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 4061 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
4054 if (is_store) { | 4062 if (is_store) { |
4055 access = AddInstruction( | 4063 access = AddInstruction( |
4056 new(zone()) HStoreKeyedFastElement(elements, checked_key, val)); | 4064 new(zone()) HStoreKeyedFastElement(elements, checked_key, val)); |
4057 } else { | 4065 } else { |
4058 access = AddInstruction( | 4066 access = AddInstruction( |
4059 new(zone()) HLoadKeyedFastElement(elements, checked_key)); | 4067 new(zone()) HLoadKeyedFastElement(elements, checked_key)); |
4060 } | 4068 } |
4061 } else if (elements_kind == JSObject::DICTIONARY_ELEMENTS) { | 4069 } else if (elements_kind == JSObject::DICTIONARY_ELEMENTS) { |
(...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6692 } | 6700 } |
6693 } | 6701 } |
6694 | 6702 |
6695 #ifdef DEBUG | 6703 #ifdef DEBUG |
6696 if (graph_ != NULL) graph_->Verify(); | 6704 if (graph_ != NULL) graph_->Verify(); |
6697 if (allocator_ != NULL) allocator_->Verify(); | 6705 if (allocator_ != NULL) allocator_->Verify(); |
6698 #endif | 6706 #endif |
6699 } | 6707 } |
6700 | 6708 |
6701 } } // namespace v8::internal | 6709 } } // namespace v8::internal |
OLD | NEW |