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

Unified Diff: src/objects.h

Issue 1149863005: Move hash code from hidden string to a private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix global object hash code. This eated about 5% of weak collection performance Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 9aec541d7e04b901cb0822e0dc872ed5d0012170..bea478fd300ae846d4191b942c29f700a0a3a0eb 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1220,6 +1220,11 @@ class Object {
// undefined if not yet created.
Object* GetHash();
+ // Returns undefined for JSObjects, but returns the hash code for simple
+ // objects. This avoids a double lookup in the cases where we know we will
+ // add the hash to the JSObject if it does not already exist.
+ Object* GetSimpleHash();
+
// Returns the permanent hash code associated with this object depending on
// the actual object type. May create and store a hash code if needed and none
// exists.
@@ -3436,6 +3441,7 @@ class HashTable : public HashTableBase {
// Find entry for key otherwise return kNotFound.
inline int FindEntry(Key key);
+ inline int FindEntry(Isolate* isolate, Key key, int32_t hash);
int FindEntry(Isolate* isolate, Key key);
// Rehashes the table in-place.
@@ -3942,16 +3948,23 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
// Looks up the value associated with the given key. The hole value is
// returned in case the key is not present.
Object* Lookup(Handle<Object> key);
+ Object* Lookup(Handle<Object> key, int32_t hash);
// Adds (or overwrites) the value associated with the given key.
static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table,
Handle<Object> key,
Handle<Object> value);
+ static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table,
+ Handle<Object> key, Handle<Object> value,
+ int32_t hash);
// Returns an ObjectHashTable (possibly |table|) where |key| has been removed.
static Handle<ObjectHashTable> Remove(Handle<ObjectHashTable> table,
Handle<Object> key,
bool* was_present);
+ static Handle<ObjectHashTable> Remove(Handle<ObjectHashTable> table,
+ Handle<Object> key, bool* was_present,
+ int32_t hash);
private:
friend class MarkCompactCollector;

Powered by Google App Engine
This is Rietveld 408576698