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 3922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3933 HInstruction* mapcheck = AddInstruction(new(zone()) HCheckMap(object, map)); | 3933 HInstruction* mapcheck = AddInstruction(new(zone()) HCheckMap(object, map)); |
3934 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); | 3934 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); |
3935 bool fast_double_elements = map->has_fast_double_elements(); | 3935 bool fast_double_elements = map->has_fast_double_elements(); |
3936 if (is_store && map->has_fast_elements()) { | 3936 if (is_store && map->has_fast_elements()) { |
3937 AddInstruction(new(zone()) HCheckMap( | 3937 AddInstruction(new(zone()) HCheckMap( |
3938 elements, isolate()->factory()->fixed_array_map())); | 3938 elements, isolate()->factory()->fixed_array_map())); |
3939 } | 3939 } |
3940 HInstruction* length = NULL; | 3940 HInstruction* length = NULL; |
3941 HInstruction* checked_key = NULL; | 3941 HInstruction* checked_key = NULL; |
3942 if (map->has_external_array_elements()) { | 3942 if (map->has_external_array_elements()) { |
3943 length = AddInstruction(new(zone()) HExternalArrayLength(elements)); | 3943 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
3944 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3944 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3945 HLoadExternalArrayPointer* external_elements = | 3945 HLoadExternalArrayPointer* external_elements = |
3946 new(zone()) HLoadExternalArrayPointer(elements); | 3946 new(zone()) HLoadExternalArrayPointer(elements); |
3947 AddInstruction(external_elements); | 3947 AddInstruction(external_elements); |
3948 return BuildExternalArrayElementAccess(external_elements, checked_key, | 3948 return BuildExternalArrayElementAccess(external_elements, checked_key, |
3949 val, map->elements_kind(), is_store); | 3949 val, map->elements_kind(), is_store); |
3950 } | 3950 } |
3951 ASSERT(map->has_fast_elements() || fast_double_elements); | 3951 ASSERT(map->has_fast_elements() || fast_double_elements); |
3952 if (map->instance_type() == JS_ARRAY_TYPE) { | 3952 if (map->instance_type() == JS_ARRAY_TYPE) { |
3953 length = AddInstruction(new(zone()) HJSArrayLength(object, mapcheck)); | 3953 length = AddInstruction(new(zone()) HJSArrayLength(object, mapcheck)); |
3954 } else { | 3954 } else { |
3955 length = AddInstruction(new(zone()) HFixedArrayLength(elements)); | 3955 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
3956 } | 3956 } |
3957 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3957 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3958 if (is_store) { | 3958 if (is_store) { |
3959 if (fast_double_elements) { | 3959 if (fast_double_elements) { |
3960 return new(zone()) HStoreKeyedFastDoubleElement(elements, | 3960 return new(zone()) HStoreKeyedFastDoubleElement(elements, |
3961 checked_key, | 3961 checked_key, |
3962 val); | 3962 val); |
3963 } else { | 3963 } else { |
3964 return new(zone()) HStoreKeyedFastElement(elements, checked_key, val); | 3964 return new(zone()) HStoreKeyedFastElement(elements, checked_key, val); |
3965 } | 3965 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4017 for (JSObject::ElementsKind elements_kind = JSObject::FAST_ELEMENTS; | 4017 for (JSObject::ElementsKind elements_kind = JSObject::FAST_ELEMENTS; |
4018 elements_kind <= JSObject::LAST_ELEMENTS_KIND; | 4018 elements_kind <= JSObject::LAST_ELEMENTS_KIND; |
4019 elements_kind = JSObject::ElementsKind(elements_kind + 1)) { | 4019 elements_kind = JSObject::ElementsKind(elements_kind + 1)) { |
4020 // After having handled FAST_ELEMENTS and DICTIONARY_ELEMENTS, we | 4020 // After having handled FAST_ELEMENTS and DICTIONARY_ELEMENTS, we |
4021 // need to add some code that's executed for all external array cases. | 4021 // need to add some code that's executed for all external array cases. |
4022 STATIC_ASSERT(JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND == | 4022 STATIC_ASSERT(JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND == |
4023 JSObject::LAST_ELEMENTS_KIND); | 4023 JSObject::LAST_ELEMENTS_KIND); |
4024 if (elements_kind == JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND | 4024 if (elements_kind == JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND |
4025 && todo_external_array) { | 4025 && todo_external_array) { |
4026 HInstruction* length = | 4026 HInstruction* length = |
4027 AddInstruction(new(zone()) HExternalArrayLength(elements)); | 4027 AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
4028 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 4028 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
4029 external_elements = new(zone()) HLoadExternalArrayPointer(elements); | 4029 external_elements = new(zone()) HLoadExternalArrayPointer(elements); |
4030 AddInstruction(external_elements); | 4030 AddInstruction(external_elements); |
4031 } | 4031 } |
4032 if (type_todo[elements_kind]) { | 4032 if (type_todo[elements_kind]) { |
4033 HBasicBlock* if_true = graph()->CreateBasicBlock(); | 4033 HBasicBlock* if_true = graph()->CreateBasicBlock(); |
4034 HBasicBlock* if_false = graph()->CreateBasicBlock(); | 4034 HBasicBlock* if_false = graph()->CreateBasicBlock(); |
4035 elements_kind_branch = new(zone()) HCompareConstantEqAndBranch( | 4035 elements_kind_branch = new(zone()) HCompareConstantEqAndBranch( |
4036 elements_kind_instr, elements_kind, Token::EQ_STRICT); | 4036 elements_kind_instr, elements_kind, Token::EQ_STRICT); |
4037 elements_kind_branch->SetSuccessorAt(0, if_true); | 4037 elements_kind_branch->SetSuccessorAt(0, if_true); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4081 } | 4081 } |
4082 Push(access); | 4082 Push(access); |
4083 } | 4083 } |
4084 *has_side_effects |= access->HasSideEffects(); | 4084 *has_side_effects |= access->HasSideEffects(); |
4085 if (position != -1) { | 4085 if (position != -1) { |
4086 access->set_position(position); | 4086 access->set_position(position); |
4087 } | 4087 } |
4088 if_jsarray->Goto(join); | 4088 if_jsarray->Goto(join); |
4089 | 4089 |
4090 set_current_block(if_fastobject); | 4090 set_current_block(if_fastobject); |
4091 length = AddInstruction(new(zone()) HFixedArrayLength(elements)); | 4091 length = AddInstruction(new(zone()) HFixedArrayBaseLength(elements)); |
4092 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 4092 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
4093 if (is_store) { | 4093 if (is_store) { |
4094 if (fast_double_elements) { | 4094 if (fast_double_elements) { |
4095 access = AddInstruction( | 4095 access = AddInstruction( |
4096 new(zone()) HStoreKeyedFastDoubleElement(elements, | 4096 new(zone()) HStoreKeyedFastDoubleElement(elements, |
4097 checked_key, | 4097 checked_key, |
4098 val)); | 4098 val)); |
4099 } else { | 4099 } else { |
4100 access = AddInstruction( | 4100 access = AddInstruction( |
4101 new(zone()) HStoreKeyedFastElement(elements, checked_key, val)); | 4101 new(zone()) HStoreKeyedFastElement(elements, checked_key, val)); |
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6747 } | 6747 } |
6748 } | 6748 } |
6749 | 6749 |
6750 #ifdef DEBUG | 6750 #ifdef DEBUG |
6751 if (graph_ != NULL) graph_->Verify(); | 6751 if (graph_ != NULL) graph_->Verify(); |
6752 if (allocator_ != NULL) allocator_->Verify(); | 6752 if (allocator_ != NULL) allocator_->Verify(); |
6753 #endif | 6753 #endif |
6754 } | 6754 } |
6755 | 6755 |
6756 } } // namespace v8::internal | 6756 } } // namespace v8::internal |
OLD | NEW |