| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 | 1939 |
| 1940 // Maximal number of fast properties for the JSObject. Used to | 1940 // Maximal number of fast properties for the JSObject. Used to |
| 1941 // restrict the number of map transitions to avoid an explosion in | 1941 // restrict the number of map transitions to avoid an explosion in |
| 1942 // the number of maps for objects used as dictionaries. | 1942 // the number of maps for objects used as dictionaries. |
| 1943 inline int MaxFastProperties(); | 1943 inline int MaxFastProperties(); |
| 1944 | 1944 |
| 1945 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 1945 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
| 1946 // Also maximal value of JSArray's length property. | 1946 // Also maximal value of JSArray's length property. |
| 1947 static const uint32_t kMaxElementCount = 0xffffffffu; | 1947 static const uint32_t kMaxElementCount = 0xffffffffu; |
| 1948 | 1948 |
| 1949 // Constants for heuristics controlling conversion of fast elements |
| 1950 // to slow elements. |
| 1951 |
| 1952 // Maximal gap that can be introduced by adding an element beyond |
| 1953 // the current elements length. |
| 1949 static const uint32_t kMaxGap = 1024; | 1954 static const uint32_t kMaxGap = 1024; |
| 1950 static const int kMaxFastElementsLength = 5000; | 1955 |
| 1956 // Maximal length of fast elements array that won't be checked for |
| 1957 // being dense enough on expansion. |
| 1958 static const int kMaxUncheckedFastElementsLength = 5000; |
| 1959 |
| 1960 // Same as above but for old arrays. This limit is more strict. We |
| 1961 // don't want to be wasteful with long lived objects. |
| 1962 static const int kMaxUncheckedOldFastElementsLength = 500; |
| 1963 |
| 1951 static const int kInitialMaxFastElementArray = 100000; | 1964 static const int kInitialMaxFastElementArray = 100000; |
| 1952 static const int kMaxFastProperties = 12; | 1965 static const int kMaxFastProperties = 12; |
| 1953 static const int kMaxInstanceSize = 255 * kPointerSize; | 1966 static const int kMaxInstanceSize = 255 * kPointerSize; |
| 1954 // When extending the backing storage for property values, we increase | 1967 // When extending the backing storage for property values, we increase |
| 1955 // its size by more than the 1 entry necessary, so sequentially adding fields | 1968 // its size by more than the 1 entry necessary, so sequentially adding fields |
| 1956 // to the same object requires fewer allocations and copies. | 1969 // to the same object requires fewer allocations and copies. |
| 1957 static const int kFieldsAdded = 3; | 1970 static const int kFieldsAdded = 3; |
| 1958 | 1971 |
| 1959 // Layout description. | 1972 // Layout description. |
| 1960 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 1973 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 bool ReferencesObjectFromElements(FixedArray* elements, | 2019 bool ReferencesObjectFromElements(FixedArray* elements, |
| 2007 ElementsKind kind, | 2020 ElementsKind kind, |
| 2008 Object* object); | 2021 Object* object); |
| 2009 bool HasElementInElements(FixedArray* elements, | 2022 bool HasElementInElements(FixedArray* elements, |
| 2010 ElementsKind kind, | 2023 ElementsKind kind, |
| 2011 uint32_t index); | 2024 uint32_t index); |
| 2012 | 2025 |
| 2013 // Returns true if most of the elements backing storage is used. | 2026 // Returns true if most of the elements backing storage is used. |
| 2014 bool HasDenseElements(); | 2027 bool HasDenseElements(); |
| 2015 | 2028 |
| 2029 // Gets the current elements capacity and the number of used elements. |
| 2030 void GetElementsCapacityAndUsage(int* capacity, int* used); |
| 2031 |
| 2016 bool CanSetCallback(String* name); | 2032 bool CanSetCallback(String* name); |
| 2017 MUST_USE_RESULT MaybeObject* SetElementCallback( | 2033 MUST_USE_RESULT MaybeObject* SetElementCallback( |
| 2018 uint32_t index, | 2034 uint32_t index, |
| 2019 Object* structure, | 2035 Object* structure, |
| 2020 PropertyAttributes attributes); | 2036 PropertyAttributes attributes); |
| 2021 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 2037 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
| 2022 String* name, | 2038 String* name, |
| 2023 Object* structure, | 2039 Object* structure, |
| 2024 PropertyAttributes attributes); | 2040 PropertyAttributes attributes); |
| 2025 MUST_USE_RESULT MaybeObject* DefineGetterSetter( | 2041 MUST_USE_RESULT MaybeObject* DefineGetterSetter( |
| (...skipping 5148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7174 } else { | 7190 } else { |
| 7175 value &= ~(1 << bit_position); | 7191 value &= ~(1 << bit_position); |
| 7176 } | 7192 } |
| 7177 return value; | 7193 return value; |
| 7178 } | 7194 } |
| 7179 }; | 7195 }; |
| 7180 | 7196 |
| 7181 } } // namespace v8::internal | 7197 } } // namespace v8::internal |
| 7182 | 7198 |
| 7183 #endif // V8_OBJECTS_H_ | 7199 #endif // V8_OBJECTS_H_ |
| OLD | NEW |