LCOV - code coverage report
Current view: top level - src/objects - string-table-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 16 16 100.0 %
Date: 2019-02-19 Functions: 5 5 100.0 %

          Line data    Source code
       1             : // Copyright 2018 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_STRING_TABLE_INL_H_
       6             : #define V8_OBJECTS_STRING_TABLE_INL_H_
       7             : 
       8             : #include "src/objects/string-table.h"
       9             : 
      10             : #include "src/objects/string-inl.h"
      11             : 
      12             : // Has to be the last include (doesn't have include guards):
      13             : #include "src/objects/object-macros.h"
      14             : 
      15             : namespace v8 {
      16             : namespace internal {
      17             : 
      18       17197 : CAST_ACCESSOR(StringSet)
      19    26814762 : CAST_ACCESSOR(StringTable)
      20             : 
      21    26814762 : StringTable::StringTable(Address ptr)
      22             :     : HashTable<StringTable, StringTableShape>(ptr) {
      23             :   SLOW_DCHECK(IsStringTable());
      24    26814762 : }
      25             : 
      26       17197 : StringSet::StringSet(Address ptr) : HashTable<StringSet, StringSetShape>(ptr) {
      27             :   SLOW_DCHECK(IsStringSet());
      28       17197 : }
      29             : 
      30        7949 : bool StringSetShape::IsMatch(String key, Object value) {
      31             :   DCHECK(value->IsString());
      32        7949 :   return key->Equals(String::cast(value));
      33             : }
      34             : 
      35             : uint32_t StringSetShape::Hash(Isolate* isolate, String key) {
      36       33297 :   return key->Hash();
      37             : }
      38             : 
      39         477 : uint32_t StringSetShape::HashForObject(Isolate* isolate, Object object) {
      40         477 :   return String::cast(object)->Hash();
      41             : }
      42             : 
      43             : StringTableKey::StringTableKey(uint32_t hash_field)
      44    97409711 :     : HashTableKey(hash_field >> Name::kHashShift), hash_field_(hash_field) {}
      45             : 
      46             : void StringTableKey::set_hash_field(uint32_t hash_field) {
      47    12854540 :   hash_field_ = hash_field;
      48    12854540 :   set_hash(hash_field >> Name::kHashShift);
      49             : }
      50             : 
      51             : Handle<Object> StringTableShape::AsHandle(Isolate* isolate,
      52             :                                           StringTableKey* key) {
      53             :   return key->AsHandle(isolate);
      54             : }
      55             : 
      56   674488307 : uint32_t StringTableShape::HashForObject(Isolate* isolate, Object object) {
      57   674489612 :   return String::cast(object)->Hash();
      58             : }
      59             : 
      60             : RootIndex StringTableShape::GetMapRootIndex() {
      61             :   return RootIndex::kStringTableMap;
      62             : }
      63             : 
      64             : }  // namespace internal
      65             : }  // namespace v8
      66             : 
      67             : #include "src/objects/object-macros-undef.h"
      68             : 
      69             : #endif  // V8_OBJECTS_STRING_TABLE_INL_H_

Generated by: LCOV version 1.10