Chromium Code Reviews| 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1043 HType::Smi())); | 1043 HType::Smi())); |
| 1044 } else { | 1044 } else { |
| 1045 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 1045 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
| 1046 } | 1046 } |
| 1047 checked_key = AddBoundsCheck( | 1047 checked_key = AddBoundsCheck( |
| 1048 key, length, ALLOW_SMI_KEY, checked_index_representation); | 1048 key, length, ALLOW_SMI_KEY, checked_index_representation); |
| 1049 return BuildFastElementAccess(elements, checked_key, val, mapcheck, | 1049 return BuildFastElementAccess(elements, checked_key, val, mapcheck, |
| 1050 elements_kind, is_store); | 1050 elements_kind, is_store); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 HInstruction* HGraphBuilder::BuildFastArrayLengthLoad(HValue* object) { | |
| 1054 Zone* zone = this->zone(); | |
| 1055 return new (zone) HJSArrayLength(object, NULL, HType::Smi()); | |
| 1056 } | |
| 1057 | |
| 1053 | 1058 |
| 1054 HValue* HGraphBuilder::BuildAllocateElements(HContext* context, | 1059 HValue* HGraphBuilder::BuildAllocateElements(HContext* context, |
| 1055 ElementsKind kind, | 1060 ElementsKind kind, |
| 1056 HValue* capacity) { | 1061 HValue* capacity) { |
| 1057 Zone* zone = this->zone(); | 1062 Zone* zone = this->zone(); |
| 1058 | 1063 |
| 1059 int elements_size = IsFastDoubleElementsKind(kind) | 1064 int elements_size = IsFastDoubleElementsKind(kind) |
| 1060 ? kDoubleSize : kPointerSize; | 1065 ? kDoubleSize : kPointerSize; |
| 1061 HConstant* elements_size_value = | 1066 HConstant* elements_size_value = |
| 1062 new(zone) HConstant(elements_size, Representation::Integer32()); | 1067 new(zone) HConstant(elements_size, Representation::Integer32()); |
| (...skipping 5664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6727 } | 6732 } |
| 6728 | 6733 |
| 6729 | 6734 |
| 6730 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( | 6735 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic( |
| 6731 HValue* object, | 6736 HValue* object, |
| 6732 Handle<String> name, | 6737 Handle<String> name, |
| 6733 Property* expr, | 6738 Property* expr, |
| 6734 Handle<Map> map) { | 6739 Handle<Map> map) { |
| 6735 // Handle a load from a known field. | 6740 // Handle a load from a known field. |
| 6736 ASSERT(!map->is_dictionary_map()); | 6741 ASSERT(!map->is_dictionary_map()); |
| 6742 | |
| 6743 // Handle access to various length properties | |
| 6744 if (name->Equals(isolate()->heap()->length_string())) { | |
| 6745 if (map->instance_type() == JS_ARRAY_TYPE) { | |
| 6746 AddCheckMapsWithTransitions(object, map); | |
| 6747 return BuildFastArrayLengthLoad(object); | |
| 6748 } | |
| 6749 } | |
| 6750 | |
|
Dmitry Lomov (no reviews)
2013/03/11 17:31:31
Not sure if this is the best place yet to do this;
danno
2013/03/12 11:16:16
Those are two separate issues. For monomorphic han
| |
| 6737 LookupResult lookup(isolate()); | 6751 LookupResult lookup(isolate()); |
| 6738 map->LookupDescriptor(NULL, *name, &lookup); | 6752 map->LookupDescriptor(NULL, *name, &lookup); |
| 6739 if (lookup.IsField()) { | 6753 if (lookup.IsField()) { |
| 6740 AddCheckMapsWithTransitions(object, map); | 6754 AddCheckMapsWithTransitions(object, map); |
| 6741 return BuildLoadNamedField(object, map, &lookup); | 6755 return BuildLoadNamedField(object, map, &lookup); |
| 6742 } | 6756 } |
| 6743 | 6757 |
| 6744 // Handle a load of a constant known function. | 6758 // Handle a load of a constant known function. |
| 6745 if (lookup.IsConstantFunction()) { | 6759 if (lookup.IsConstantFunction()) { |
| 6746 AddCheckMapsWithTransitions(object, map); | 6760 AddCheckMapsWithTransitions(object, map); |
| (...skipping 4129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10876 } | 10890 } |
| 10877 } | 10891 } |
| 10878 | 10892 |
| 10879 #ifdef DEBUG | 10893 #ifdef DEBUG |
| 10880 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10894 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 10881 if (allocator_ != NULL) allocator_->Verify(); | 10895 if (allocator_ != NULL) allocator_->Verify(); |
| 10882 #endif | 10896 #endif |
| 10883 } | 10897 } |
| 10884 | 10898 |
| 10885 } } // namespace v8::internal | 10899 } } // namespace v8::internal |
| OLD | NEW |