| 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 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2257 // Support functions for v8 api (needed for correct interceptor behavior). | 2257 // Support functions for v8 api (needed for correct interceptor behavior). |
| 2258 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( | 2258 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( |
| 2259 Handle<JSObject> object, Handle<Name> name); | 2259 Handle<JSObject> object, Handle<Name> name); |
| 2260 MUST_USE_RESULT static Maybe<bool> HasRealElementProperty( | 2260 MUST_USE_RESULT static Maybe<bool> HasRealElementProperty( |
| 2261 Handle<JSObject> object, uint32_t index); | 2261 Handle<JSObject> object, uint32_t index); |
| 2262 MUST_USE_RESULT static Maybe<bool> HasRealNamedCallbackProperty( | 2262 MUST_USE_RESULT static Maybe<bool> HasRealNamedCallbackProperty( |
| 2263 Handle<JSObject> object, Handle<Name> name); | 2263 Handle<JSObject> object, Handle<Name> name); |
| 2264 | 2264 |
| 2265 // Get the header size for a JSObject. Used to compute the index of | 2265 // Get the header size for a JSObject. Used to compute the index of |
| 2266 // internal fields as well as the number of internal fields. | 2266 // internal fields as well as the number of internal fields. |
| 2267 static inline int GetHeaderSize(InstanceType instance_type); | |
| 2268 inline int GetHeaderSize(); | 2267 inline int GetHeaderSize(); |
| 2269 | 2268 |
| 2270 static inline int GetInternalFieldCount(Map* map); | |
| 2271 inline int GetInternalFieldCount(); | 2269 inline int GetInternalFieldCount(); |
| 2272 inline int GetInternalFieldOffset(int index); | 2270 inline int GetInternalFieldOffset(int index); |
| 2273 inline Object* GetInternalField(int index); | 2271 inline Object* GetInternalField(int index); |
| 2274 inline void SetInternalField(int index, Object* value); | 2272 inline void SetInternalField(int index, Object* value); |
| 2275 inline void SetInternalField(int index, Smi* value); | 2273 inline void SetInternalField(int index, Smi* value); |
| 2276 | 2274 |
| 2277 // Returns the number of properties on this object filtering out properties | 2275 // Returns the number of properties on this object filtering out properties |
| 2278 // with the specified attributes (ignoring interceptors). | 2276 // with the specified attributes (ignoring interceptors). |
| 2279 int NumberOfOwnProperties(PropertyAttributes filter = NONE); | 2277 int NumberOfOwnProperties(PropertyAttributes filter = NONE); |
| 2280 // Fill in details for properties into storage starting at the specified | 2278 // Fill in details for properties into storage starting at the specified |
| (...skipping 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5801 // is found by re-transitioning from the root of the transition tree using the | 5799 // is found by re-transitioning from the root of the transition tree using the |
| 5802 // descriptor array of the map. Returns MaybeHandle<Map>() if no updated map | 5800 // descriptor array of the map. Returns MaybeHandle<Map>() if no updated map |
| 5803 // is found. | 5801 // is found. |
| 5804 static MaybeHandle<Map> TryUpdate(Handle<Map> map) WARN_UNUSED_RESULT; | 5802 static MaybeHandle<Map> TryUpdate(Handle<Map> map) WARN_UNUSED_RESULT; |
| 5805 | 5803 |
| 5806 // Returns a non-deprecated version of the input. This method may deprecate | 5804 // Returns a non-deprecated version of the input. This method may deprecate |
| 5807 // existing maps along the way if encodings conflict. Not for use while | 5805 // existing maps along the way if encodings conflict. Not for use while |
| 5808 // gathering type feedback. Use TryUpdate in those cases instead. | 5806 // gathering type feedback. Use TryUpdate in those cases instead. |
| 5809 static Handle<Map> Update(Handle<Map> map); | 5807 static Handle<Map> Update(Handle<Map> map); |
| 5810 | 5808 |
| 5811 static inline Handle<Map> CopyInitialMap(Handle<Map> map); | |
| 5812 static Handle<Map> CopyInitialMap(Handle<Map> map, int instance_size, | |
| 5813 int in_object_properties, | |
| 5814 int unused_property_fields); | |
| 5815 static Handle<Map> CopyDropDescriptors(Handle<Map> map); | 5809 static Handle<Map> CopyDropDescriptors(Handle<Map> map); |
| 5816 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, | 5810 static Handle<Map> CopyInsertDescriptor(Handle<Map> map, |
| 5817 Descriptor* descriptor, | 5811 Descriptor* descriptor, |
| 5818 TransitionFlag flag); | 5812 TransitionFlag flag); |
| 5819 | 5813 |
| 5820 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( | 5814 MUST_USE_RESULT static MaybeHandle<Map> CopyWithField( |
| 5821 Handle<Map> map, | 5815 Handle<Map> map, |
| 5822 Handle<Name> name, | 5816 Handle<Name> name, |
| 5823 Handle<HeapType> type, | 5817 Handle<HeapType> type, |
| 5824 PropertyAttributes attributes, | 5818 PropertyAttributes attributes, |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6836 | 6830 |
| 6837 // Whether this function is defined in native code or extensions. | 6831 // Whether this function is defined in native code or extensions. |
| 6838 inline bool IsBuiltin(); | 6832 inline bool IsBuiltin(); |
| 6839 | 6833 |
| 6840 // Check whether or not this function is inlineable. | 6834 // Check whether or not this function is inlineable. |
| 6841 bool IsInlineable(); | 6835 bool IsInlineable(); |
| 6842 | 6836 |
| 6843 // Source size of this function. | 6837 // Source size of this function. |
| 6844 int SourceSize(); | 6838 int SourceSize(); |
| 6845 | 6839 |
| 6840 // Calculate the instance size. |
| 6841 int CalculateInstanceSize(); |
| 6842 |
| 6843 // Calculate the number of in-object properties. |
| 6844 int CalculateInObjectProperties(); |
| 6845 |
| 6846 inline bool has_simple_parameters(); | 6846 inline bool has_simple_parameters(); |
| 6847 | 6847 |
| 6848 // Initialize a SharedFunctionInfo from a parsed function literal. | 6848 // Initialize a SharedFunctionInfo from a parsed function literal. |
| 6849 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, | 6849 static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info, |
| 6850 FunctionLiteral* lit); | 6850 FunctionLiteral* lit); |
| 6851 | 6851 |
| 6852 // Dispatched behavior. | 6852 // Dispatched behavior. |
| 6853 DECLARE_PRINTER(SharedFunctionInfo) | 6853 DECLARE_PRINTER(SharedFunctionInfo) |
| 6854 DECLARE_VERIFIER(SharedFunctionInfo) | 6854 DECLARE_VERIFIER(SharedFunctionInfo) |
| 6855 | 6855 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7329 | 7329 |
| 7330 inline BindingsArray* function_bindings(); | 7330 inline BindingsArray* function_bindings(); |
| 7331 inline void set_function_bindings(BindingsArray* bindings); | 7331 inline void set_function_bindings(BindingsArray* bindings); |
| 7332 | 7332 |
| 7333 // The initial map for an object created by this constructor. | 7333 // The initial map for an object created by this constructor. |
| 7334 inline Map* initial_map(); | 7334 inline Map* initial_map(); |
| 7335 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, | 7335 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, |
| 7336 Handle<Object> prototype); | 7336 Handle<Object> prototype); |
| 7337 inline bool has_initial_map(); | 7337 inline bool has_initial_map(); |
| 7338 static void EnsureHasInitialMap(Handle<JSFunction> function); | 7338 static void EnsureHasInitialMap(Handle<JSFunction> function); |
| 7339 // Ensures that the |original_constructor| has correct initial map and | |
| 7340 // returns it. If the |original_constructor| is not a subclass constructor | |
| 7341 // its initial map is left unmodified. | |
| 7342 static Handle<Map> EnsureDerivedHasInitialMap( | |
| 7343 Handle<JSFunction> original_constructor, Handle<JSFunction> constructor); | |
| 7344 | 7339 |
| 7345 // Get and set the prototype property on a JSFunction. If the | 7340 // Get and set the prototype property on a JSFunction. If the |
| 7346 // function has an initial map the prototype is set on the initial | 7341 // function has an initial map the prototype is set on the initial |
| 7347 // map. Otherwise, the prototype is put in the initial map field | 7342 // map. Otherwise, the prototype is put in the initial map field |
| 7348 // until an initial map is needed. | 7343 // until an initial map is needed. |
| 7349 inline bool has_prototype(); | 7344 inline bool has_prototype(); |
| 7350 inline bool has_instance_prototype(); | 7345 inline bool has_instance_prototype(); |
| 7351 inline Object* prototype(); | 7346 inline Object* prototype(); |
| 7352 inline Object* instance_prototype(); | 7347 inline Object* instance_prototype(); |
| 7353 static void SetPrototype(Handle<JSFunction> function, | 7348 static void SetPrototype(Handle<JSFunction> function, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 7382 // of optimized functions hanging off the native_context. The CodeFlusher | 7377 // of optimized functions hanging off the native_context. The CodeFlusher |
| 7383 // uses this link to chain together flushing candidates. Treated weakly | 7378 // uses this link to chain together flushing candidates. Treated weakly |
| 7384 // by the garbage collector. | 7379 // by the garbage collector. |
| 7385 DECL_ACCESSORS(next_function_link, Object) | 7380 DECL_ACCESSORS(next_function_link, Object) |
| 7386 | 7381 |
| 7387 // Prints the name of the function using PrintF. | 7382 // Prints the name of the function using PrintF. |
| 7388 void PrintName(FILE* out = stdout); | 7383 void PrintName(FILE* out = stdout); |
| 7389 | 7384 |
| 7390 DECLARE_CAST(JSFunction) | 7385 DECLARE_CAST(JSFunction) |
| 7391 | 7386 |
| 7392 // Calculate the instance size and in-object properties count. | |
| 7393 void CalculateInstanceSize(InstanceType instance_type, | |
| 7394 int requested_internal_fields, int* instance_size, | |
| 7395 int* in_object_properties); | |
| 7396 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type, | |
| 7397 int requested_internal_fields, | |
| 7398 int* instance_size, | |
| 7399 int* in_object_properties); | |
| 7400 | |
| 7401 // Iterates the objects, including code objects indirectly referenced | 7387 // Iterates the objects, including code objects indirectly referenced |
| 7402 // through pointers to the first instruction in the code object. | 7388 // through pointers to the first instruction in the code object. |
| 7403 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); | 7389 void JSFunctionIterateBody(int object_size, ObjectVisitor* v); |
| 7404 | 7390 |
| 7405 // Dispatched behavior. | 7391 // Dispatched behavior. |
| 7406 DECLARE_PRINTER(JSFunction) | 7392 DECLARE_PRINTER(JSFunction) |
| 7407 DECLARE_VERIFIER(JSFunction) | 7393 DECLARE_VERIFIER(JSFunction) |
| 7408 | 7394 |
| 7409 // Returns the number of allocated literals. | 7395 // Returns the number of allocated literals. |
| 7410 inline int NumberOfLiterals(); | 7396 inline int NumberOfLiterals(); |
| (...skipping 3441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10852 // (elements + properties) in the current level. | 10838 // (elements + properties) in the current level. |
| 10853 int levelLength_ = 0; | 10839 int levelLength_ = 0; |
| 10854 | 10840 |
| 10855 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10841 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
| 10856 }; | 10842 }; |
| 10857 | 10843 |
| 10858 } // NOLINT, false-positive due to second-order macros. | 10844 } // NOLINT, false-positive due to second-order macros. |
| 10859 } // NOLINT, false-positive due to second-order macros. | 10845 } // NOLINT, false-positive due to second-order macros. |
| 10860 | 10846 |
| 10861 #endif // V8_OBJECTS_H_ | 10847 #endif // V8_OBJECTS_H_ |
| OLD | NEW |