| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index 2f92d70b3fb649d973597b927bb012f684f8bad4..25811d16af7c621b99e417d7cc5e1c4b9960ad36 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -3036,9 +3036,16 @@ class StringDictionary: public Dictionary<StringDictionaryShape, String*> {
|
| };
|
|
|
|
|
| +enum NumberDictionaryKind {
|
| + kNotSeeded = 0,
|
| + kSeeded
|
| +};
|
| +
|
| +
|
| +template <NumberDictionaryKind kind>
|
| class NumberDictionaryShape : public BaseShape<uint32_t> {
|
| public:
|
| - static const bool UsesSeed = true;
|
| + static const bool UsesSeed = kind;
|
|
|
| static inline bool IsMatch(uint32_t key, Object* other);
|
| static inline uint32_t Hash(uint32_t key);
|
| @@ -3054,26 +3061,14 @@ class NumberDictionaryShape : public BaseShape<uint32_t> {
|
| };
|
|
|
|
|
| -class NumberDictionary: public Dictionary<NumberDictionaryShape, uint32_t> {
|
| +class NumberDictionaryBase {
|
| public:
|
| - static NumberDictionary* cast(Object* obj) {
|
| - ASSERT(obj->IsDictionary());
|
| - return reinterpret_cast<NumberDictionary*>(obj);
|
| - }
|
| -
|
| // Type specific at put (default NONE attributes is used when adding).
|
| MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
|
| MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key,
|
| Object* value,
|
| PropertyDetails details);
|
|
|
| - // Set an existing entry or add a new one if needed.
|
| - // Return the updated dictionary.
|
| - MUST_USE_RESULT static Handle<NumberDictionary> Set(
|
| - Handle<NumberDictionary> dictionary,
|
| - uint32_t index,
|
| - Handle<Object> value,
|
| - PropertyDetails details);
|
|
|
| MUST_USE_RESULT MaybeObject* Set(uint32_t key,
|
| Object* value,
|
| @@ -3094,10 +3089,69 @@ class NumberDictionary: public Dictionary<NumberDictionaryShape, uint32_t> {
|
| // requires_slow_elements returns false.
|
| inline uint32_t max_number_key();
|
|
|
| + protected:
|
| // Bit masks.
|
| static const int kRequiresSlowElementsMask = 1;
|
| static const int kRequiresSlowElementsTagSize = 1;
|
| static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1;
|
| +
|
| + private:
|
| + // Internal function for easier conversion
|
| + inline NumberDictionary* as_dict() {
|
| + return reinterpret_cast<NumberDictionary*>(this);
|
| + }
|
| +};
|
| +
|
| +
|
| +class NumberDictionary :
|
| + public Dictionary<NumberDictionaryShape<kSeeded>, uint32_t>,
|
| + public NumberDictionaryBase {
|
| + public:
|
| + static NumberDictionary* cast(Object* obj) {
|
| + ASSERT(obj->IsDictionary());
|
| + return reinterpret_cast<NumberDictionary*>(obj);
|
| + }
|
| +
|
| + MUST_USE_RESULT MaybeObject* Set(uint32_t key,
|
| + Object* value,
|
| + PropertyDetails details) {
|
| + return NumberDictionaryBase::Set(key, value, details);
|
| + }
|
| +
|
| + // Set an existing entry or add a new one if needed.
|
| + // Return the updated dictionary.
|
| + MUST_USE_RESULT static Handle<NumberDictionary> Set(
|
| + Handle<NumberDictionary> dictionary,
|
| + uint32_t index,
|
| + Handle<Object> value,
|
| + PropertyDetails details);
|
| +
|
| + friend class NumberDictionaryBase;
|
| +};
|
| +
|
| +
|
| +class NotSeededNumberDictionary :
|
| + public Dictionary<NumberDictionaryShape<kNotSeeded>, uint32_t>,
|
| + public NumberDictionaryBase {
|
| + public:
|
| + static NotSeededNumberDictionary* cast(Object* obj) {
|
| + ASSERT(obj->IsDictionary());
|
| + return reinterpret_cast<NotSeededNumberDictionary*>(obj);
|
| + }
|
| +
|
| + MUST_USE_RESULT MaybeObject* Set(uint32_t key,
|
| + Object* value,
|
| + PropertyDetails details) {
|
| + return NumberDictionaryBase::Set(key, value, details);
|
| + }
|
| +
|
| + // Set an existing entry or add a new one if needed.
|
| + // Return the updated dictionary.
|
| + MUST_USE_RESULT static Handle<NotSeededNumberDictionary> Set(
|
| + Handle<NotSeededNumberDictionary> dictionary,
|
| + uint32_t index,
|
| + Handle<Object> value,
|
| + PropertyDetails details);
|
| };
|
|
|
|
|
|
|