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

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 merge 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
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index ce7f7853bb7364882e7f02fdf49d3daca477b936..a973f12663683f16b2befb784f89fef84fc6facc 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1223,6 +1223,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.
@@ -3434,6 +3439,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.
@@ -3940,16 +3946,24 @@ 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);
+ Object* Lookup(Isolate* isolate, 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);
protected:
friend class MarkCompactCollector;
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698