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

Unified Diff: src/objects.h

Issue 7349005: Added dictionary that can use objects as keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added unit test to gyp buildfile as well. Created 9 years, 5 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/handles.cc ('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 9765fe2a0ab242f897145ea7d763ea21a8616b27..a7b591c6d493e891de29cd1b0984236e2832c12c 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1640,6 +1640,11 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT inline MaybeObject* SetHiddenPropertiesObject(
Object* hidden_obj);
+ MUST_USE_RESULT MaybeObject* GetHiddenProperties(bool create_if_needed);
+
+ // Retrieves a permanent object identity hash code.
+ MUST_USE_RESULT MaybeObject* GetIdentityHash();
+
MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode);
MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode);
@@ -2921,6 +2926,29 @@ class NumberDictionary: public Dictionary<NumberDictionaryShape, uint32_t> {
};
+class ObjectDictionaryShape {
+ public:
+ static inline bool IsMatch(JSObject* key, Object* other);
+ static inline uint32_t Hash(JSObject* key);
+ static inline uint32_t HashForObject(JSObject* key, Object* object);
+ MUST_USE_RESULT static inline MaybeObject* AsObject(JSObject* key);
+ static const int kPrefixSize = 2;
+ static const int kEntrySize = 3;
+ static const bool kIsEnumerable = false;
+};
+
+
+class ObjectDictionary: public Dictionary<ObjectDictionaryShape, JSObject*> {
+ public:
+ static inline ObjectDictionary* cast(Object* obj) {
+ ASSERT(obj->IsDictionary());
+ return reinterpret_cast<ObjectDictionary*>(obj);
+ }
+
+ MUST_USE_RESULT MaybeObject* AddChecked(JSObject* key, Object* value);
+};
+
+
// JSFunctionResultCache caches results of some JSFunction invocation.
// It is a fixed array with fixed structure:
// [0]: factory function
« no previous file with comments | « src/handles.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698