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

Unified Diff: src/heap.h

Issue 126262: Reimplemented the KeyedLookupCache to speed up access. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698