File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,14 @@ using v8::Number;
23
23
using v8::Object;
24
24
using v8::Value;
25
25
26
- thread_local std::unordered_map<std::string_view, int > v8_fast_api_call_counts;
26
+ thread_local std::unordered_map<FastStringKey, int , FastStringKey::Hash>
27
+ v8_fast_api_call_counts;
27
28
28
- void TrackV8FastApiCall (std::string_view key) {
29
+ void TrackV8FastApiCall (FastStringKey key) {
29
30
v8_fast_api_call_counts[key]++;
30
31
}
31
32
32
- int GetV8FastApiCallCount (std::string_view key) {
33
+ int GetV8FastApiCallCount (FastStringKey key) {
33
34
return v8_fast_api_call_counts[key];
34
35
}
35
36
@@ -40,7 +41,8 @@ void GetV8FastApiCallCount(const FunctionCallbackInfo<Value>& args) {
40
41
return ;
41
42
}
42
43
Utf8Value utf8_key (env->isolate (), args[0 ]);
43
- args.GetReturnValue ().Set (GetV8FastApiCallCount (utf8_key.ToStringView ()));
44
+ args.GetReturnValue ().Set (GetV8FastApiCallCount (
45
+ FastStringKey::AllowDynamic (utf8_key.ToStringView ())));
44
46
}
45
47
46
48
void SlowIsEven (const FunctionCallbackInfo<Value>& args) {
Original file line number Diff line number Diff line change 3
3
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
4
4
5
5
#ifdef DEBUG
6
- #include < string_view >
6
+ #include " util.h "
7
7
#endif // DEBUG
8
8
9
9
namespace node {
10
10
namespace debug {
11
11
12
12
#ifdef DEBUG
13
- void TrackV8FastApiCall (std::string_view key);
14
- int GetV8FastApiCallCount (std::string_view key);
13
+ void TrackV8FastApiCall (FastStringKey key);
14
+ int GetV8FastApiCallCount (FastStringKey key);
15
15
16
- #define TRACK_V8_FAST_API_CALL (key ) node::debug::TrackV8FastApiCall(key)
16
+ #define TRACK_V8_FAST_API_CALL (key ) \
17
+ node::debug::TrackV8FastApiCall (FastStringKey(key))
17
18
#else // !DEBUG
18
19
#define TRACK_V8_FAST_API_CALL (key )
19
20
#endif // DEBUG
You can’t perform that action at this time.
0 commit comments