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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 | 1073 |
1074 inline bool FitsRepresentation(Representation representation) { | 1074 inline bool FitsRepresentation(Representation representation) { |
1075 if (FLAG_track_fields && representation.IsSmi()) { | 1075 if (FLAG_track_fields && representation.IsSmi()) { |
1076 return IsSmi(); | 1076 return IsSmi(); |
1077 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 1077 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
1078 return IsNumber(); | 1078 return IsNumber(); |
1079 } | 1079 } |
1080 return true; | 1080 return true; |
1081 } | 1081 } |
1082 | 1082 |
| 1083 inline MaybeObject* AllocateNewStorageFor(Heap* heap, |
| 1084 Representation representation, |
| 1085 PretenureFlag tenure = NOT_TENURED); |
| 1086 |
1083 // Returns true if the object is of the correct type to be used as a | 1087 // Returns true if the object is of the correct type to be used as a |
1084 // implementation of a JSObject's elements. | 1088 // implementation of a JSObject's elements. |
1085 inline bool HasValidElements(); | 1089 inline bool HasValidElements(); |
1086 | 1090 |
1087 inline bool HasSpecificClassOf(String* name); | 1091 inline bool HasSpecificClassOf(String* name); |
1088 | 1092 |
1089 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. | 1093 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. |
1090 bool BooleanValue(); // ECMA-262 9.2. | 1094 bool BooleanValue(); // ECMA-262 9.2. |
1091 | 1095 |
1092 // Convert to a JSObject if needed. | 1096 // Convert to a JSObject if needed. |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 | 1825 |
1822 // Try to follow an existing transition to a field with attributes NONE. The | 1826 // Try to follow an existing transition to a field with attributes NONE. The |
1823 // return value indicates whether the transition was successful. | 1827 // return value indicates whether the transition was successful. |
1824 static inline Handle<Map> FindTransitionToField(Handle<Map> map, | 1828 static inline Handle<Map> FindTransitionToField(Handle<Map> map, |
1825 Handle<Name> key); | 1829 Handle<Name> key); |
1826 | 1830 |
1827 inline int LastAddedFieldIndex(); | 1831 inline int LastAddedFieldIndex(); |
1828 | 1832 |
1829 // Extend the receiver with a single fast property appeared first in the | 1833 // Extend the receiver with a single fast property appeared first in the |
1830 // passed map. This also extends the property backing store if necessary. | 1834 // passed map. This also extends the property backing store if necessary. |
1831 static void TransitionToMap(Handle<JSObject> object, Handle<Map> map); | 1835 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
1832 inline MUST_USE_RESULT MaybeObject* TransitionToMap(Map* map); | 1836 inline MUST_USE_RESULT MaybeObject* AllocateStorageForMap(Map* map); |
1833 | 1837 |
1834 static void MigrateInstance(Handle<JSObject> instance); | 1838 static void MigrateInstance(Handle<JSObject> instance); |
1835 inline MUST_USE_RESULT MaybeObject* MigrateInstance(); | 1839 inline MUST_USE_RESULT MaybeObject* MigrateInstance(); |
1836 | 1840 |
1837 // Can cause GC. | 1841 // Can cause GC. |
1838 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( | 1842 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( |
1839 Name* key, | 1843 Name* key, |
1840 Object* value, | 1844 Object* value, |
1841 PropertyAttributes attributes); | 1845 PropertyAttributes attributes); |
1842 | 1846 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); | 2132 int GetLocalElementKeys(FixedArray* storage, PropertyAttributes filter); |
2129 // Count and fill in the enumerable elements into storage. | 2133 // Count and fill in the enumerable elements into storage. |
2130 // (storage->length() == NumberOfEnumElements()). | 2134 // (storage->length() == NumberOfEnumElements()). |
2131 // If storage is NULL, will count the elements without adding | 2135 // If storage is NULL, will count the elements without adding |
2132 // them to any storage. | 2136 // them to any storage. |
2133 // Returns the number of enumerable elements. | 2137 // Returns the number of enumerable elements. |
2134 int GetEnumElementKeys(FixedArray* storage); | 2138 int GetEnumElementKeys(FixedArray* storage); |
2135 | 2139 |
2136 // Add a property to a fast-case object using a map transition to | 2140 // Add a property to a fast-case object using a map transition to |
2137 // new_map. | 2141 // new_map. |
2138 MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap(Map* new_map, | 2142 MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap( |
2139 Name* name, | 2143 Map* new_map, |
2140 Object* value, | 2144 Name* name, |
2141 int field_index); | 2145 Object* value, |
| 2146 int field_index, |
| 2147 Representation representation); |
2142 | 2148 |
2143 // Add a constant function property to a fast-case object. | 2149 // Add a constant function property to a fast-case object. |
2144 // This leaves a CONSTANT_TRANSITION in the old map, and | 2150 // This leaves a CONSTANT_TRANSITION in the old map, and |
2145 // if it is called on a second object with this map, a | 2151 // if it is called on a second object with this map, a |
2146 // normal property is added instead, with a map transition. | 2152 // normal property is added instead, with a map transition. |
2147 // This avoids the creation of many maps with the same constant | 2153 // This avoids the creation of many maps with the same constant |
2148 // function, all orphaned. | 2154 // function, all orphaned. |
2149 MUST_USE_RESULT MaybeObject* AddConstantFunctionProperty( | 2155 MUST_USE_RESULT MaybeObject* AddConstantFunctionProperty( |
2150 Name* name, | 2156 Name* name, |
2151 JSFunction* function, | 2157 JSFunction* function, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 | 2246 |
2241 // Transform slow named properties to fast variants. | 2247 // Transform slow named properties to fast variants. |
2242 // Returns failure if allocation failed. | 2248 // Returns failure if allocation failed. |
2243 static void TransformToFastProperties(Handle<JSObject> object, | 2249 static void TransformToFastProperties(Handle<JSObject> object, |
2244 int unused_property_fields); | 2250 int unused_property_fields); |
2245 | 2251 |
2246 MUST_USE_RESULT MaybeObject* TransformToFastProperties( | 2252 MUST_USE_RESULT MaybeObject* TransformToFastProperties( |
2247 int unused_property_fields); | 2253 int unused_property_fields); |
2248 | 2254 |
2249 // Access fast-case object properties at index. | 2255 // Access fast-case object properties at index. |
2250 inline Object* FastPropertyAt(int index); | 2256 MUST_USE_RESULT inline MaybeObject* FastPropertyAt( |
2251 inline Object* FastPropertyAtPut(int index, Object* value); | 2257 Representation representation, |
| 2258 int index); |
| 2259 inline Object* RawFastPropertyAt(int index); |
| 2260 inline void FastPropertyAtPut(int index, Object* value); |
2252 | 2261 |
2253 // Access to in object properties. | 2262 // Access to in object properties. |
2254 inline int GetInObjectPropertyOffset(int index); | 2263 inline int GetInObjectPropertyOffset(int index); |
2255 inline Object* InObjectPropertyAt(int index); | 2264 inline Object* InObjectPropertyAt(int index); |
2256 inline Object* InObjectPropertyAtPut(int index, | 2265 inline Object* InObjectPropertyAtPut(int index, |
2257 Object* value, | 2266 Object* value, |
2258 WriteBarrierMode mode | 2267 WriteBarrierMode mode |
2259 = UPDATE_WRITE_BARRIER); | 2268 = UPDATE_WRITE_BARRIER); |
2260 | 2269 |
2261 // Initializes the body after properties slot, properties slot is | 2270 // Initializes the body after properties slot, properties slot is |
(...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5192 | 5201 |
5193 void DeprecateTransitionTree(); | 5202 void DeprecateTransitionTree(); |
5194 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 5203 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); |
5195 | 5204 |
5196 Map* FindRootMap(); | 5205 Map* FindRootMap(); |
5197 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); | 5206 Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); |
5198 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 5207 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
5199 | 5208 |
5200 int NumberOfFields(); | 5209 int NumberOfFields(); |
5201 | 5210 |
5202 bool InstancesNeedRewriting(int target_number_of_fields, | 5211 bool InstancesNeedRewriting(Map* target, |
| 5212 int target_number_of_fields, |
5203 int target_inobject, | 5213 int target_inobject, |
5204 int target_unused); | 5214 int target_unused); |
5205 static Handle<Map> GeneralizeRepresentation( | 5215 static Handle<Map> GeneralizeRepresentation( |
5206 Handle<Map> map, | 5216 Handle<Map> map, |
5207 int modify_index, | 5217 int modify_index, |
5208 Representation new_representation); | 5218 Representation new_representation); |
5209 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( | 5219 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( |
5210 int modify_index, | 5220 int modify_index, |
5211 Representation representation); | 5221 Representation representation); |
5212 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations(); | 5222 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations(); |
(...skipping 4337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9550 } else { | 9560 } else { |
9551 value &= ~(1 << bit_position); | 9561 value &= ~(1 << bit_position); |
9552 } | 9562 } |
9553 return value; | 9563 return value; |
9554 } | 9564 } |
9555 }; | 9565 }; |
9556 | 9566 |
9557 } } // namespace v8::internal | 9567 } } // namespace v8::internal |
9558 | 9568 |
9559 #endif // V8_OBJECTS_H_ | 9569 #endif // V8_OBJECTS_H_ |
OLD | NEW |