| 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 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2148 | 2148 |
| 2149 // [elements]: The elements (properties with names that are integers). | 2149 // [elements]: The elements (properties with names that are integers). |
| 2150 // | 2150 // |
| 2151 // Elements can be in two general modes: fast and slow. Each mode | 2151 // Elements can be in two general modes: fast and slow. Each mode |
| 2152 // corrensponds to a set of object representations of elements that | 2152 // corrensponds to a set of object representations of elements that |
| 2153 // have something in common. | 2153 // have something in common. |
| 2154 // | 2154 // |
| 2155 // In the fast mode elements is a FixedArray and so each element can | 2155 // In the fast mode elements is a FixedArray and so each element can |
| 2156 // be quickly accessed. This fact is used in the generated code. The | 2156 // be quickly accessed. This fact is used in the generated code. The |
| 2157 // elements array can have one of three maps in this mode: | 2157 // elements array can have one of three maps in this mode: |
| 2158 // fixed_array_map, non_strict_arguments_elements_map or | 2158 // fixed_array_map, sloppy_arguments_elements_map or |
| 2159 // fixed_cow_array_map (for copy-on-write arrays). In the latter case | 2159 // fixed_cow_array_map (for copy-on-write arrays). In the latter case |
| 2160 // the elements array may be shared by a few objects and so before | 2160 // the elements array may be shared by a few objects and so before |
| 2161 // writing to any element the array must be copied. Use | 2161 // writing to any element the array must be copied. Use |
| 2162 // EnsureWritableFastElements in this case. | 2162 // EnsureWritableFastElements in this case. |
| 2163 // | 2163 // |
| 2164 // In the slow mode the elements is either a NumberDictionary, an | 2164 // In the slow mode the elements is either a NumberDictionary, an |
| 2165 // ExternalArray, or a FixedArray parameter map for a (non-strict) | 2165 // ExternalArray, or a FixedArray parameter map for a (sloppy) |
| 2166 // arguments object. | 2166 // arguments object. |
| 2167 DECL_ACCESSORS(elements, FixedArrayBase) | 2167 DECL_ACCESSORS(elements, FixedArrayBase) |
| 2168 inline void initialize_elements(); | 2168 inline void initialize_elements(); |
| 2169 MUST_USE_RESULT inline MaybeObject* ResetElements(); | 2169 MUST_USE_RESULT inline MaybeObject* ResetElements(); |
| 2170 inline ElementsKind GetElementsKind(); | 2170 inline ElementsKind GetElementsKind(); |
| 2171 inline ElementsAccessor* GetElementsAccessor(); | 2171 inline ElementsAccessor* GetElementsAccessor(); |
| 2172 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind. | 2172 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind. |
| 2173 inline bool HasFastSmiElements(); | 2173 inline bool HasFastSmiElements(); |
| 2174 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind. | 2174 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind. |
| 2175 inline bool HasFastObjectElements(); | 2175 inline bool HasFastObjectElements(); |
| 2176 // Returns true if an object has elements of FAST_ELEMENTS or | 2176 // Returns true if an object has elements of FAST_ELEMENTS or |
| 2177 // FAST_SMI_ONLY_ELEMENTS. | 2177 // FAST_SMI_ONLY_ELEMENTS. |
| 2178 inline bool HasFastSmiOrObjectElements(); | 2178 inline bool HasFastSmiOrObjectElements(); |
| 2179 // Returns true if an object has any of the fast elements kinds. | 2179 // Returns true if an object has any of the fast elements kinds. |
| 2180 inline bool HasFastElements(); | 2180 inline bool HasFastElements(); |
| 2181 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS | 2181 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS |
| 2182 // ElementsKind. | 2182 // ElementsKind. |
| 2183 inline bool HasFastDoubleElements(); | 2183 inline bool HasFastDoubleElements(); |
| 2184 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS | 2184 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS |
| 2185 // ElementsKind. | 2185 // ElementsKind. |
| 2186 inline bool HasFastHoleyElements(); | 2186 inline bool HasFastHoleyElements(); |
| 2187 inline bool HasNonStrictArgumentsElements(); | 2187 inline bool HasSloppyArgumentsElements(); |
| 2188 inline bool HasDictionaryElements(); | 2188 inline bool HasDictionaryElements(); |
| 2189 | 2189 |
| 2190 inline bool HasExternalUint8ClampedElements(); | 2190 inline bool HasExternalUint8ClampedElements(); |
| 2191 inline bool HasExternalArrayElements(); | 2191 inline bool HasExternalArrayElements(); |
| 2192 inline bool HasExternalInt8Elements(); | 2192 inline bool HasExternalInt8Elements(); |
| 2193 inline bool HasExternalUint8Elements(); | 2193 inline bool HasExternalUint8Elements(); |
| 2194 inline bool HasExternalInt16Elements(); | 2194 inline bool HasExternalInt16Elements(); |
| 2195 inline bool HasExternalUint16Elements(); | 2195 inline bool HasExternalUint16Elements(); |
| 2196 inline bool HasExternalInt32Elements(); | 2196 inline bool HasExternalInt32Elements(); |
| 2197 inline bool HasExternalUint32Elements(); | 2197 inline bool HasExternalUint32Elements(); |
| (...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4309 | 4309 |
| 4310 // Return the type of this scope. | 4310 // Return the type of this scope. |
| 4311 ScopeType scope_type(); | 4311 ScopeType scope_type(); |
| 4312 | 4312 |
| 4313 // Does this scope call eval? | 4313 // Does this scope call eval? |
| 4314 bool CallsEval(); | 4314 bool CallsEval(); |
| 4315 | 4315 |
| 4316 // Return the language mode of this scope. | 4316 // Return the language mode of this scope. |
| 4317 LanguageMode language_mode(); | 4317 LanguageMode language_mode(); |
| 4318 | 4318 |
| 4319 // Does this scope make a non-strict eval call? | 4319 // Does this scope make a sloppy eval call? |
| 4320 bool CallsNonStrictEval() { | 4320 bool CallsSloppyEval() { |
| 4321 return CallsEval() && (language_mode() == CLASSIC_MODE); | 4321 return CallsEval() && (language_mode() == SLOPPY_MODE); |
| 4322 } | 4322 } |
| 4323 | 4323 |
| 4324 // Return the total number of locals allocated on the stack and in the | 4324 // Return the total number of locals allocated on the stack and in the |
| 4325 // context. This includes the parameters that are allocated in the context. | 4325 // context. This includes the parameters that are allocated in the context. |
| 4326 int LocalCount(); | 4326 int LocalCount(); |
| 4327 | 4327 |
| 4328 // Return the number of stack slots for code. This number consists of two | 4328 // Return the number of stack slots for code. This number consists of two |
| 4329 // parts: | 4329 // parts: |
| 4330 // 1. One stack slot per stack allocated local. | 4330 // 1. One stack slot per stack allocated local. |
| 4331 // 2. One stack slot for the function name if it is stack allocated. | 4331 // 2. One stack slot for the function name if it is stack allocated. |
| (...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5898 } | 5898 } |
| 5899 | 5899 |
| 5900 inline bool has_fast_double_elements() { | 5900 inline bool has_fast_double_elements() { |
| 5901 return IsFastDoubleElementsKind(elements_kind()); | 5901 return IsFastDoubleElementsKind(elements_kind()); |
| 5902 } | 5902 } |
| 5903 | 5903 |
| 5904 inline bool has_fast_elements() { | 5904 inline bool has_fast_elements() { |
| 5905 return IsFastElementsKind(elements_kind()); | 5905 return IsFastElementsKind(elements_kind()); |
| 5906 } | 5906 } |
| 5907 | 5907 |
| 5908 inline bool has_non_strict_arguments_elements() { | 5908 inline bool has_sloppy_arguments_elements() { |
| 5909 return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; | 5909 return elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; |
| 5910 } | 5910 } |
| 5911 | 5911 |
| 5912 inline bool has_external_array_elements() { | 5912 inline bool has_external_array_elements() { |
| 5913 return IsExternalArrayElementsKind(elements_kind()); | 5913 return IsExternalArrayElementsKind(elements_kind()); |
| 5914 } | 5914 } |
| 5915 | 5915 |
| 5916 inline bool has_fixed_typed_array_elements() { | 5916 inline bool has_fixed_typed_array_elements() { |
| 5917 return IsFixedTypedArrayElementsKind(elements_kind()); | 5917 return IsFixedTypedArrayElementsKind(elements_kind()); |
| 5918 } | 5918 } |
| 5919 | 5919 |
| 5920 inline bool has_dictionary_elements() { | 5920 inline bool has_dictionary_elements() { |
| 5921 return IsDictionaryElementsKind(elements_kind()); | 5921 return IsDictionaryElementsKind(elements_kind()); |
| 5922 } | 5922 } |
| 5923 | 5923 |
| 5924 inline bool has_slow_elements_kind() { | 5924 inline bool has_slow_elements_kind() { |
| 5925 return elements_kind() == DICTIONARY_ELEMENTS | 5925 return elements_kind() == DICTIONARY_ELEMENTS |
| 5926 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; | 5926 || elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; |
| 5927 } | 5927 } |
| 5928 | 5928 |
| 5929 static bool IsValidElementsTransition(ElementsKind from_kind, | 5929 static bool IsValidElementsTransition(ElementsKind from_kind, |
| 5930 ElementsKind to_kind); | 5930 ElementsKind to_kind); |
| 5931 | 5931 |
| 5932 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a | 5932 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a |
| 5933 // map with DICTIONARY_ELEMENTS was found in the prototype chain. | 5933 // map with DICTIONARY_ELEMENTS was found in the prototype chain. |
| 5934 bool DictionaryElementsInPrototypeChainOnly(); | 5934 bool DictionaryElementsInPrototypeChainOnly(); |
| 5935 | 5935 |
| 5936 inline bool HasTransitionArray(); | 5936 inline bool HasTransitionArray(); |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6903 | 6903 |
| 6904 // Indicates whether optimizations have been disabled for this | 6904 // Indicates whether optimizations have been disabled for this |
| 6905 // shared function info. If a function is repeatedly optimized or if | 6905 // shared function info. If a function is repeatedly optimized or if |
| 6906 // we cannot optimize the function we disable optimization to avoid | 6906 // we cannot optimize the function we disable optimization to avoid |
| 6907 // spending time attempting to optimize it again. | 6907 // spending time attempting to optimize it again. |
| 6908 DECL_BOOLEAN_ACCESSORS(optimization_disabled) | 6908 DECL_BOOLEAN_ACCESSORS(optimization_disabled) |
| 6909 | 6909 |
| 6910 // Indicates the language mode of the function's code as defined by the | 6910 // Indicates the language mode of the function's code as defined by the |
| 6911 // current harmony drafts for the next ES language standard. Possible | 6911 // current harmony drafts for the next ES language standard. Possible |
| 6912 // values are: | 6912 // values are: |
| 6913 // 1. CLASSIC_MODE - Unrestricted syntax and semantics, same as in ES5. | 6913 // 1. SLOPPY_MODE - Unrestricted syntax and semantics, same as in ES5. |
| 6914 // 2. STRICT_MODE - Restricted syntax and semantics, same as in ES5. | 6914 // 2. STRICT_MODE - Restricted syntax and semantics, same as in ES5. |
| 6915 // 3. EXTENDED_MODE - Only available under the harmony flag, not part of ES5. | 6915 // 3. EXTENDED_MODE - Only available under the harmony flag, not part of ES5. |
| 6916 inline LanguageMode language_mode(); | 6916 inline LanguageMode language_mode(); |
| 6917 inline void set_language_mode(LanguageMode language_mode); | 6917 inline void set_language_mode(LanguageMode language_mode); |
| 6918 | 6918 |
| 6919 // Indicates whether the language mode of this function is CLASSIC_MODE. | 6919 // Indicates whether the language mode of this function is SLOPPY_MODE. |
| 6920 inline bool is_classic_mode(); | 6920 inline bool is_sloppy_mode(); |
| 6921 | 6921 |
| 6922 // Indicates whether the language mode of this function is EXTENDED_MODE. | 6922 // Indicates whether the language mode of this function is EXTENDED_MODE. |
| 6923 inline bool is_extended_mode(); | 6923 inline bool is_extended_mode(); |
| 6924 | 6924 |
| 6925 // False if the function definitely does not allocate an arguments object. | 6925 // False if the function definitely does not allocate an arguments object. |
| 6926 DECL_BOOLEAN_ACCESSORS(uses_arguments) | 6926 DECL_BOOLEAN_ACCESSORS(uses_arguments) |
| 6927 | 6927 |
| 6928 // True if the function has any duplicated parameter names. | 6928 // True if the function has any duplicated parameter names. |
| 6929 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) | 6929 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) |
| 6930 | 6930 |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8423 DECLARE_PRINTER(AllocationMemento) | 8423 DECLARE_PRINTER(AllocationMemento) |
| 8424 DECLARE_VERIFIER(AllocationMemento) | 8424 DECLARE_VERIFIER(AllocationMemento) |
| 8425 | 8425 |
| 8426 static inline AllocationMemento* cast(Object* obj); | 8426 static inline AllocationMemento* cast(Object* obj); |
| 8427 | 8427 |
| 8428 private: | 8428 private: |
| 8429 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento); | 8429 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento); |
| 8430 }; | 8430 }; |
| 8431 | 8431 |
| 8432 | 8432 |
| 8433 // Representation of a slow alias as part of a non-strict arguments objects. | 8433 // Representation of a slow alias as part of a sloppy arguments objects. |
| 8434 // For fast aliases (if HasNonStrictArgumentsElements()): | 8434 // For fast aliases (if HasSloppyArgumentsElements()): |
| 8435 // - the parameter map contains an index into the context | 8435 // - the parameter map contains an index into the context |
| 8436 // - all attributes of the element have default values | 8436 // - all attributes of the element have default values |
| 8437 // For slow aliases (if HasDictionaryArgumentsElements()): | 8437 // For slow aliases (if HasDictionaryArgumentsElements()): |
| 8438 // - the parameter map contains no fast alias mapping (i.e. the hole) | 8438 // - the parameter map contains no fast alias mapping (i.e. the hole) |
| 8439 // - this struct (in the slow backing store) contains an index into the context | 8439 // - this struct (in the slow backing store) contains an index into the context |
| 8440 // - all attributes are available as part if the property details | 8440 // - all attributes are available as part if the property details |
| 8441 class AliasedArgumentsEntry: public Struct { | 8441 class AliasedArgumentsEntry: public Struct { |
| 8442 public: | 8442 public: |
| 8443 inline int aliased_context_slot(); | 8443 inline int aliased_context_slot(); |
| 8444 inline void set_aliased_context_slot(int count); | 8444 inline void set_aliased_context_slot(int count); |
| (...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10773 } else { | 10773 } else { |
| 10774 value &= ~(1 << bit_position); | 10774 value &= ~(1 << bit_position); |
| 10775 } | 10775 } |
| 10776 return value; | 10776 return value; |
| 10777 } | 10777 } |
| 10778 }; | 10778 }; |
| 10779 | 10779 |
| 10780 } } // namespace v8::internal | 10780 } } // namespace v8::internal |
| 10781 | 10781 |
| 10782 #endif // V8_OBJECTS_H_ | 10782 #endif // V8_OBJECTS_H_ |
| OLD | NEW |