@@ -10,17 +10,24 @@ namespace performance {
10
10
11
11
using v8::Array;
12
12
using v8::Context;
13
+ using v8::DontDelete;
13
14
using v8::Function;
14
15
using v8::FunctionCallbackInfo;
15
16
using v8::FunctionTemplate;
17
+ using v8::GCCallbackFlags;
18
+ using v8::GCType;
16
19
using v8::HandleScope;
17
20
using v8::Integer;
18
21
using v8::Isolate;
19
22
using v8::Local;
20
23
using v8::Name;
24
+ using v8::NewStringType;
21
25
using v8::Number;
22
26
using v8::Object;
27
+ using v8::PropertyAttribute;
28
+ using v8::ReadOnly;
23
29
using v8::String;
30
+ using v8::Uint32Array;
24
31
using v8::Value;
25
32
26
33
// Microseconds in a second, as a float.
@@ -36,7 +43,7 @@ uint64_t performance_node_start;
36
43
uint64_t performance_v8_start;
37
44
38
45
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 ;
40
47
41
48
void performance_state::Mark (enum PerformanceMilestone milestone,
42
49
uint64_t ts) {
@@ -69,21 +76,21 @@ inline void InitObject(const PerformanceEntry& entry, Local<Object> obj) {
69
76
Environment* env = entry.env ();
70
77
Isolate* isolate = env->isolate ();
71
78
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);
74
81
obj->DefineOwnProperty (context,
75
82
env->name_string (),
76
83
String::NewFromUtf8 (isolate,
77
84
entry.name ().c_str (),
78
- v8:: NewStringType::kNormal )
85
+ NewStringType::kNormal )
79
86
.ToLocalChecked (),
80
87
attr)
81
88
.FromJust ();
82
89
obj->DefineOwnProperty (context,
83
90
env->entry_type_string (),
84
91
String::NewFromUtf8 (isolate,
85
92
entry.type ().c_str (),
86
- v8:: NewStringType::kNormal )
93
+ NewStringType::kNormal )
87
94
.ToLocalChecked (),
88
95
attr)
89
96
.FromJust ();
@@ -124,7 +131,7 @@ void PerformanceEntry::Notify(Environment* env,
124
131
PerformanceEntryType type,
125
132
Local<Value> object) {
126
133
Context::Scope scope (env->context ());
127
- AliasedBuffer<uint32_t , v8:: Uint32Array>& observers =
134
+ AliasedBuffer<uint32_t , Uint32Array>& observers =
128
135
env->performance_state ()->observers ;
129
136
if (type != NODE_PERFORMANCE_ENTRY_TYPE_INVALID &&
130
137
observers[type]) {
@@ -242,12 +249,12 @@ void PerformanceGCCallback(Environment* env, void* ptr) {
242
249
HandleScope scope (env->isolate ());
243
250
Local<Context> context = env->context ();
244
251
245
- AliasedBuffer<uint32_t , v8:: Uint32Array>& observers =
252
+ AliasedBuffer<uint32_t , Uint32Array>& observers =
246
253
env->performance_state ()->observers ;
247
254
if (observers[NODE_PERFORMANCE_ENTRY_TYPE_GC]) {
248
255
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);
251
258
obj->DefineOwnProperty (context,
252
259
env->kind_string (),
253
260
Integer::New (env->isolate (), entry->gckind ()),
@@ -260,16 +267,16 @@ void PerformanceGCCallback(Environment* env, void* ptr) {
260
267
261
268
// Marks the start of a GC cycle
262
269
void MarkGarbageCollectionStart (Isolate* isolate,
263
- v8:: GCType type,
264
- v8:: GCCallbackFlags flags) {
270
+ GCType type,
271
+ GCCallbackFlags flags) {
265
272
performance_last_gc_start_mark_ = PERFORMANCE_NOW ();
266
273
performance_last_gc_type_ = type;
267
274
}
268
275
269
276
// Marks the end of a GC cycle
270
277
void MarkGarbageCollectionEnd (Isolate* isolate,
271
- v8:: GCType type,
272
- v8:: GCCallbackFlags flags,
278
+ GCType type,
279
+ GCCallbackFlags flags,
273
280
void * data) {
274
281
Environment* env = static_cast <Environment*>(data);
275
282
// If no one is listening to gc performance entries, do not create them.
@@ -341,7 +348,7 @@ void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) {
341
348
return ;
342
349
args.GetReturnValue ().Set (ret.ToLocalChecked ());
343
350
344
- AliasedBuffer<uint32_t , v8:: Uint32Array>& observers =
351
+ AliasedBuffer<uint32_t , Uint32Array>& observers =
345
352
env->performance_state ()->observers ;
346
353
if (!observers[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION])
347
354
return ;
@@ -414,18 +421,18 @@ void Initialize(Local<Object> target,
414
421
NODE_PERFORMANCE_MILESTONES (V)
415
422
#undef V
416
423
417
- v8:: PropertyAttribute attr =
418
- static_cast <v8:: PropertyAttribute>(v8:: ReadOnly | v8:: DontDelete);
424
+ PropertyAttribute attr =
425
+ static_cast <PropertyAttribute>(ReadOnly | DontDelete);
419
426
420
427
target->DefineOwnProperty (context,
421
428
FIXED_ONE_BYTE_STRING (isolate, " timeOrigin" ),
422
- v8:: Number::New (isolate, timeOrigin / 1e6 ),
429
+ Number::New (isolate, timeOrigin / 1e6 ),
423
430
attr).ToChecked ();
424
431
425
432
target->DefineOwnProperty (
426
433
context,
427
434
FIXED_ONE_BYTE_STRING (isolate, " timeOriginTimestamp" ),
428
- v8:: Number::New (isolate, timeOriginTimestamp / MICROS_PER_MILLIS),
435
+ Number::New (isolate, timeOriginTimestamp / MICROS_PER_MILLIS),
429
436
attr).ToChecked ();
430
437
431
438
target->DefineOwnProperty (context,
0 commit comments