forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConcatStringCache.h
More file actions
30 lines (26 loc) · 1013 Bytes
/
ConcatStringCache.h
File metadata and controls
30 lines (26 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
namespace Js
{
struct ConcatStringCacheKey
{
Js::JavascriptString* left;
Js::JavascriptString* right;
};
typedef JsUtil::MruDictionary<ConcatStringCacheKey, Js::JavascriptString*> ConcatStringCache;
};
template <>
struct DefaultComparer<Js::ConcatStringCacheKey>
{
inline static bool Equals(Js::ConcatStringCacheKey x, Js::ConcatStringCacheKey y)
{
return x.left == y.left && x.right == y.right;
}
inline static hash_t GetHashCode(Js::ConcatStringCacheKey d)
{
return (HeapBlockMap32::GetLevel2Id(d.left) << 16 | HeapBlockMap32::GetLevel2Id(d.right));
}
};