2
2
3
3
const {
4
4
ObjectDefineProperties,
5
- ReflectConstruct,
6
5
Symbol,
7
6
} = primordials ;
8
7
@@ -25,14 +24,17 @@ const kEntryType = Symbol('PerformanceEntry.EntryType');
25
24
const kStartTime = Symbol ( 'PerformanceEntry.StartTime' ) ;
26
25
const kDuration = Symbol ( 'PerformanceEntry.Duration' ) ;
27
26
const kDetail = Symbol ( 'NodePerformanceEntry.Detail' ) ;
27
+ const kSkipThrow = Symbol ( 'kSkipThrow' ) ;
28
28
29
29
function isPerformanceEntry ( obj ) {
30
30
return obj ?. [ kName ] !== undefined ;
31
31
}
32
32
33
33
class PerformanceEntry {
34
- constructor ( ) {
35
- throw new ERR_ILLEGAL_CONSTRUCTOR ( ) ;
34
+ constructor ( skipThrowSymbol = undefined ) {
35
+ if ( skipThrowSymbol !== kSkipThrow ) {
36
+ throw new ERR_ILLEGAL_CONSTRUCTOR ( ) ;
37
+ }
36
38
}
37
39
38
40
get name ( ) {
@@ -92,9 +94,11 @@ function initPerformanceEntry(entry, name, type, start, duration) {
92
94
}
93
95
94
96
function createPerformanceEntry ( name , type , start , duration ) {
95
- return ReflectConstruct ( function PerformanceEntry ( ) {
96
- initPerformanceEntry ( this , name , type , start , duration ) ;
97
- } , [ ] , PerformanceEntry ) ;
97
+ const entry = new PerformanceEntry ( kSkipThrow ) ;
98
+
99
+ initPerformanceEntry ( entry , name , type , start , duration ) ;
100
+
101
+ return entry ;
98
102
}
99
103
100
104
/**
@@ -119,10 +123,12 @@ class PerformanceNodeEntry extends PerformanceEntry {
119
123
}
120
124
121
125
function createPerformanceNodeEntry ( name , type , start , duration , detail ) {
122
- return ReflectConstruct ( function PerformanceNodeEntry ( ) {
123
- initPerformanceEntry ( this , name , type , start , duration ) ;
124
- this [ kDetail ] = detail ;
125
- } , [ ] , PerformanceNodeEntry ) ;
126
+ const entry = new PerformanceNodeEntry ( kSkipThrow ) ;
127
+
128
+ initPerformanceEntry ( entry , name , type , start , duration ) ;
129
+ entry [ kDetail ] = detail ;
130
+
131
+ return entry ;
126
132
}
127
133
128
134
module . exports = {
0 commit comments