| Index: src/heap.h
|
| ===================================================================
|
| --- src/heap.h (revision 2194)
|
| +++ src/heap.h (working copy)
|
| @@ -126,7 +126,6 @@
|
| V(FixedArray, number_string_cache) \
|
| V(FixedArray, single_character_string_cache) \
|
| V(FixedArray, natives_source_cache) \
|
| - V(Object, keyed_lookup_cache) \
|
| V(Object, last_script_id)
|
|
|
|
|
| @@ -700,11 +699,6 @@
|
| non_monomorphic_cache_ = value;
|
| }
|
|
|
| - // Gets, sets and clears the lookup cache used for keyed access.
|
| - static inline Object* GetKeyedLookupCache();
|
| - static inline void SetKeyedLookupCache(LookupCache* cache);
|
| - static inline void ClearKeyedLookupCache();
|
| -
|
| // Update the next script id.
|
| static inline void SetLastScriptId(Object* last_script_id);
|
|
|
| @@ -1140,6 +1134,30 @@
|
| };
|
|
|
|
|
| +// Cache for mapping (map, property name) into field offset.
|
| +// Cleared at startup and prior to mark sweep collection.
|
| +class KeyedLookupCache {
|
| + public:
|
| + // Lookup field offset for (map, name). If absent, -1 is returned.
|
| + static int Lookup(Map* map, String* name);
|
| +
|
| + // Update an element in the cache.
|
| + static void Update(Map* map, String* name, int field_offset);
|
| +
|
| + // Clear the cache.
|
| + static void Clear();
|
| + private:
|
| + inline static int Hash(Map* map, String* name);
|
| + static const int kLength = 128;
|
| + struct Key {
|
| + Map* map;
|
| + String* name;
|
| + };
|
| + static Key keys_[kLength];
|
| + static int field_offsets_[kLength];
|
| +};
|
| +
|
| +
|
| // ----------------------------------------------------------------------------
|
| // Marking stack for tracing live objects.
|
|
|
|
|