OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 // Support functions for v8 api (needed for correct interceptor behavior). | 2250 // Support functions for v8 api (needed for correct interceptor behavior). |
2251 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( | 2251 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( |
2252 Handle<JSObject> object, Handle<Name> name); | 2252 Handle<JSObject> object, Handle<Name> name); |
2253 MUST_USE_RESULT static Maybe<bool> HasRealElementProperty( | 2253 MUST_USE_RESULT static Maybe<bool> HasRealElementProperty( |
2254 Handle<JSObject> object, uint32_t index); | 2254 Handle<JSObject> object, uint32_t index); |
2255 MUST_USE_RESULT static Maybe<bool> HasRealNamedCallbackProperty( | 2255 MUST_USE_RESULT static Maybe<bool> HasRealNamedCallbackProperty( |
2256 Handle<JSObject> object, Handle<Name> name); | 2256 Handle<JSObject> object, Handle<Name> name); |
2257 | 2257 |
2258 // Get the header size for a JSObject. Used to compute the index of | 2258 // Get the header size for a JSObject. Used to compute the index of |
2259 // internal fields as well as the number of internal fields. | 2259 // internal fields as well as the number of internal fields. |
| 2260 static inline int GetHeaderSize(InstanceType instance_type); |
2260 inline int GetHeaderSize(); | 2261 inline int GetHeaderSize(); |
2261 | 2262 |
| 2263 static inline int GetInternalFieldCount(Map* map); |
2262 inline int GetInternalFieldCount(); | 2264 inline int GetInternalFieldCount(); |
2263 inline int GetInternalFieldOffset(int index); | 2265 inline int GetInternalFieldOffset(int index); |
2264 inline Object* GetInternalField(int index); | 2266 inline Object* GetInternalField(int index); |
2265 inline void SetInternalField(int index, Object* value); | 2267 inline void SetInternalField(int index, Object* value); |
2266 inline void SetInternalField(int index, Smi* value); | 2268 inline void SetInternalField(int index, Smi* value); |
2267 | 2269 |
2268 // Returns the number of properties on this object filtering out properties | 2270 // Returns the number of properties on this object filtering out properties |
2269 // with the specified attributes (ignoring interceptors). | 2271 // with the specified attributes (ignoring interceptors). |
2270 int NumberOfOwnProperties(PropertyAttributes filter = NONE); | 2272 int NumberOfOwnProperties(PropertyAttributes filter = NONE); |
2271 // Fill in details for properties into storage starting at the specified | 2273 // Fill in details for properties into storage starting at the specified |
(...skipping 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5792 // is found by re-transitioning from the root of the transition tree using the | 5794 // is found by re-transitioning from the root of the transition tree using the |
5793 // descriptor array of the map. Returns MaybeHandle<Map>() if no updated map | 5795 // descriptor array of the map. Returns MaybeHandle<Map>() if no updated map |
5794 // is found. | 5796 // is found. |
5795 static MaybeHandle<Map> TryUpdate(Handle<Map> map) WARN_UNUSED_RESULT; | 5797 static MaybeHandle<Map> TryUpdate(Handle<Map> map) WARN_UNUSED_RESULT; |
5796 | 5798 |
5797 // Returns a non-deprecated version of the input. This method may deprecate | 5799 // Returns a non-deprecated version of the input. This method may deprecate |
5798 // existing maps along the way if encodings conflict. Not for use while | 5800 // existing maps along the way if encodings conflict. Not for use while |
5799 // gathering type feedback. Use TryUpdate in those cases instead. | 5801 // gathering type feedback. Use TryUpdate in those cases instead. |
5800 static Handle<Map> Update(Handle<Map> map); | 5802 static Handle<Map> Update(Handle<Map> map); |
5801 | 5803 |
| 5804 static inline Handle<Map> CopyInitialMap(Handle<Map> map); |
| 5805 static Handle<Map> CopyInitialMap(Handle<Map> map, int instance_size, |
| 5806 int in_object_properties, |
| 5807 int unused_property_fields); |
5802 static Handle<Map> CopyDropDescriptors(Handle<Map> map); | 5808 static Handle<Map> CopyDropDescriptors(Handle<Map> map); |
5803 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, | 5809 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, |
5804 Descriptor* descriptor, | 5810 Descriptor* descriptor, |
5805 TransitionFlag flag); | 5811 TransitionFlag flag); |
5806 | 5812 |
5807 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( | 5813 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( |
5808 Handle<Map> map, | 5814 Handle<Map> map, |
5809 Handle<Name> name, | 5815 Handle<Name> name, |
5810 Handle<HeapType> type, | 5816 Handle<HeapType> type, |
5811 PropertyAttributes attributes, | 5817 PropertyAttributes attributes, |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6823 | 6829 |
6824 // Whether this function is defined in native code or extensions. | 6830 // Whether this function is defined in native code or extensions. |
6825 inline bool IsBuiltin(); | 6831 inline bool IsBuiltin(); |
6826 | 6832 |
6827 // Check whether or not this function is inlineable. | 6833 // Check whether or not this function is inlineable. |
6828 bool IsInlineable(); | 6834 bool IsInlineable(); |
6829 | 6835 |
6830 // Source size of this function. | 6836 // Source size of this function. |
6831 int SourceSize(); | 6837 int SourceSize(); |
6832 | 6838 |
6833 // Calculate the instance size. | |
6834 int CalculateInstanceSize(); | |
6835 | |
6836 // Calculate the number of in-object properties. | |
6837 int CalculateInObjectProperties(); | |
6838 | |
6839 inline bool has_simple_parameters(); | 6839 inline bool has_simple_parameters(); |
6840 | 6840 |
6841 // Initialize a SharedFunctionInfo from a parsed function literal. | 6841 // Initialize a SharedFunctionInfo from a parsed function literal. |
6842 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, | 6842 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, |
6843 FunctionLiteral* lit); | 6843 FunctionLiteral* lit); |
6844 | 6844 |
6845 // Dispatched behavior. | 6845 // Dispatched behavior. |
6846 DECLARE_PRINTER(SharedFunctionInfo) | 6846 DECLARE_PRINTER(SharedFunctionInfo) |
6847 DECLARE_VERIFIER(SharedFunctionInfo) | 6847 DECLARE_VERIFIER(SharedFunctionInfo) |
6848 | 6848 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7322 | 7322 |
7323 inline BindingsArray* function_bindings(); | 7323 inline BindingsArray* function_bindings(); |
7324 inline void set_function_bindings(BindingsArray* bindings); | 7324 inline void set_function_bindings(BindingsArray* bindings); |
7325 | 7325 |
7326 // The initial map for an object created by this constructor. | 7326 // The initial map for an object created by this constructor. |
7327 inline Map* initial_map(); | 7327 inline Map* initial_map(); |
7328 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, | 7328 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, |
7329 Handle<Object> prototype); | 7329 Handle<Object> prototype); |
7330 inline bool has_initial_map(); | 7330 inline bool has_initial_map(); |
7331 static void EnsureHasInitialMap(Handle<JSFunction> function); | 7331 static void EnsureHasInitialMap(Handle<JSFunction> function); |
| 7332 // Ensures that the |original_constructor| has correct initial map and |
| 7333 // returns it. If the |original_constructor| is not a subclass constructor |
| 7334 // its initial map is left unmodified. |
| 7335 static Handle<Map> EnsureDerivedHasInitialMap( |
| 7336 Handle<JSFunction> original_constructor, Handle<JSFunction> constructor); |
7332 | 7337 |
7333 // Get and set the prototype property on a JSFunction. If the | 7338 // Get and set the prototype property on a JSFunction. If the |
7334 // function has an initial map the prototype is set on the initial | 7339 // function has an initial map the prototype is set on the initial |
7335 // map. Otherwise, the prototype is put in the initial map field | 7340 // map. Otherwise, the prototype is put in the initial map field |
7336 // until an initial map is needed. | 7341 // until an initial map is needed. |
7337 inline bool has_prototype(); | 7342 inline bool has_prototype(); |
7338 inline bool has_instance_prototype(); | 7343 inline bool has_instance_prototype(); |
7339 inline Object* prototype(); | 7344 inline Object* prototype(); |
7340 inline Object* instance_prototype(); | 7345 inline Object* instance_prototype(); |
7341 static void SetPrototype(Handle<JSFunction> function, | 7346 static void SetPrototype(Handle<JSFunction> function, |
(...skipping 28 matching lines...) Expand all Loading... |
7370 // of optimized functions hanging off the native_context. The CodeFlusher | 7375 // of optimized functions hanging off the native_context. The CodeFlusher |
7371 // uses this link to chain together flushing candidates. Treated weakly | 7376 // uses this link to chain together flushing candidates. Treated weakly |
7372 // by the garbage collector. | 7377 // by the garbage collector. |
7373 DECL_ACCESSORS(next_function_link, Object) | 7378 DECL_ACCESSORS(next_function_link, Object) |
7374 | 7379 |
7375 // Prints the name of the function using PrintF. | 7380 // Prints the name of the function using PrintF. |
7376 void PrintName(FILE* out = stdout); | 7381 void PrintName(FILE* out = stdout); |
7377 | 7382 |
7378 DECLARE_CAST(JSFunction) | 7383 DECLARE_CAST(JSFunction) |
7379 | 7384 |
| 7385 // Calculate the instance size and in-object properties count. |
| 7386 void CalculateInstanceSize(InstanceType instance_type, |
| 7387 int requested_internal_fields, int* instance_size, |
| 7388 int* in_object_properties); |
| 7389 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type, |
| 7390 int requested_internal_fields, |
| 7391 int* instance_size, |
| 7392 int* in_object_properties); |
| 7393 |
7380 // Iterates the objects, including code objects indirectly referenced | 7394 // Iterates the objects, including code objects indirectly referenced |
7381 // through pointers to the first instruction in the code object. | 7395 // through pointers to the first instruction in the code object. |
7382 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); | 7396 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); |
7383 | 7397 |
7384 // Dispatched behavior. | 7398 // Dispatched behavior. |
7385 DECLARE_PRINTER(JSFunction) | 7399 DECLARE_PRINTER(JSFunction) |
7386 DECLARE_VERIFIER(JSFunction) | 7400 DECLARE_VERIFIER(JSFunction) |
7387 | 7401 |
7388 // Returns the number of allocated literals. | 7402 // Returns the number of allocated literals. |
7389 inline int NumberOfLiterals(); | 7403 inline int NumberOfLiterals(); |
(...skipping 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10829 // (elements + properties) in the current level. | 10843 // (elements + properties) in the current level. |
10830 int levelLength_ = 0; | 10844 int levelLength_ = 0; |
10831 | 10845 |
10832 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10846 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
10833 }; | 10847 }; |
10834 | 10848 |
10835 } // NOLINT, false-positive due to second-order macros. | 10849 } // NOLINT, false-positive due to second-order macros. |
10836 } // NOLINT, false-positive due to second-order macros. | 10850 } // NOLINT, false-positive due to second-order macros. |
10837 | 10851 |
10838 #endif // V8_OBJECTS_H_ | 10852 #endif // V8_OBJECTS_H_ |
OLD | NEW |