Commit 28285083 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Handlify HashTable and Dictionary growing.

R=ishell@chromium.org

Review URL: https://codereview.chromium.org/240023004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20820 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 28912cae
......@@ -2232,24 +2232,13 @@ Handle<MapCache> Factory::NewMapCache(int at_least_space_for) {
}
MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context,
FixedArray* keys,
Map* map) {
Object* result;
{ MaybeObject* maybe_result =
MapCache::cast(context->map_cache())->Put(keys, map);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
context->set_map_cache(MapCache::cast(result));
return result;
}
Handle<MapCache> Factory::AddToMapCache(Handle<Context> context,
Handle<FixedArray> keys,
Handle<Map> map) {
CALL_HEAP_FUNCTION(isolate(),
UpdateMapCacheWith(*context, *keys, *map), MapCache);
Handle<MapCache> map_cache = handle(MapCache::cast(context->map_cache()));
Handle<MapCache> result = MapCache::Put(map_cache, keys, map);
context->set_map_cache(*result);
return result;
}
......
This diff is collapsed.
......@@ -3858,6 +3858,11 @@ class HashTable: public FixedArray {
int n,
Key key,
PretenureFlag pretenure = NOT_TENURED);
static Handle<Derived> EnsureCapacity(
Handle<Derived> table,
int n,
Key key,
PretenureFlag pretenure = NOT_TENURED);
};
......@@ -3964,7 +3969,8 @@ class MapCache: public HashTable<MapCache, MapCacheShape, HashTableKey*> {
public:
// Find cached value for a name key, otherwise return null.
Object* Lookup(FixedArray* key);
MUST_USE_RESULT MaybeObject* Put(FixedArray* key, Map* value);
static Handle<MapCache> Put(
Handle<MapCache> map_cache, Handle<FixedArray> key, Handle<Map> value);
static inline MapCache* cast(Object* obj);
private:
......@@ -4063,6 +4069,8 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
// Ensure enough space for n additional elements.
MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key);
static Handle<Derived> EnsureCapacity(Handle<Derived> obj, int n, Key key);
#ifdef OBJECT_PRINT
void Print(FILE* out = stdout);
#endif
......@@ -4273,12 +4281,6 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
return reinterpret_cast<ObjectHashTable*>(obj);
}
static Handle<ObjectHashTable> EnsureCapacity(
Handle<ObjectHashTable> table,
int n,
Handle<Object> key,
PretenureFlag pretenure = NOT_TENURED);
// Attempt to shrink hash table after removal of key.
static inline Handle<ObjectHashTable> Shrink(Handle<ObjectHashTable> table,
Handle<Object> key);
......@@ -8285,8 +8287,6 @@ class CompilationCacheTable: public HashTable<CompilationCacheTable,
static Handle<CompilationCacheTable> PutRegExp(
Handle<CompilationCacheTable> cache, Handle<String> src,
JSRegExp::Flags flags, Handle<FixedArray> value);
static Handle<CompilationCacheTable> EnsureCapacityFor(
Handle<CompilationCacheTable> cache, int n, HashTableKey* key);
void Remove(Object* value);
static inline CompilationCacheTable* cast(Object* obj);
......@@ -8390,8 +8390,6 @@ class CodeCacheHashTable: public HashTable<CodeCacheHashTable,
static const int kInitialSize = 64;
private:
MUST_USE_RESULT MaybeObject* Put(Name* name, Code* code);
DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment