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 ();
@@ -558,46 +551,51 @@ void HistogramImpl::DoReset(const FunctionCallbackInfo<Value>& args) {
558551 (*histogram)->Reset ();
559552}
560553
561- void HistogramImpl::FastReset (Local<Value> unused, Local<Value> receiver) {
554+ void HistogramImpl::FastReset (Local<Value> receiver) {
555+ TRACK_V8_FAST_API_CALL (" histogram.reset" );
562556 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
563557 (*histogram)->Reset ();
564558}
565559
566- double HistogramImpl::FastGetCount (Local<Value> unused, Local<Value> receiver) {
560+ double HistogramImpl::FastGetCount (Local<Value> receiver) {
561+ TRACK_V8_FAST_API_CALL (" histogram.count" );
567562 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
568563 return static_cast <double >((*histogram)->Count ());
569564}
570565
571- double HistogramImpl::FastGetMin (Local<Value> unused, Local<Value> receiver) {
566+ double HistogramImpl::FastGetMin (Local<Value> receiver) {
567+ TRACK_V8_FAST_API_CALL (" histogram.min" );
572568 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
573569 return static_cast <double >((*histogram)->Min ());
574570}
575571
576- double HistogramImpl::FastGetMax (Local<Value> unused, Local<Value> receiver) {
572+ double HistogramImpl::FastGetMax (Local<Value> receiver) {
573+ TRACK_V8_FAST_API_CALL (" histogram.max" );
577574 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
578575 return static_cast <double >((*histogram)->Max ());
579576}
580577
581- double HistogramImpl::FastGetMean (Local<Value> unused, Local<Value> receiver) {
578+ double HistogramImpl::FastGetMean (Local<Value> receiver) {
579+ TRACK_V8_FAST_API_CALL (" histogram.mean" );
582580 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
583581 return (*histogram)->Mean ();
584582}
585583
586- double HistogramImpl::FastGetExceeds (Local<Value> unused,
587- Local<Value> receiver) {
584+ double HistogramImpl::FastGetExceeds (Local<Value> receiver) {
585+ TRACK_V8_FAST_API_CALL ( " histogram.exceeds " );
588586 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
589587 return static_cast <double >((*histogram)->Exceeds ());
590588}
591589
592- double HistogramImpl::FastGetStddev (Local<Value> unused,
593- Local<Value> receiver) {
590+ double HistogramImpl::FastGetStddev (Local<Value> receiver) {
591+ TRACK_V8_FAST_API_CALL ( " histogram.stddev " );
594592 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
595593 return (*histogram)->Stddev ();
596594}
597595
598- double HistogramImpl::FastGetPercentile (Local<Value> unused,
599- Local<Value> receiver,
596+ double HistogramImpl::FastGetPercentile (Local<Value> receiver,
600597 const double percentile) {
598+ TRACK_V8_FAST_API_CALL (" histogram.percentile" );
601599 HistogramImpl* histogram = HistogramImpl::FromJSObject (receiver);
602600 return static_cast <double >((*histogram)->Percentile (percentile));
603601}
0 commit comments