OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2740 { MaybeObject* maybe_obj = CopyDropTransitions(); | 2740 { MaybeObject* maybe_obj = CopyDropTransitions(); |
2741 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 2741 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
2742 } | 2742 } |
2743 Map* new_map = Map::cast(obj); | 2743 Map* new_map = Map::cast(obj); |
2744 new_map->set_has_fast_elements(false); | 2744 new_map->set_has_fast_elements(false); |
2745 Counters::map_fast_to_slow_elements.Increment(); | 2745 Counters::map_fast_to_slow_elements.Increment(); |
2746 return new_map; | 2746 return new_map; |
2747 } | 2747 } |
2748 | 2748 |
2749 | 2749 |
| 2750 MaybeObject* Map::GetPixelArrayElementsMap() { |
| 2751 if (has_pixel_array_elements()) return this; |
| 2752 // TODO(danno): Special case empty object map (or most common case) |
| 2753 // to return a pre-canned pixel array map. |
| 2754 Object* obj; |
| 2755 { MaybeObject* maybe_obj = CopyDropTransitions(); |
| 2756 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2757 } |
| 2758 Map* new_map = Map::cast(obj); |
| 2759 new_map->set_has_fast_elements(false); |
| 2760 new_map->set_has_pixel_array_elements(true); |
| 2761 Counters::map_to_pixel_array_elements.Increment(); |
| 2762 return new_map; |
| 2763 } |
| 2764 |
| 2765 |
2750 ACCESSORS(Map, instance_descriptors, DescriptorArray, | 2766 ACCESSORS(Map, instance_descriptors, DescriptorArray, |
2751 kInstanceDescriptorsOffset) | 2767 kInstanceDescriptorsOffset) |
2752 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 2768 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
2753 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 2769 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
2754 | 2770 |
2755 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 2771 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
2756 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) | 2772 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) |
2757 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) | 2773 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) |
2758 | 2774 |
2759 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 2775 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3913 #undef WRITE_INT_FIELD | 3929 #undef WRITE_INT_FIELD |
3914 #undef READ_SHORT_FIELD | 3930 #undef READ_SHORT_FIELD |
3915 #undef WRITE_SHORT_FIELD | 3931 #undef WRITE_SHORT_FIELD |
3916 #undef READ_BYTE_FIELD | 3932 #undef READ_BYTE_FIELD |
3917 #undef WRITE_BYTE_FIELD | 3933 #undef WRITE_BYTE_FIELD |
3918 | 3934 |
3919 | 3935 |
3920 } } // namespace v8::internal | 3936 } } // namespace v8::internal |
3921 | 3937 |
3922 #endif // V8_OBJECTS_INL_H_ | 3938 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |