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

Unified Diff: src/objects.h

Issue 4078: - Added a map cache for literal objects. This will... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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
Index: src/objects.h
===================================================================
--- src/objects.h (revision 369)
+++ src/objects.h (working copy)
@@ -619,6 +619,7 @@
inline bool IsDictionary();
inline bool IsSymbolTable();
inline bool IsCompilationCacheTable();
+ inline bool IsMapCache();
inline bool IsPrimitive();
inline bool IsGlobalObject();
inline bool IsJSGlobalObject();
@@ -1836,6 +1837,22 @@
};
+// MapCache.
+//
+// Maps keys that are a fixed array of symbols to a map.
+// Used for canonicalize maps for object literals.
+class MapCache: public HashTable<0, 2> {
+ public:
+ // Find cached value for a string key, otherwise return null.
+ Object* Lookup(FixedArray* key);
+ Object* Put(FixedArray* key, Map* value);
+ static inline MapCache* cast(Object* obj);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache);
+};
+
+
// Dictionary for keeping properties and elements in slow case.
//
// One element in the prefix is used for storing non-element
@@ -2671,6 +2688,9 @@
// Returns the number of allocated literals.
int NumberOfLiterals();
+ // Retrieve the global context from a function's literal array.
+ static Context* GlobalContextFromLiterals(FixedArray* literals);
+
// Layout descriptors.
static const int kPrototypeOrInitialMapOffset = JSObject::kHeaderSize;
static const int kSharedFunctionInfoOffset =
@@ -2680,11 +2700,8 @@
static const int kSize = kLiteralsOffset + kPointerSize;
// Layout of the literals array.
- static const int kLiteralsPrefixSize = 3;
- static const int kLiteralObjectFunctionIndex = 0;
- static const int kLiteralRegExpFunctionIndex = 1;
- static const int kLiteralArrayFunctionIndex = 2;
-
+ static const int kLiteralsPrefixSize = 1;
+ static const int kLiteralGlobalContextIndex = 0;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction);
};

Powered by Google App Engine
This is Rietveld 408576698