Skip to content

Commit b44623e

Browse files
singhalkanika198rvagg
authored andcommitted
src: elevate v8 namespaces of referenced artifacts
PR-URL: #24424 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent a7f6c04 commit b44623e

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

src/node_perf.cc

+25-18
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@ namespace performance {
1010

1111
using v8::Array;
1212
using v8::Context;
13+
using v8::DontDelete;
1314
using v8::Function;
1415
using v8::FunctionCallbackInfo;
1516
using v8::FunctionTemplate;
17+
using v8::GCCallbackFlags;
18+
using v8::GCType;
1619
using v8::HandleScope;
1720
using v8::Integer;
1821
using v8::Isolate;
1922
using v8::Local;
2023
using v8::Name;
24+
using v8::NewStringType;
2125
using v8::Number;
2226
using v8::Object;
27+
using v8::PropertyAttribute;
28+
using v8::ReadOnly;
2329
using v8::String;
30+
using v8::Uint32Array;
2431
using v8::Value;
2532

2633
// Microseconds in a second, as a float.
@@ -36,7 +43,7 @@ uint64_t performance_node_start;
3643
uint64_t performance_v8_start;
3744

3845
uint64_t performance_last_gc_start_mark_ = 0;
39-
v8::GCType performance_last_gc_type_ = v8::GCType::kGCTypeAll;
46+
GCType performance_last_gc_type_ = GCType::kGCTypeAll;
4047

4148
void performance_state::Mark(enum PerformanceMilestone milestone,
4249
uint64_t ts) {
@@ -69,21 +76,21 @@ inline void InitObject(const PerformanceEntry& entry, Local<Object> obj) {
6976
Environment* env = entry.env();
7077
Isolate* isolate = env->isolate();
7178
Local<Context> context = env->context();
72-
v8::PropertyAttribute attr =
73-
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete);
79+
PropertyAttribute attr =
80+
static_cast<PropertyAttribute>(ReadOnly | DontDelete);
7481
obj->DefineOwnProperty(context,
7582
env->name_string(),
7683
String::NewFromUtf8(isolate,
7784
entry.name().c_str(),
78-
v8::NewStringType::kNormal)
85+
NewStringType::kNormal)
7986
.ToLocalChecked(),
8087
attr)
8188
.FromJust();
8289
obj->DefineOwnProperty(context,
8390
env->entry_type_string(),
8491
String::NewFromUtf8(isolate,
8592
entry.type().c_str(),
86-
v8::NewStringType::kNormal)
93+
NewStringType::kNormal)
8794
.ToLocalChecked(),
8895
attr)
8996
.FromJust();
@@ -124,7 +131,7 @@ void PerformanceEntry::Notify(Environment* env,
124131
PerformanceEntryType type,
125132
Local<Value> object) {
126133
Context::Scope scope(env->context());
127-
AliasedBuffer<uint32_t, v8::Uint32Array>& observers =
134+
AliasedBuffer<uint32_t, Uint32Array>& observers =
128135
env->performance_state()->observers;
129136
if (type != NODE_PERFORMANCE_ENTRY_TYPE_INVALID &&
130137
observers[type]) {
@@ -242,12 +249,12 @@ void PerformanceGCCallback(Environment* env, void* ptr) {
242249
HandleScope scope(env->isolate());
243250
Local<Context> context = env->context();
244251

245-
AliasedBuffer<uint32_t, v8::Uint32Array>& observers =
252+
AliasedBuffer<uint32_t, Uint32Array>& observers =
246253
env->performance_state()->observers;
247254
if (observers[NODE_PERFORMANCE_ENTRY_TYPE_GC]) {
248255
Local<Object> obj = entry->ToObject();
249-
v8::PropertyAttribute attr =
250-
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete);
256+
PropertyAttribute attr =
257+
static_cast<PropertyAttribute>(ReadOnly | DontDelete);
251258
obj->DefineOwnProperty(context,
252259
env->kind_string(),
253260
Integer::New(env->isolate(), entry->gckind()),
@@ -260,16 +267,16 @@ void PerformanceGCCallback(Environment* env, void* ptr) {
260267

261268
// Marks the start of a GC cycle
262269
void MarkGarbageCollectionStart(Isolate* isolate,
263-
v8::GCType type,
264-
v8::GCCallbackFlags flags) {
270+
GCType type,
271+
GCCallbackFlags flags) {
265272
performance_last_gc_start_mark_ = PERFORMANCE_NOW();
266273
performance_last_gc_type_ = type;
267274
}
268275

269276
// Marks the end of a GC cycle
270277
void MarkGarbageCollectionEnd(Isolate* isolate,
271-
v8::GCType type,
272-
v8::GCCallbackFlags flags,
278+
GCType type,
279+
GCCallbackFlags flags,
273280
void* data) {
274281
Environment* env = static_cast<Environment*>(data);
275282
// If no one is listening to gc performance entries, do not create them.
@@ -341,7 +348,7 @@ void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) {
341348
return;
342349
args.GetReturnValue().Set(ret.ToLocalChecked());
343350

344-
AliasedBuffer<uint32_t, v8::Uint32Array>& observers =
351+
AliasedBuffer<uint32_t, Uint32Array>& observers =
345352
env->performance_state()->observers;
346353
if (!observers[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION])
347354
return;
@@ -414,18 +421,18 @@ void Initialize(Local<Object> target,
414421
NODE_PERFORMANCE_MILESTONES(V)
415422
#undef V
416423

417-
v8::PropertyAttribute attr =
418-
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete);
424+
PropertyAttribute attr =
425+
static_cast<PropertyAttribute>(ReadOnly | DontDelete);
419426

420427
target->DefineOwnProperty(context,
421428
FIXED_ONE_BYTE_STRING(isolate, "timeOrigin"),
422-
v8::Number::New(isolate, timeOrigin / 1e6),
429+
Number::New(isolate, timeOrigin / 1e6),
423430
attr).ToChecked();
424431

425432
target->DefineOwnProperty(
426433
context,
427434
FIXED_ONE_BYTE_STRING(isolate, "timeOriginTimestamp"),
428-
v8::Number::New(isolate, timeOriginTimestamp / MICROS_PER_MILLIS),
435+
Number::New(isolate, timeOriginTimestamp / MICROS_PER_MILLIS),
429436
attr).ToChecked();
430437

431438
target->DefineOwnProperty(context,

0 commit comments

Comments
 (0)