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 3893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3904 if (!map->has_fast_elements() && | 3904 if (!map->has_fast_elements() && |
3905 !map->has_fast_double_elements() && | 3905 !map->has_fast_double_elements() && |
3906 !map->has_external_array_elements()) { | 3906 !map->has_external_array_elements()) { |
3907 return is_store ? BuildStoreKeyedGeneric(object, key, val) | 3907 return is_store ? BuildStoreKeyedGeneric(object, key, val) |
3908 : BuildLoadKeyedGeneric(object, key); | 3908 : BuildLoadKeyedGeneric(object, key); |
3909 } | 3909 } |
3910 AddInstruction(new(zone()) HCheckNonSmi(object)); | 3910 AddInstruction(new(zone()) HCheckNonSmi(object)); |
3911 HInstruction* mapcheck = AddInstruction(new(zone()) HCheckMap(object, map)); | 3911 HInstruction* mapcheck = AddInstruction(new(zone()) HCheckMap(object, map)); |
3912 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); | 3912 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); |
3913 bool fast_double_elements = map->has_fast_double_elements(); | 3913 bool fast_double_elements = map->has_fast_double_elements(); |
3914 if (is_store && !fast_double_elements) { | 3914 if (is_store && map->has_fast_elements()) { |
3915 AddInstruction(new(zone()) HCheckMap( | 3915 AddInstruction(new(zone()) HCheckMap( |
3916 elements, isolate()->factory()->fixed_array_map())); | 3916 elements, isolate()->factory()->fixed_array_map())); |
3917 } | 3917 } |
3918 HInstruction* length = NULL; | 3918 HInstruction* length = NULL; |
3919 HInstruction* checked_key = NULL; | 3919 HInstruction* checked_key = NULL; |
3920 if (map->has_external_array_elements()) { | 3920 if (map->has_external_array_elements()) { |
3921 length = AddInstruction(new(zone()) HExternalArrayLength(elements)); | 3921 length = AddInstruction(new(zone()) HExternalArrayLength(elements)); |
3922 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3922 checked_key = AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3923 HLoadExternalArrayPointer* external_elements = | 3923 HLoadExternalArrayPointer* external_elements = |
3924 new(zone()) HLoadExternalArrayPointer(elements); | 3924 new(zone()) HLoadExternalArrayPointer(elements); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4015 elements_kind_branch->SetSuccessorAt(0, if_true); | 4015 elements_kind_branch->SetSuccessorAt(0, if_true); |
4016 elements_kind_branch->SetSuccessorAt(1, if_false); | 4016 elements_kind_branch->SetSuccessorAt(1, if_false); |
4017 current_block()->Finish(elements_kind_branch); | 4017 current_block()->Finish(elements_kind_branch); |
4018 | 4018 |
4019 set_current_block(if_true); | 4019 set_current_block(if_true); |
4020 HInstruction* access; | 4020 HInstruction* access; |
4021 if (elements_kind == JSObject::FAST_ELEMENTS || | 4021 if (elements_kind == JSObject::FAST_ELEMENTS || |
4022 elements_kind == JSObject::FAST_DOUBLE_ELEMENTS) { | 4022 elements_kind == JSObject::FAST_DOUBLE_ELEMENTS) { |
4023 bool fast_double_elements = | 4023 bool fast_double_elements = |
4024 elements_kind == JSObject::FAST_DOUBLE_ELEMENTS; | 4024 elements_kind == JSObject::FAST_DOUBLE_ELEMENTS; |
4025 if (is_store && !fast_double_elements) { | 4025 if (is_store && !fast_double_elements) { |
danno
2011/07/21 11:44:02
Should also be map->has_fast_elements()
Jakob Kummerow
2011/07/21 12:01:32
Except that we don't have an object called |map| a
| |
4026 AddInstruction(new(zone()) HCheckMap( | 4026 AddInstruction(new(zone()) HCheckMap( |
4027 elements, isolate()->factory()->fixed_array_map())); | 4027 elements, isolate()->factory()->fixed_array_map(), |
4028 elements_kind_branch)); | |
4028 } | 4029 } |
4029 HBasicBlock* if_jsarray = graph()->CreateBasicBlock(); | 4030 HBasicBlock* if_jsarray = graph()->CreateBasicBlock(); |
4030 HBasicBlock* if_fastobject = graph()->CreateBasicBlock(); | 4031 HBasicBlock* if_fastobject = graph()->CreateBasicBlock(); |
4031 HHasInstanceTypeAndBranch* typecheck = | 4032 HHasInstanceTypeAndBranch* typecheck = |
4032 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE); | 4033 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE); |
4033 typecheck->SetSuccessorAt(0, if_jsarray); | 4034 typecheck->SetSuccessorAt(0, if_jsarray); |
4034 typecheck->SetSuccessorAt(1, if_fastobject); | 4035 typecheck->SetSuccessorAt(1, if_fastobject); |
4035 current_block()->Finish(typecheck); | 4036 current_block()->Finish(typecheck); |
4036 | 4037 |
4037 set_current_block(if_jsarray); | 4038 set_current_block(if_jsarray); |
(...skipping 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6721 } | 6722 } |
6722 } | 6723 } |
6723 | 6724 |
6724 #ifdef DEBUG | 6725 #ifdef DEBUG |
6725 if (graph_ != NULL) graph_->Verify(); | 6726 if (graph_ != NULL) graph_->Verify(); |
6726 if (allocator_ != NULL) allocator_->Verify(); | 6727 if (allocator_ != NULL) allocator_->Verify(); |
6727 #endif | 6728 #endif |
6728 } | 6729 } |
6729 | 6730 |
6730 } } // namespace v8::internal | 6731 } } // namespace v8::internal |
OLD | NEW |