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

Unified Diff: src/objects.h

Issue 7385006: Reintroduced dictionary that can use objects as keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review from Vitaly Repeshko. 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
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 13edfd78ba7bc46f569600fb2b2c7d8a841734cf..9cb7250819ee69ad34ba920012c64234209be652 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1638,6 +1638,11 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT inline MaybeObject* SetHiddenPropertiesObject(
Object* hidden_obj);
+ MUST_USE_RESULT MaybeObject* GetHiddenProperties(bool create_if_needed);
Vitaly Repeshko 2011/07/26 13:53:14 Document what is returned when there are no existi
Michael Starzinger 2011/07/26 22:30:23 Fixed.
+
+ // 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);
@@ -2913,6 +2918,37 @@ 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*> {
Vitaly Repeshko 2011/07/26 13:53:14 Needs a comment.
Michael Starzinger 2011/07/26 22:30:23 Fixed.
+ public:
+ static inline ObjectDictionary* cast(Object* obj) {
+ ASSERT(obj->IsDictionary());
+ return reinterpret_cast<ObjectDictionary*>(obj);
+ }
+
+ // Specialized version which checks whether objects have an identity hash.
+ int FindEntry(JSObject* key);
+ int FindEntry(Isolate* isolate, JSObject* key);
Vitaly Repeshko 2011/07/26 13:53:14 Doesn't seem to be defined/called. Remove?
Vitaly Repeshko 2011/07/27 15:42:26 Did you miss this one?
Michael Starzinger 2011/07/28 01:23:18 Fixed. Yep, missed that one.
+
+ // Specialized version which makes sure objects have an identity hash.
+ MUST_USE_RESULT MaybeObject* Add(JSObject* key, Object* value);
+ MUST_USE_RESULT MaybeObject* Add(JSObject* key,
Vitaly Repeshko 2011/07/26 13:53:14 Same here. Are PropertyDetails really required? I
Michael Starzinger 2011/07/26 22:30:23 In that case the ObjectDictionary should use HashT
Vitaly Repeshko 2011/07/27 15:42:26 Yes, Dictionaries are used for storing properties
Michael Starzinger 2011/07/28 01:23:18 Fixed. Required a lot of other changes, but it bec
+ Object* value,
+ PropertyDetails details);
+};
+
+
// JSFunctionResultCache caches results of some JSFunction invocation.
// It is a fixed array with fixed structure:
// [0]: factory function

Powered by Google App Engine
This is Rietveld 408576698