@@ -97,7 +97,7 @@ MetadataNode* MetadataNode::GetOrCreate(const string& className) {
97
97
98
98
node = GetOrCreateInternal (treeNode);
99
99
100
- s_name2NodeCache.insert ( make_pair ( className, node) );
100
+ s_name2NodeCache.emplace ( className, node);
101
101
} else {
102
102
node = it->second ;
103
103
}
@@ -115,7 +115,7 @@ MetadataNode* MetadataNode::GetOrCreateInternal(MetadataTreeNode* treeNode) {
115
115
} else {
116
116
result = new MetadataNode (treeNode);
117
117
118
- s_treeNode2NodeCache.insert ( make_pair ( treeNode, result) );
118
+ s_treeNode2NodeCache.emplace ( treeNode, result);
119
119
}
120
120
121
121
return result;
@@ -131,7 +131,7 @@ MetadataTreeNode* MetadataNode::GetOrCreateTreeNodeByName(const string& classNam
131
131
} else {
132
132
result = s_metadataReader.GetOrCreateTreeNodeByName (className);
133
133
134
- s_name2TreeNodeCache.insert ( make_pair ( className, result) );
134
+ s_name2TreeNodeCache.emplace ( className, result);
135
135
}
136
136
137
137
return result;
@@ -993,7 +993,7 @@ Local<FunctionTemplate> MetadataNode::GetConstructorFunctionTemplate(Isolate* is
993
993
ctorFuncTemplate.Clear ();
994
994
auto pft = new Persistent<FunctionTemplate>(isolate, ctorFuncTemplate);
995
995
CtorCacheData ctorCacheItem (pft, instanceMethodsCallbackData);
996
- cache->CtorFuncCache .insert ( make_pair ( treeNode, ctorCacheItem) );
996
+ cache->CtorFuncCache .emplace ( treeNode, ctorCacheItem);
997
997
return ctorFuncTemplate;
998
998
}
999
999
@@ -1060,7 +1060,7 @@ Local<FunctionTemplate> MetadataNode::GetConstructorFunctionTemplate(Isolate* is
1060
1060
// cache "ctorFuncTemplate"
1061
1061
auto pft = new Persistent<FunctionTemplate>(isolate, ctorFuncTemplate);
1062
1062
CtorCacheData ctorCacheItem (pft, instanceMethodsCallbackData);
1063
- cache->CtorFuncCache .insert ( make_pair ( treeNode, ctorCacheItem) );
1063
+ cache->CtorFuncCache .emplace ( treeNode, ctorCacheItem);
1064
1064
1065
1065
SetInnerTypes (isolate, wrappedCtorFunc, treeNode);
1066
1066
@@ -1735,11 +1735,11 @@ void MetadataNode::ExtendMethodCallback(const v8::FunctionCallbackInfo<v8::Value
1735
1735
SetTypeMetadata (isolate, extendFunc, new TypeMetadata (fullExtendedName));
1736
1736
info.GetReturnValue ().Set (extendFunc);
1737
1737
1738
- s_name2NodeCache.insert ( make_pair ( fullExtendedName, node) );
1738
+ s_name2NodeCache.emplace ( fullExtendedName, node);
1739
1739
1740
1740
ExtendedClassCacheData cacheData (extendFunc, fullExtendedName, node);
1741
1741
auto cache = GetMetadataNodeCache (isolate);
1742
- cache->ExtendedCtorFuncCache .insert ( make_pair ( fullExtendedName, cacheData) );
1742
+ cache->ExtendedCtorFuncCache .emplace ( fullExtendedName, cacheData);
1743
1743
1744
1744
if (frame.check ()) {
1745
1745
frame.log (" Extending: " + node->m_name );
@@ -2027,7 +2027,7 @@ MetadataNode::MetadataNodeCache* MetadataNode::GetMetadataNodeCache(Isolate* iso
2027
2027
auto itFound = s_metadata_node_cache.find (isolate);
2028
2028
if (itFound == s_metadata_node_cache.end ()) {
2029
2029
cache = new MetadataNodeCache;
2030
- s_metadata_node_cache.insert ( make_pair ( isolate, cache) );
2030
+ s_metadata_node_cache.emplace ( isolate, cache);
2031
2031
} else {
2032
2032
cache = itFound->second ;
2033
2033
}
@@ -2293,10 +2293,10 @@ void MetadataNode::onDisposeIsolate(Isolate* isolate) {
2293
2293
2294
2294
string MetadataNode::TNS_PREFIX = " com/tns/gen/" ;
2295
2295
MetadataReader MetadataNode::s_metadataReader;
2296
- std::map <std::string, MetadataNode*> MetadataNode::s_name2NodeCache;
2297
- std::map <std::string, MetadataTreeNode*> MetadataNode::s_name2TreeNodeCache;
2298
- std::map <MetadataTreeNode*, MetadataNode*> MetadataNode::s_treeNode2NodeCache;
2299
- map <Isolate*, MetadataNode::MetadataNodeCache*> MetadataNode::s_metadata_node_cache;
2296
+ robin_hood::unordered_map <std::string, MetadataNode*> MetadataNode::s_name2NodeCache;
2297
+ robin_hood::unordered_map <std::string, MetadataTreeNode*> MetadataNode::s_name2TreeNodeCache;
2298
+ robin_hood::unordered_map <MetadataTreeNode*, MetadataNode*> MetadataNode::s_treeNode2NodeCache;
2299
+ robin_hood::unordered_map <Isolate*, MetadataNode::MetadataNodeCache*> MetadataNode::s_metadata_node_cache;
2300
2300
bool MetadataNode::s_profilerEnabled = false ;
2301
- std::map <Isolate*, Persistent<ObjectTemplate>*> MetadataNode::s_arrayObjectTemplates;
2301
+ robin_hood::unordered_map <Isolate*, Persistent<ObjectTemplate>*> MetadataNode::s_arrayObjectTemplates;
2302
2302
0 commit comments