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

Side by Side Diff: src/objects.h

Issue 250013002: Dictionary::GenerateNewEnumerationIndices() and Dictionary::EnsureCapacity() 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') | no next file with comments »
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 4052 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 int at_least_space_for, 4063 int at_least_space_for,
4064 PretenureFlag pretenure = NOT_TENURED); 4064 PretenureFlag pretenure = NOT_TENURED);
4065 4065
4066 // Creates a new dictionary. 4066 // Creates a new dictionary.
4067 MUST_USE_RESULT static Handle<Derived> New( 4067 MUST_USE_RESULT static Handle<Derived> New(
4068 Isolate* isolate, 4068 Isolate* isolate,
4069 int at_least_space_for, 4069 int at_least_space_for,
4070 PretenureFlag pretenure = NOT_TENURED); 4070 PretenureFlag pretenure = NOT_TENURED);
4071 4071
4072 // Ensure enough space for n additional elements. 4072 // Ensure enough space for n additional elements.
4073 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key);
4074
4075 static Handle<Derived> EnsureCapacity(Handle<Derived> obj, int n, Key key); 4073 static Handle<Derived> EnsureCapacity(Handle<Derived> obj, int n, Key key);
4076 4074
4077 #ifdef OBJECT_PRINT 4075 #ifdef OBJECT_PRINT
4078 void Print(FILE* out = stdout); 4076 void Print(FILE* out = stdout);
4079 #endif 4077 #endif
4080 // Returns the key (slow). 4078 // Returns the key (slow).
4081 Object* SlowReverseLookup(Object* value); 4079 Object* SlowReverseLookup(Object* value);
4082 4080
4083 // Sets the entry to (key, value) pair. 4081 // Sets the entry to (key, value) pair.
4084 inline void SetEntry(int entry, 4082 inline void SetEntry(int entry,
(...skipping 23 matching lines...) Expand all
4108 PropertyDetails details, 4106 PropertyDetails details,
4109 uint32_t hash); 4107 uint32_t hash);
4110 MUST_USE_RESULT static Handle<Derived> AddEntry( 4108 MUST_USE_RESULT static Handle<Derived> AddEntry(
4111 Handle<Derived> dictionary, 4109 Handle<Derived> dictionary,
4112 Key key, 4110 Key key,
4113 Handle<Object> value, 4111 Handle<Object> value,
4114 PropertyDetails details, 4112 PropertyDetails details,
4115 uint32_t hash); 4113 uint32_t hash);
4116 4114
4117 // Generate new enumeration indices to avoid enumeration index overflow. 4115 // Generate new enumeration indices to avoid enumeration index overflow.
4118 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices(); 4116 static void GenerateNewEnumerationIndices(Handle<Derived> dictionary);
4119 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex; 4117 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex;
4120 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; 4118 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
4121 }; 4119 };
4122 4120
4123 4121
4124 class NameDictionaryShape : public BaseShape<Name*> { 4122 class NameDictionaryShape : public BaseShape<Name*> {
4125 public: 4123 public:
4126 static inline bool IsMatch(Name* key, Object* other); 4124 static inline bool IsMatch(Name* key, Object* other);
4127 static inline uint32_t Hash(Name* key); 4125 static inline uint32_t Hash(Name* key);
4128 static inline uint32_t HashForObject(Name* key, Object* object); 4126 static inline uint32_t HashForObject(Name* key, Object* object);
4129 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, 4127 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
4130 Name* key); 4128 Name* key);
4131 static inline Handle<Object> AsHandle(Isolate* isolate, Name* key); 4129 static inline Handle<Object> AsHandle(Isolate* isolate, Name* key);
4132 static const int kPrefixSize = 2; 4130 static const int kPrefixSize = 2;
4133 static const int kEntrySize = 3; 4131 static const int kEntrySize = 3;
4134 static const bool kIsEnumerable = true; 4132 static const bool kIsEnumerable = true;
4135 }; 4133 };
4136 4134
4137 4135
4138 class NameDictionary: public Dictionary<NameDictionary, 4136 class NameDictionary: public Dictionary<NameDictionary,
4139 NameDictionaryShape, 4137 NameDictionaryShape,
4140 Name*> { 4138 Name*> {
4139 typedef Dictionary<
4140 NameDictionary, NameDictionaryShape, Name*> DerivedDictionary;
4141 public: 4141 public:
4142 static inline NameDictionary* cast(Object* obj) { 4142 static inline NameDictionary* cast(Object* obj) {
4143 ASSERT(obj->IsDictionary()); 4143 ASSERT(obj->IsDictionary());
4144 return reinterpret_cast<NameDictionary*>(obj); 4144 return reinterpret_cast<NameDictionary*>(obj);
4145 } 4145 }
4146 4146
4147 // Copies enumerable keys to preallocated fixed array. 4147 // Copies enumerable keys to preallocated fixed array.
4148 void CopyEnumKeysTo(FixedArray* storage); 4148 void CopyEnumKeysTo(FixedArray* storage);
4149 static void DoGenerateNewEnumerationIndices( 4149 inline static void DoGenerateNewEnumerationIndices(
4150 Handle<NameDictionary> dictionary); 4150 Handle<NameDictionary> dictionary);
4151 4151
4152 // Find entry for key, otherwise return kNotFound. Optimized version of 4152 // Find entry for key, otherwise return kNotFound. Optimized version of
4153 // HashTable::FindEntry. 4153 // HashTable::FindEntry.
4154 int FindEntry(Name* key); 4154 int FindEntry(Name* key);
4155 }; 4155 };
4156 4156
4157 4157
4158 class NumberDictionaryShape : public BaseShape<uint32_t> { 4158 class NumberDictionaryShape : public BaseShape<uint32_t> {
4159 public: 4159 public:
(...skipping 7125 matching lines...) Expand 10 before | Expand all | Expand 10 after
11285 } else { 11285 } else {
11286 value &= ~(1 << bit_position); 11286 value &= ~(1 << bit_position);
11287 } 11287 }
11288 return value; 11288 return value;
11289 } 11289 }
11290 }; 11290 };
11291 11291
11292 } } // namespace v8::internal 11292 } } // namespace v8::internal
11293 11293
11294 #endif // V8_OBJECTS_H_ 11294 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698