Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: src/objects.h

Issue 1198343004: Merge AddFastElement and AddFastDoubleElement (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/lookup-inl.h ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 } else if (FLAG_track_computed_fields && IsUninitialized()) { 1107 } else if (FLAG_track_computed_fields && IsUninitialized()) {
1108 return Representation::None(); 1108 return Representation::None();
1109 } else if (FLAG_track_heap_object_fields) { 1109 } else if (FLAG_track_heap_object_fields) {
1110 DCHECK(IsHeapObject()); 1110 DCHECK(IsHeapObject());
1111 return Representation::HeapObject(); 1111 return Representation::HeapObject();
1112 } else { 1112 } else {
1113 return Representation::Tagged(); 1113 return Representation::Tagged();
1114 } 1114 }
1115 } 1115 }
1116 1116
1117 inline ElementsKind OptimalElementsKind() {
1118 if (IsSmi()) return FAST_SMI_ELEMENTS;
1119 if (IsNumber()) return FAST_DOUBLE_ELEMENTS;
1120 return FAST_ELEMENTS;
1121 }
1122
1117 inline bool FitsRepresentation(Representation representation) { 1123 inline bool FitsRepresentation(Representation representation) {
1118 if (FLAG_track_fields && representation.IsNone()) { 1124 if (FLAG_track_fields && representation.IsNone()) {
1119 return false; 1125 return false;
1120 } else if (FLAG_track_fields && representation.IsSmi()) { 1126 } else if (FLAG_track_fields && representation.IsSmi()) {
1121 return IsSmi(); 1127 return IsSmi();
1122 } else if (FLAG_track_double_fields && representation.IsDouble()) { 1128 } else if (FLAG_track_double_fields && representation.IsDouble()) {
1123 return IsMutableHeapNumber() || IsNumber(); 1129 return IsMutableHeapNumber() || IsNumber();
1124 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 1130 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
1125 return IsHeapObject(); 1131 return IsHeapObject();
1126 } 1132 }
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 // In the slow mode the elements is either a NumberDictionary, an 1776 // In the slow mode the elements is either a NumberDictionary, an
1771 // ExternalArray, or a FixedArray parameter map for a (sloppy) 1777 // ExternalArray, or a FixedArray parameter map for a (sloppy)
1772 // arguments object. 1778 // arguments object.
1773 DECL_ACCESSORS(elements, FixedArrayBase) 1779 DECL_ACCESSORS(elements, FixedArrayBase)
1774 inline void initialize_elements(); 1780 inline void initialize_elements();
1775 static void ResetElements(Handle<JSObject> object); 1781 static void ResetElements(Handle<JSObject> object);
1776 static inline void SetMapAndElements(Handle<JSObject> object, 1782 static inline void SetMapAndElements(Handle<JSObject> object,
1777 Handle<Map> map, 1783 Handle<Map> map,
1778 Handle<FixedArrayBase> elements); 1784 Handle<FixedArrayBase> elements);
1779 inline ElementsKind GetElementsKind(); 1785 inline ElementsKind GetElementsKind();
1780 inline ElementsAccessor* GetElementsAccessor(); 1786 ElementsAccessor* GetElementsAccessor();
1781 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind. 1787 // Returns true if an object has elements of FAST_SMI_ELEMENTS ElementsKind.
1782 inline bool HasFastSmiElements(); 1788 inline bool HasFastSmiElements();
1783 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind. 1789 // Returns true if an object has elements of FAST_ELEMENTS ElementsKind.
1784 inline bool HasFastObjectElements(); 1790 inline bool HasFastObjectElements();
1785 // Returns true if an object has elements of FAST_ELEMENTS or 1791 // Returns true if an object has elements of FAST_ELEMENTS or
1786 // FAST_SMI_ONLY_ELEMENTS. 1792 // FAST_SMI_ONLY_ELEMENTS.
1787 inline bool HasFastSmiOrObjectElements(); 1793 inline bool HasFastSmiOrObjectElements();
1788 // Returns true if an object has any of the fast elements kinds. 1794 // Returns true if an object has any of the fast elements kinds.
1789 inline bool HasFastElements(); 1795 inline bool HasFastElements();
1790 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS 1796 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 static bool TryMigrateInstance(Handle<JSObject> instance); 1899 static bool TryMigrateInstance(Handle<JSObject> instance);
1894 1900
1895 // Sets the property value in a normalized object given (key, value, details). 1901 // Sets the property value in a normalized object given (key, value, details).
1896 // Handles the special representation of JS global objects. 1902 // Handles the special representation of JS global objects.
1897 static void SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name, 1903 static void SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name,
1898 Handle<Object> value, 1904 Handle<Object> value,
1899 PropertyDetails details); 1905 PropertyDetails details);
1900 static void AddDictionaryElement(Handle<JSObject> object, uint32_t index, 1906 static void AddDictionaryElement(Handle<JSObject> object, uint32_t index,
1901 Handle<Object> value, 1907 Handle<Object> value,
1902 PropertyAttributes attributes); 1908 PropertyAttributes attributes);
1903 static void AddSloppyArgumentsElement(Handle<JSObject> object, uint32_t index,
1904 Handle<Object> value,
1905 PropertyAttributes attributes);
1906 static void SetDictionaryElement(Handle<JSObject> object, uint32_t index, 1909 static void SetDictionaryElement(Handle<JSObject> object, uint32_t index,
1907 Handle<Object> value, 1910 Handle<Object> value,
1908 PropertyAttributes attributes); 1911 PropertyAttributes attributes);
1909 static void SetDictionaryArgumentsElement(Handle<JSObject> object, 1912 static void SetDictionaryArgumentsElement(Handle<JSObject> object,
1910 uint32_t index, 1913 uint32_t index,
1911 Handle<Object> value, 1914 Handle<Object> value,
1912 PropertyAttributes attributes); 1915 PropertyAttributes attributes);
1913 1916
1914 static void AddFastElement(Handle<JSObject> object, uint32_t index,
1915 Handle<Object> value);
1916 static void AddFastDoubleElement(Handle<JSObject> object, uint32_t index,
1917 Handle<Object> value);
1918
1919 static void OptimizeAsPrototype(Handle<JSObject> object, 1917 static void OptimizeAsPrototype(Handle<JSObject> object,
1920 PrototypeOptimizationMode mode); 1918 PrototypeOptimizationMode mode);
1921 static void ReoptimizeIfPrototype(Handle<JSObject> object); 1919 static void ReoptimizeIfPrototype(Handle<JSObject> object);
1922 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate); 1920 static void LazyRegisterPrototypeUser(Handle<Map> user, Isolate* isolate);
1923 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype, 1921 static bool RegisterPrototypeUserIfNotRegistered(Handle<JSObject> prototype,
1924 Handle<HeapObject> user, 1922 Handle<HeapObject> user,
1925 Isolate* isolate); 1923 Isolate* isolate);
1926 static bool UnregisterPrototypeUser(Handle<JSObject> prototype, 1924 static bool UnregisterPrototypeUser(Handle<JSObject> prototype,
1927 Handle<HeapObject> user); 1925 Handle<HeapObject> user);
1928 static void InvalidatePrototypeChains(Map* map); 1926 static void InvalidatePrototypeChains(Map* map);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 Object* GetHiddenProperty(Handle<Name> key); 1981 Object* GetHiddenProperty(Handle<Name> key);
1984 // Deletes a hidden property. Deleting a non-existing property is 1982 // Deletes a hidden property. Deleting a non-existing property is
1985 // considered successful. 1983 // considered successful.
1986 static void DeleteHiddenProperty(Handle<JSObject> object, 1984 static void DeleteHiddenProperty(Handle<JSObject> object,
1987 Handle<Name> key); 1985 Handle<Name> key);
1988 // Returns true if the object has a property with the hidden string as name. 1986 // Returns true if the object has a property with the hidden string as name.
1989 static bool HasHiddenProperties(Handle<JSObject> object); 1987 static bool HasHiddenProperties(Handle<JSObject> object);
1990 1988
1991 static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash); 1989 static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash);
1992 1990
1993 static inline void ValidateElements(Handle<JSObject> object); 1991 static void ValidateElements(Handle<JSObject> object);
1994 1992
1995 // Makes sure that this object can contain HeapObject as elements. 1993 // Makes sure that this object can contain HeapObject as elements.
1996 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); 1994 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj);
1997 1995
1998 // Makes sure that this object can contain the specified elements. 1996 // Makes sure that this object can contain the specified elements.
1999 static inline void EnsureCanContainElements( 1997 static inline void EnsureCanContainElements(
2000 Handle<JSObject> object, 1998 Handle<JSObject> object,
2001 Object** elements, 1999 Object** elements,
2002 uint32_t count, 2000 uint32_t count,
2003 EnsureElementsMode mode); 2001 EnsureElementsMode mode);
(...skipping 8820 matching lines...) Expand 10 before | Expand all | Expand 10 after
10824 } else { 10822 } else {
10825 value &= ~(1 << bit_position); 10823 value &= ~(1 << bit_position);
10826 } 10824 }
10827 return value; 10825 return value;
10828 } 10826 }
10829 }; 10827 };
10830 10828
10831 } } // namespace v8::internal 10829 } } // namespace v8::internal
10832 10830
10833 #endif // V8_OBJECTS_H_ 10831 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/lookup-inl.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698