22#include " base_object-inl.h"
33#include " histogram-inl.h"
44#include " memory_tracker-inl.h"
5+ #include " node_debug.h"
56#include " node_errors.h"
67#include " node_external_reference.h"
78#include " util.h"
@@ -11,10 +12,8 @@ namespace node {
1112using v8::BigInt;
1213using v8::CFunction;
1314using v8::Context;
14- using v8::FastApiCallbackOptions;
1515using v8::FunctionCallbackInfo;
1616using v8::FunctionTemplate;
17- using v8::HandleScope;
1817using v8::Integer;
1918using v8::Isolate;
2019using v8::Local;
@@ -162,8 +161,8 @@ void HistogramBase::RecordDelta(const FunctionCallbackInfo<Value>& args) {
162161 (*histogram)->RecordDelta ();
163162}
164163
165- void HistogramBase::FastRecordDelta (Local<Value> unused,
166- Local<Value> receiver) {
164+ void HistogramBase::FastRecordDelta (Local<Value> receiver) {
165+ TRACK_V8_FAST_API_CALL ( " histogram.recordDelta " );
167166 HistogramBase* histogram;
168167 ASSIGN_OR_RETURN_UNWRAP (&histogram, receiver);
169168 (*histogram)->RecordDelta ();
@@ -183,15 +182,9 @@ void HistogramBase::Record(const FunctionCallbackInfo<Value>& args) {
183182 (*histogram)->Record (value);
184183}
185184
186- void HistogramBase::FastRecord (Local<Value> unused,
187- Local<Value> receiver,
188- const int64_t value,
189- FastApiCallbackOptions& options) {
190- if (value < 1 ) {
191- HandleScope scope (options.isolate );
192- THROW_ERR_OUT_OF_RANGE (options.isolate , " value is out of range" );
193- return ;
194- }
185+ void HistogramBase::FastRecord (Local<Value> receiver, const int64_t value) {
186+ CHECK_GE (value, 1 );
187+ TRACK_V8_FAST_API_CALL (" histogram.record" );
195188 HistogramBase* histogram;
196189 ASSIGN_OR_RETURN_UNWRAP (&histogram, receiver);
197190 (*histogram)->Record (value);
@@ -428,9 +421,8 @@ void IntervalHistogram::Start(const FunctionCallbackInfo<Value>& args) {
428421 histogram->OnStart (args[0 ]->IsTrue () ? StartFlags::RESET : StartFlags::NONE);
429422}
430423
431- void IntervalHistogram::FastStart (Local<Value> unused,
432- Local<Value> receiver,
433- bool reset) {
424+ void IntervalHistogram::FastStart (Local<Value> receiver, bool reset) {
425+ TRACK_V8_FAST_API_CALL (" histogram.start" );
434426 IntervalHistogram* histogram;
435427 ASSIGN_OR_RETURN_UNWRAP (&histogram, receiver);
436428 histogram->OnStart (reset ? StartFlags::RESET : StartFlags::NONE);
@@ -442,7 +434,8 @@ void IntervalHistogram::Stop(const FunctionCallbackInfo<Value>& args) {
442434 histogram->OnStop ();
443435}
444436
445- void IntervalHistogram::FastStop (Local<Value> unused, Local<Value> receiver) {
437+ void IntervalHistogram::FastStop (Local<Value> receiver) {
438+ TRACK_V8_FAST_API_CALL (" histogram.stop" );
446439 IntervalHistogram* histogram;
447440 ASSIGN_OR_RETURN_UNWRAP (&histogram, receiver);
448441 histogram->OnStop ();
@@ -555,46 +548,51 @@ void HistogramImpl::DoReset(const FunctionCallbackInfo<Value>& args) {
555548 (*histogram)->Reset ();
556549}
557550
558- void HistogramImpl::FastReset (Local<Value> unused, Local<Value> receiver) {
551+ void HistogramImpl::FastReset (Local<Value> receiver) {
552+ TRACK_V8_FAST_API_CALL (" histogram.reset" );
559553 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
560554 (*histogram)->Reset ();
561555}
562556
563- double HistogramImpl::FastGetCount (Local<Value> unused, Local<Value> receiver) {
557+ double HistogramImpl::FastGetCount (Local<Value> receiver) {
558+ TRACK_V8_FAST_API_CALL (" histogram.count" );
564559 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
565560 return static_cast <double >((*histogram)->Count ());
566561}
567562
568- double HistogramImpl::FastGetMin (Local<Value> unused, Local<Value> receiver) {
563+ double HistogramImpl::FastGetMin (Local<Value> receiver) {
564+ TRACK_V8_FAST_API_CALL (" histogram.min" );
569565 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
570566 return static_cast <double >((*histogram)->Min ());
571567}
572568
573- double HistogramImpl::FastGetMax (Local<Value> unused, Local<Value> receiver) {
569+ double HistogramImpl::FastGetMax (Local<Value> receiver) {
570+ TRACK_V8_FAST_API_CALL (" histogram.max" );
574571 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
575572 return static_cast <double >((*histogram)->Max ());
576573}
577574
578- double HistogramImpl::FastGetMean (Local<Value> unused, Local<Value> receiver) {
575+ double HistogramImpl::FastGetMean (Local<Value> receiver) {
576+ TRACK_V8_FAST_API_CALL (" histogram.mean" );
579577 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
580578 return (*histogram)->Mean ();
581579}
582580
583- double HistogramImpl::FastGetExceeds (Local<Value> unused,
584- Local<Value> receiver) {
581+ double HistogramImpl::FastGetExceeds (Local<Value> receiver) {
582+ TRACK_V8_FAST_API_CALL ( " histogram.exceeds " );
585583 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
586584 return static_cast <double >((*histogram)->Exceeds ());
587585}
588586
589- double HistogramImpl::FastGetStddev (Local<Value> unused,
590- Local<Value> receiver) {
587+ double HistogramImpl::FastGetStddev (Local<Value> receiver) {
588+ TRACK_V8_FAST_API_CALL ( " histogram.stddev " );
591589 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
592590 return (*histogram)->Stddev ();
593591}
594592
595- double HistogramImpl::FastGetPercentile (Local<Value> unused,
596- Local<Value> receiver,
593+ double HistogramImpl::FastGetPercentile (Local<Value> receiver,
597594 const double percentile) {
595+ TRACK_V8_FAST_API_CALL (" histogram.percentile" );
598596 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
599597 return static_cast <double >((*histogram)->Percentile (percentile));
600598}
0 commit comments