| Index: src/objects.h
|
| ===================================================================
|
| --- src/objects.h (revision 12582)
|
| +++ src/objects.h (working copy)
|
| @@ -79,6 +79,7 @@
|
| // - Dictionary
|
| // - SymbolTable
|
| // - CompilationCacheTable
|
| +// - ShortTermJSONEvalCacheTable
|
| // - CodeCacheHashTable
|
| // - MapCache
|
| // - Context
|
| @@ -850,6 +851,7 @@
|
| V(JSFunctionResultCache) \
|
| V(NormalizedMapCache) \
|
| V(CompilationCacheTable) \
|
| + V(ShortTermJSONEvalCacheTable) \
|
| V(CodeCacheHashTable) \
|
| V(PolymorphicCodeCacheHashTable) \
|
| V(MapCache) \
|
| @@ -5719,6 +5721,10 @@
|
| // Indicates that code for this function cannot be cached.
|
| DECL_BOOLEAN_ACCESSORS(dont_cache)
|
|
|
| + // Indicates this is an eval function which just returns an object or array
|
| + // literal containing no outside information.
|
| + DECL_BOOLEAN_ACCESSORS(is_json_eval)
|
| +
|
| // Indicates whether or not the code in the shared function support
|
| // deoptimization.
|
| inline bool has_deoptimization_support();
|
| @@ -5952,6 +5958,7 @@
|
| kDontOptimize,
|
| kDontInline,
|
| kDontCache,
|
| + kIsJSONEval,
|
| kCompilerHintsCount // Pseudo entry
|
| };
|
|
|
| @@ -6769,12 +6776,15 @@
|
| Context* context,
|
| Object* value);
|
| MUST_USE_RESULT MaybeObject* PutEval(String* src,
|
| - Context* context,
|
| - SharedFunctionInfo* value,
|
| - int scope_position);
|
| + Context* context,
|
| + SharedFunctionInfo* value,
|
| + int scope_position);
|
| MUST_USE_RESULT MaybeObject* PutRegExp(String* src,
|
| JSRegExp::Flags flags,
|
| FixedArray* value);
|
| + MUST_USE_RESULT MaybeObject* PutRaw(Object* key,
|
| + SharedFunctionInfo* value,
|
| + HashTableKey* hasher);
|
|
|
| // Remove given value from cache.
|
| void Remove(Object* value);
|
| @@ -6786,6 +6796,78 @@
|
| };
|
|
|
|
|
| +class ShortTermJSONEvalCacheShape : public BaseShape<HashTableKey*> {
|
| + public:
|
| + static inline bool IsMatch(HashTableKey* key, Object* value) {
|
| + return key->IsMatch(value);
|
| + }
|
| +
|
| + static inline uint32_t Hash(HashTableKey* key) {
|
| + return key->Hash();
|
| + }
|
| +
|
| + static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
|
| + return key->HashForObject(object);
|
| + }
|
| +
|
| + MUST_USE_RESULT static MaybeObject* AsObject(HashTableKey* key) {
|
| + return key->AsObject();
|
| + }
|
| +
|
| + // This is the prefix size in the HashTable class. We don't reference it
|
| + // directly because clang is picky about the order constants are defined.
|
| + static const int kPrefixStartIndex = 3;
|
| + static const int kTotalSourceSizeIndex = kPrefixStartIndex;
|
| + static const int kAgeIndex = kTotalSourceSizeIndex + 1;
|
| +
|
| + static const int kPrefixSize = kAgeIndex - kPrefixStartIndex + 1;
|
| + static const int kEntrySize = 3;
|
| +};
|
| +
|
| +
|
| +class ShortTermJSONEvalCacheTable
|
| + : public HashTable<ShortTermJSONEvalCacheShape, HashTableKey*> {
|
| + public:
|
| + MUST_USE_RESULT static MaybeObject* Allocate();
|
| +
|
| + // Returns the total code size of all entries
|
| + int total_source_size();
|
| +
|
| + // Find a cached value, otherwise return undefined.
|
| + Object* Lookup(String* src);
|
| +
|
| + // Attempt to add a new value to the cache. The size of the value (as given
|
| + // by ValueSize) must be at most kMaxTotalSourceSize. This may evict
|
| + // older elements to make room for the new element.
|
| + MUST_USE_RESULT MaybeObject* Put(String* src,
|
| + SharedFunctionInfo* value);
|
| +
|
| + // Remove given value from cache.
|
| + void Remove(Object* value);
|
| +
|
| + // Return the code size of a value. Values must be less than kMaxTotalCodeSize
|
| + // to be added to this cache.
|
| + static int ValueSize(SharedFunctionInfo* value);
|
| +
|
| + static inline ShortTermJSONEvalCacheTable* cast(Object* obj);
|
| +
|
| + static int max_entries();
|
| + static int max_total_source_size();
|
| +
|
| + private:
|
| + void Reserve(int size);
|
| + void RemoveOldest();
|
| +
|
| + void set_total_source_size(int size);
|
| +
|
| + int current_age();
|
| + void set_current_age(int age);
|
| + Smi* NextAge();
|
| +
|
| + DISALLOW_IMPLICIT_CONSTRUCTORS(ShortTermJSONEvalCacheTable);
|
| +};
|
| +
|
| +
|
| class CodeCache: public Struct {
|
| public:
|
| DECL_ACCESSORS(default_cache, FixedArray)
|
|
|