LCOV - code coverage report
Current view: top level - src/objects - code-cache.h (source / functions) Hit Total Coverage
Test: app.info Lines: 2 3 66.7 %
Date: 2017-04-26 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2017 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_OBJECTS_CODE_CACHE_H_
       6             : #define V8_OBJECTS_CODE_CACHE_H_
       7             : 
       8             : #include "src/objects/hash-table.h"
       9             : 
      10             : // Has to be the last include (doesn't have include guards):
      11             : #include "src/objects/object-macros.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : 
      16             : class CodeCacheHashTableShape : public BaseShape<HashTableKey*> {
      17             :  public:
      18             :   static inline bool IsMatch(HashTableKey* key, Object* value) {
      19        1673 :     return key->IsMatch(value);
      20             :   }
      21             : 
      22        1211 :   static inline uint32_t Hash(HashTableKey* key) { return key->Hash(); }
      23             : 
      24             :   static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
      25           0 :     return key->HashForObject(object);
      26             :   }
      27             : 
      28             :   static inline Handle<Object> AsHandle(Isolate* isolate, HashTableKey* key);
      29             : 
      30             :   static const int kPrefixSize = 0;
      31             :   // The both the key (name + flags) and value (code object) can be derived from
      32             :   // the fixed array that stores both the name and code.
      33             :   // TODO(verwaest): Don't allocate a fixed array but inline name and code.
      34             :   // Rewrite IsMatch to get table + index as input rather than just the raw key.
      35             :   static const int kEntrySize = 1;
      36             : };
      37             : 
      38             : class CodeCacheHashTable
      39             :     : public HashTable<CodeCacheHashTable, CodeCacheHashTableShape,
      40             :                        HashTableKey*> {
      41             :  public:
      42             :   static Handle<CodeCacheHashTable> Put(Handle<CodeCacheHashTable> table,
      43             :                                         Handle<Name> name, Handle<Code> code);
      44             : 
      45             :   Code* Lookup(Name* name, Code::Flags flags);
      46             : 
      47             :   DECLARE_CAST(CodeCacheHashTable)
      48             : 
      49             :  private:
      50             :   DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable);
      51             : };
      52             : 
      53             : }  // namespace internal
      54             : }  // namespace v8
      55             : 
      56             : #include "src/objects/object-macros-undef.h"
      57             : 
      58             : #endif  // V8_OBJECTS_CODE_CACHE_H_

Generated by: LCOV version 1.10