2
2
3
3
const {
4
4
ObjectDefineProperties,
5
- ReflectConstruct ,
5
+ ObjectSetPrototypeOf ,
6
6
Symbol,
7
7
} = primordials ;
8
8
@@ -91,10 +91,19 @@ function initPerformanceEntry(entry, name, type, start, duration) {
91
91
entry [ kDuration ] = duration ;
92
92
}
93
93
94
+ function FastPerformanceEntry ( name , type , start , duration ) {
95
+ initPerformanceEntry ( this , name , type , start , duration ) ;
96
+ }
97
+
98
+ ObjectSetPrototypeOf ( FastPerformanceEntry . prototype , PerformanceEntry . prototype ) ;
99
+ ObjectSetPrototypeOf ( FastPerformanceEntry , PerformanceEntry ) ;
100
+
94
101
function createPerformanceEntry ( name , type , start , duration ) {
95
- return ReflectConstruct ( function PerformanceEntry ( ) {
96
- initPerformanceEntry ( this , name , type , start , duration ) ;
97
- } , [ ] , PerformanceEntry ) ;
102
+ const entry = new FastPerformanceEntry ( name , type , start , duration ) ;
103
+
104
+ entry . constructor = PerformanceEntry ;
105
+
106
+ return entry ;
98
107
}
99
108
100
109
/**
@@ -118,11 +127,20 @@ class PerformanceNodeEntry extends PerformanceEntry {
118
127
}
119
128
}
120
129
130
+ function FastPerformanceNodeEntry ( name , type , start , duration , detail ) {
131
+ initPerformanceEntry ( this , name , type , start , duration ) ;
132
+ this [ kDetail ] = detail ;
133
+ }
134
+
135
+ ObjectSetPrototypeOf ( FastPerformanceNodeEntry . prototype , PerformanceNodeEntry . prototype ) ;
136
+ ObjectSetPrototypeOf ( FastPerformanceNodeEntry , PerformanceNodeEntry ) ;
137
+
121
138
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 ) ;
139
+ const entry = new FastPerformanceNodeEntry ( name , type , start , duration , detail ) ;
140
+
141
+ entry . constructor = PerformanceNodeEntry ;
142
+
143
+ return entry ;
126
144
}
127
145
128
146
module . exports = {
0 commit comments