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

Side by Side Diff: src/objects.h

Issue 10827040: Limit initial size of hidden properties and store identity hashes inline. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix comments in test cases Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
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 // 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 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 // otherwise returns the value set for the key. 1724 // otherwise returns the value set for the key.
1725 Object* GetHiddenProperty(String* key); 1725 Object* GetHiddenProperty(String* key);
1726 // Deletes a hidden property. Deleting a non-existing property is 1726 // Deletes a hidden property. Deleting a non-existing property is
1727 // considered successful. 1727 // considered successful.
1728 void DeleteHiddenProperty(String* key); 1728 void DeleteHiddenProperty(String* key);
1729 // Returns true if the object has a property with the hidden symbol as name. 1729 // Returns true if the object has a property with the hidden symbol as name.
1730 bool HasHiddenProperties(); 1730 bool HasHiddenProperties();
1731 1731
1732 static int GetIdentityHash(Handle<JSObject> obj); 1732 static int GetIdentityHash(Handle<JSObject> obj);
1733 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); 1733 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
1734 MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag); 1734 MUST_USE_RESULT MaybeObject* SetIdentityHash(Smi* hash, CreationFlag flag);
1735 1735
1736 static Handle<Object> DeleteProperty(Handle<JSObject> obj, 1736 static Handle<Object> DeleteProperty(Handle<JSObject> obj,
1737 Handle<String> name); 1737 Handle<String> name);
1738 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); 1738 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode);
1739 1739
1740 static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index); 1740 static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index);
1741 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); 1741 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode);
1742 1742
1743 inline void ValidateElements(); 1743 inline void ValidateElements();
1744 1744
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 Object* getter, 2228 Object* getter,
2229 Object* setter, 2229 Object* setter,
2230 PropertyAttributes attributes); 2230 PropertyAttributes attributes);
2231 MUST_USE_RESULT MaybeObject* CreateAccessorPairFor(String* name); 2231 MUST_USE_RESULT MaybeObject* CreateAccessorPairFor(String* name);
2232 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( 2232 MUST_USE_RESULT MaybeObject* DefinePropertyAccessor(
2233 String* name, 2233 String* name,
2234 Object* getter, 2234 Object* getter,
2235 Object* setter, 2235 Object* setter,
2236 PropertyAttributes attributes); 2236 PropertyAttributes attributes);
2237 2237
2238 // Returns the hidden properties backing store object, currently 2238 // If create_if_absent is true, return the hash table backing store
2239 // a StringDictionary, stored on this object. 2239 // for hidden properties. If there is no backing store, allocate one.
2240 // If no hidden properties object has been put on this object, 2240 // If create_if_absent is false, return the hash table backing store
2241 // return undefined, unless create_if_absent is true, in which case 2241 // or the inline stored identity hash, whatever is found.
2242 // a new dictionary is created, added to this object, and returned. 2242 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesHashTable(
2243 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary(
2244 bool create_if_absent); 2243 bool create_if_absent);
2245 // Updates the existing hidden properties dictionary. 2244 // Set the hidden property backing store to either a hash table or
2246 MUST_USE_RESULT MaybeObject* SetHiddenPropertiesDictionary( 2245 // the inline-stored identity hash.
2247 StringDictionary* dictionary); 2246 MUST_USE_RESULT MaybeObject* SetHiddenPropertiesHashTable(
2247 Object* hidden);
2248 2248
2249 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); 2249 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
2250 }; 2250 };
2251 2251
2252 2252
2253 // Common superclass for FixedArrays that allow implementations to share 2253 // Common superclass for FixedArrays that allow implementations to share
2254 // common accessors and some code paths. 2254 // common accessors and some code paths.
2255 class FixedArrayBase: public HeapObject { 2255 class FixedArrayBase: public HeapObject {
2256 public: 2256 public:
2257 // [length]: length of the array. 2257 // [length]: length of the array.
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 SetNumberOfDeletedElements(NumberOfDeletedElements() + 1); 2792 SetNumberOfDeletedElements(NumberOfDeletedElements() + 1);
2793 } 2793 }
2794 void ElementsRemoved(int n) { 2794 void ElementsRemoved(int n) {
2795 SetNumberOfElements(NumberOfElements() - n); 2795 SetNumberOfElements(NumberOfElements() - n);
2796 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); 2796 SetNumberOfDeletedElements(NumberOfDeletedElements() + n);
2797 } 2797 }
2798 2798
2799 // Returns a new HashTable object. Might return Failure. 2799 // Returns a new HashTable object. Might return Failure.
2800 MUST_USE_RESULT static MaybeObject* Allocate( 2800 MUST_USE_RESULT static MaybeObject* Allocate(
2801 int at_least_space_for, 2801 int at_least_space_for,
2802 bool force_capacity = false,
Toon Verwaest 2012/07/30 09:13:24 Can this be an enum?
2802 PretenureFlag pretenure = NOT_TENURED); 2803 PretenureFlag pretenure = NOT_TENURED);
2803 2804
2804 // Computes the required capacity for a table holding the given 2805 // Computes the required capacity for a table holding the given
2805 // number of elements. May be more than HashTable::kMaxCapacity. 2806 // number of elements. May be more than HashTable::kMaxCapacity.
2806 static int ComputeCapacity(int at_least_space_for); 2807 static int ComputeCapacity(int at_least_space_for);
2807 2808
2808 // Returns the key at entry. 2809 // Returns the key at entry.
2809 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); } 2810 Object* KeyAt(int entry) { return get(EntryToIndex(entry)); }
2810 2811
2811 // Tells whether k is a real key. The hole and undefined are not allowed 2812 // Tells whether k is a real key. The hole and undefined are not allowed
(...skipping 6098 matching lines...) Expand 10 before | Expand all | Expand 10 after
8910 } else { 8911 } else {
8911 value &= ~(1 << bit_position); 8912 value &= ~(1 << bit_position);
8912 } 8913 }
8913 return value; 8914 return value;
8914 } 8915 }
8915 }; 8916 };
8916 8917
8917 } } // namespace v8::internal 8918 } } // namespace v8::internal
8918 8919
8919 #endif // V8_OBJECTS_H_ 8920 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698