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

Side by Side Diff: src/objects.h

Issue 249883003: Dictionary::AtPut() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 Object* key, 4088 Object* key,
4089 Object* value, 4089 Object* value,
4090 PropertyDetails details); 4090 PropertyDetails details);
4091 4091
4092 MUST_USE_RESULT MaybeObject* Add(Key key, 4092 MUST_USE_RESULT MaybeObject* Add(Key key,
4093 Object* value, 4093 Object* value,
4094 PropertyDetails details); 4094 PropertyDetails details);
4095 4095
4096 protected: 4096 protected:
4097 // Generic at put operation. 4097 // Generic at put operation.
4098 MUST_USE_RESULT MaybeObject* AtPut(Key key, Object* value); 4098 MUST_USE_RESULT static Handle<Derived> AtPut(
4099 Handle<Derived> dictionary,
4100 Key key,
4101 Handle<Object> value);
4099 4102
4100 // Add entry to dictionary. 4103 // Add entry to dictionary.
4101 MUST_USE_RESULT MaybeObject* AddEntry(Key key, 4104 MUST_USE_RESULT MaybeObject* AddEntry(Key key,
4102 Object* value, 4105 Object* value,
4103 PropertyDetails details, 4106 PropertyDetails details,
4104 uint32_t hash); 4107 uint32_t hash);
4108 MUST_USE_RESULT static Handle<Derived> AddEntry(
4109 Handle<Derived> dictionary,
4110 Key key,
4111 Handle<Object> value,
4112 PropertyDetails details,
4113 uint32_t hash);
4105 4114
4106 // Generate new enumeration indices to avoid enumeration index overflow. 4115 // Generate new enumeration indices to avoid enumeration index overflow.
4107 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices(); 4116 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices();
4108 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex; 4117 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex;
4109 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; 4118 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
4110 }; 4119 };
4111 4120
4112 4121
4113 class NameDictionaryShape : public BaseShape<Name*> { 4122 class NameDictionaryShape : public BaseShape<Name*> {
4114 public: 4123 public:
4115 static inline bool IsMatch(Name* key, Object* other); 4124 static inline bool IsMatch(Name* key, Object* other);
4116 static inline uint32_t Hash(Name* key); 4125 static inline uint32_t Hash(Name* key);
4117 static inline uint32_t HashForObject(Name* key, Object* object); 4126 static inline uint32_t HashForObject(Name* key, Object* object);
4118 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, 4127 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
4119 Name* key); 4128 Name* key);
4129 static inline Handle<Object> AsHandle(Isolate* isolate, Name* key);
4120 static const int kPrefixSize = 2; 4130 static const int kPrefixSize = 2;
4121 static const int kEntrySize = 3; 4131 static const int kEntrySize = 3;
4122 static const bool kIsEnumerable = true; 4132 static const bool kIsEnumerable = true;
4123 }; 4133 };
4124 4134
4125 4135
4126 class NameDictionary: public Dictionary<NameDictionary, 4136 class NameDictionary: public Dictionary<NameDictionary,
4127 NameDictionaryShape, 4137 NameDictionaryShape,
4128 Name*> { 4138 Name*> {
4129 public: 4139 public:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 PropertyDetails details); 4214 PropertyDetails details);
4205 4215
4206 // Set an existing entry or add a new one if needed. 4216 // Set an existing entry or add a new one if needed.
4207 // Return the updated dictionary. 4217 // Return the updated dictionary.
4208 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( 4218 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set(
4209 Handle<SeededNumberDictionary> dictionary, 4219 Handle<SeededNumberDictionary> dictionary,
4210 uint32_t key, 4220 uint32_t key,
4211 Handle<Object> value, 4221 Handle<Object> value,
4212 PropertyDetails details); 4222 PropertyDetails details);
4213 4223
4214 MUST_USE_RESULT MaybeObject* Set(uint32_t key,
4215 Object* value,
4216 PropertyDetails details);
4217
4218 void UpdateMaxNumberKey(uint32_t key); 4224 void UpdateMaxNumberKey(uint32_t key);
4219 4225
4220 // If slow elements are required we will never go back to fast-case 4226 // If slow elements are required we will never go back to fast-case
4221 // for the elements kept in this dictionary. We require slow 4227 // for the elements kept in this dictionary. We require slow
4222 // elements if an element has been added at an index larger than 4228 // elements if an element has been added at an index larger than
4223 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called 4229 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called
4224 // when defining a getter or setter with a number key. 4230 // when defining a getter or setter with a number key.
4225 inline bool requires_slow_elements(); 4231 inline bool requires_slow_elements();
4226 inline void set_requires_slow_elements(); 4232 inline void set_requires_slow_elements();
4227 4233
(...skipping 7055 matching lines...) Expand 10 before | Expand all | Expand 10 after
11283 } else { 11289 } else {
11284 value &= ~(1 << bit_position); 11290 value &= ~(1 << bit_position);
11285 } 11291 }
11286 return value; 11292 return value;
11287 } 11293 }
11288 }; 11294 };
11289 11295
11290 } } // namespace v8::internal 11296 } } // namespace v8::internal
11291 11297
11292 #endif // V8_OBJECTS_H_ 11298 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698