| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1da2e8d commit 0022767
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const common = require('../common.js'); | ||
| 5 | + | ||
| 6 | + const { createHistogram } = require('perf_hooks'); | ||
| 7 | + | ||
| 8 | + const bench = common.createBenchmark(main, { | ||
| 9 | + n: [1e5], | ||
| 10 | + }); | ||
| 11 | + | ||
| 12 | + function main({ n }) { | ||
| 13 | + const histogram = createHistogram(); | ||
| 14 | + bench.start(); | ||
| 15 | + for (let i = 0; i < n; i++) { | ||
| 16 | + histogram.record(i + 1); | ||
| 17 | + /* eslint-disable no-unused-expressions */ | ||
| 18 | + histogram.max; | ||
| 19 | + histogram.mean; | ||
| 20 | + /* eslint-enable no-unused-expressions */ | ||
| 21 | + } | ||
| 22 | + bench.end(n); | ||
| 23 | + | ||
| 24 | + // Avoid V8 deadcode (elimination) | ||
| 25 | + assert.ok(histogram); | ||
| 26 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,9 @@ | |||
| 9 | 9 | namespace node { | |
| 10 | 10 | ||
| 11 | 11 | using v8::BigInt; | |
| 12 | + using v8::CFunction; | ||
| 12 | 13 | using v8::Context; | |
| 14 | + using v8::FastApiCallbackOptions; | ||
| 13 | 15 | using v8::FunctionCallbackInfo; | |
| 14 | 16 | using v8::FunctionTemplate; | |
| 15 | 17 | using v8::Integer; | |
@@ -42,7 +44,34 @@ HistogramImpl::HistogramImpl(const Histogram::Options& options) | |||
| 42 | 44 | HistogramImpl::HistogramImpl(std::shared_ptr<Histogram> histogram) | |
| 43 | 45 | : histogram_(std::move(histogram)) {} | |
| 44 | 46 | ||
| 47 | + CFunction HistogramImpl::fast_reset_( | ||
| 48 | + CFunction::Make(&HistogramImpl::FastReset)); | ||
| 49 | + CFunction HistogramImpl::fast_get_count_( | ||
| 50 | + CFunction::Make(&HistogramImpl::FastGetCount)); | ||
| 51 | + CFunction HistogramImpl::fast_get_min_( | ||
| 52 | + CFunction::Make(&HistogramImpl::FastGetMin)); | ||
| 53 | + CFunction HistogramImpl::fast_get_max_( | ||
| 54 | + CFunction::Make(&HistogramImpl::FastGetMax)); | ||
| 55 | + CFunction HistogramImpl::fast_get_mean_( | ||
| 56 | + CFunction::Make(&HistogramImpl::FastGetMean)); | ||
| 57 | + CFunction HistogramImpl::fast_get_exceeds_( | ||
| 58 | + CFunction::Make(&HistogramImpl::FastGetExceeds)); | ||
| 59 | + CFunction HistogramImpl::fast_get_stddev_( | ||
| 60 | + CFunction::Make(&HistogramImpl::FastGetStddev)); | ||
| 61 | + CFunction HistogramImpl::fast_get_percentile_( | ||
| 62 | + CFunction::Make(&HistogramImpl::FastGetPercentile)); | ||
| 63 | + CFunction HistogramBase::fast_record_( | ||
| 64 | + CFunction::Make(&HistogramBase::FastRecord)); | ||
| 65 | + CFunction HistogramBase::fast_record_delta_( | ||
| 66 | + CFunction::Make(&HistogramBase::FastRecordDelta)); | ||
| 67 | + CFunction IntervalHistogram::fast_start_( | ||
| 68 | + CFunction::Make(&IntervalHistogram::FastStart)); | ||
| 69 | + CFunction IntervalHistogram::fast_stop_( | ||
| 70 | + CFunction::Make(&IntervalHistogram::FastStop)); | ||
| 71 | + | ||
| 45 | 72 | void HistogramImpl::AddMethods(Isolate* isolate, Local<FunctionTemplate> tmpl) { | |
| 73 | + // TODO(@jasnell): The bigint API variations do not yet support fast | ||
| 74 | + // variations since v8 will not return a bigint value from a fast method. | ||
| 46 | 75 | SetProtoMethodNoSideEffect(isolate, tmpl, "countBigInt", GetCountBigInt); | |
| 47 | 76 | SetProtoMethodNoSideEffect(isolate, tmpl, "exceedsBigInt", GetExceedsBigInt); | |
| 48 | 77 | SetProtoMethodNoSideEffect(isolate, tmpl, "minBigInt", GetMinBigInt); | |
@@ -52,14 +81,20 @@ void HistogramImpl::AddMethods(Isolate* isolate, Local<FunctionTemplate> tmpl) { | |||
| 52 | 81 | SetProtoMethodNoSideEffect(isolate, tmpl, "percentiles", GetPercentiles); | |
| 53 | 82 | SetProtoMethodNoSideEffect( | |
| 54 | 83 | isolate, tmpl, "percentilesBigInt", GetPercentilesBigInt); | |
| 55 | - SetProtoMethodNoSideEffect(isolate, tmpl, "count", GetCount); | ||
| 56 | - SetProtoMethodNoSideEffect(isolate, tmpl, "exceeds", GetExceeds); | ||
| 57 | - SetProtoMethodNoSideEffect(isolate, tmpl, "min", GetMin); | ||
| 58 | - SetProtoMethodNoSideEffect(isolate, tmpl, "max", GetMax); | ||
| 59 | - SetProtoMethodNoSideEffect(isolate, tmpl, "mean", GetMean); | ||
| 60 | - SetProtoMethodNoSideEffect(isolate, tmpl, "stddev", GetStddev); | ||
| 61 | - SetProtoMethodNoSideEffect(isolate, tmpl, "percentile", GetPercentile); | ||
| 62 | - SetProtoMethod(isolate, tmpl, "reset", DoReset); | ||
| 84 | + auto instance = tmpl->InstanceTemplate(); | ||
| 85 | + SetFastMethodNoSideEffect( | ||
| 86 | + isolate, instance, "count", GetCount, &fast_get_count_); | ||
| 87 | + SetFastMethodNoSideEffect( | ||
| 88 | + isolate, instance, "exceeds", GetExceeds, &fast_get_exceeds_); | ||
| 89 | + SetFastMethodNoSideEffect(isolate, instance, "min", GetMin, &fast_get_min_); | ||
| 90 | + SetFastMethodNoSideEffect(isolate, instance, "max", GetMax, &fast_get_max_); | ||
| 91 | + SetFastMethodNoSideEffect( | ||
| 92 | + isolate, instance, "mean", GetMean, &fast_get_mean_); | ||
| 93 | + SetFastMethodNoSideEffect( | ||
| 94 | + isolate, instance, "stddev", GetStddev, &fast_get_stddev_); | ||
| 95 | + SetFastMethodNoSideEffect( | ||
| 96 | + isolate, instance, "percentile", GetPercentile, &fast_get_percentile_); | ||
| 97 | + SetFastMethod(isolate, instance, "reset", DoReset, &fast_reset_); | ||
| 63 | 98 | } | |
| 64 | 99 | ||
| 65 | 100 | void HistogramImpl::RegisterExternalReferences( | |
@@ -81,6 +116,22 @@ void HistogramImpl::RegisterExternalReferences( | |||
| 81 | 116 | registry->Register(GetPercentiles); | |
| 82 | 117 | registry->Register(GetPercentilesBigInt); | |
| 83 | 118 | registry->Register(DoReset); | |
| 119 | + registry->Register(fast_reset_.GetTypeInfo()); | ||
| 120 | + registry->Register(fast_get_count_.GetTypeInfo()); | ||
| 121 | + registry->Register(fast_get_min_.GetTypeInfo()); | ||
| 122 | + registry->Register(fast_get_max_.GetTypeInfo()); | ||
| 123 | + registry->Register(fast_get_mean_.GetTypeInfo()); | ||
| 124 | + registry->Register(fast_get_exceeds_.GetTypeInfo()); | ||
| 125 | + registry->Register(fast_get_stddev_.GetTypeInfo()); | ||
| 126 | + registry->Register(fast_get_percentile_.GetTypeInfo()); | ||
| 127 | + registry->Register(FastReset); | ||
| 128 | + registry->Register(FastGetCount); | ||
| 129 | + registry->Register(FastGetMin); | ||
| 130 | + registry->Register(FastGetMax); | ||
| 131 | + registry->Register(FastGetMean); | ||
| 132 | + registry->Register(FastGetExceeds); | ||
| 133 | + registry->Register(FastGetStddev); | ||
| 134 | + registry->Register(FastGetPercentile); | ||
| 84 | 135 | is_registerd = true; | |
| 85 | 136 | } | |
| 86 | 137 | ||
@@ -118,6 +169,12 @@ void HistogramBase::RecordDelta(const FunctionCallbackInfo<Value>& args) { | |||
| 118 | 169 | (*histogram)->RecordDelta(); | |
| 119 | 170 | } | |
| 120 | 171 | ||
| 172 | + void HistogramBase::FastRecordDelta(Local<Value> receiver) { | ||
| 173 | + HistogramBase* histogram; | ||
| 174 | + ASSIGN_OR_RETURN_UNWRAP(&histogram, receiver); | ||
| 175 | + (*histogram)->RecordDelta(); | ||
| 176 | + } | ||
| 177 | + | ||
| 121 | 178 | void HistogramBase::Record(const FunctionCallbackInfo<Value>& args) { | |
| 122 | 179 | Environment* env = Environment::GetCurrent(args); | |
| 123 | 180 | CHECK_IMPLIES(!args[0]->IsNumber(), args[0]->IsBigInt()); | |
@@ -132,6 +189,18 @@ void HistogramBase::Record(const FunctionCallbackInfo<Value>& args) { | |||
| 132 | 189 | (*histogram)->Record(value); | |
| 133 | 190 | } | |
| 134 | 191 | ||
| 192 | + void HistogramBase::FastRecord(Local<Value> receiver, | ||
| 193 | + const int64_t value, | ||
| 194 | + FastApiCallbackOptions& options) { | ||
| 195 | + if (value < 1) { | ||
| 196 | + options.fallback = true; | ||
| 197 | + return; | ||
| 198 | + } | ||
| 199 | + HistogramBase* histogram; | ||
| 200 | + ASSIGN_OR_RETURN_UNWRAP(&histogram, receiver); | ||
| 201 | + (*histogram)->Record(value); | ||
| 202 | + } | ||
| 203 | + | ||
| 135 | 204 | void HistogramBase::Add(const FunctionCallbackInfo<Value>& args) { | |
| 136 | 205 | Environment* env = Environment::GetCurrent(args); | |
| 137 | 206 | HistogramBase* histogram; | |
@@ -213,8 +282,9 @@ Local<FunctionTemplate> HistogramBase::GetConstructorTemplate( | |||
| 213 | 282 | tmpl->SetClassName(classname); | |
| 214 | 283 | auto instance = tmpl->InstanceTemplate(); | |
| 215 | 284 | instance->SetInternalFieldCount(HistogramImpl::kInternalFieldCount); | |
| 216 | - SetProtoMethod(isolate, tmpl, "record", Record); | ||
| 217 | - SetProtoMethod(isolate, tmpl, "recordDelta", RecordDelta); | ||
| 285 | + SetFastMethod(isolate, instance, "record", Record, &fast_record_); | ||
| 286 | + SetFastMethod( | ||
| 287 | + isolate, instance, "recordDelta", RecordDelta, &fast_record_delta_); | ||
| 218 | 288 | SetProtoMethod(isolate, tmpl, "add", Add); | |
| 219 | 289 | HistogramImpl::AddMethods(isolate, tmpl); | |
| 220 | 290 | isolate_data->set_histogram_ctor_template(tmpl); | |
@@ -228,6 +298,10 @@ void HistogramBase::RegisterExternalReferences( | |||
| 228 | 298 | registry->Register(Add); | |
| 229 | 299 | registry->Register(Record); | |
| 230 | 300 | registry->Register(RecordDelta); | |
| 301 | + registry->Register(fast_record_.GetTypeInfo()); | ||
| 302 | + registry->Register(fast_record_delta_.GetTypeInfo()); | ||
| 303 | + registry->Register(FastRecord); | ||
| 304 | + registry->Register(FastRecordDelta); | ||
| 231 | 305 | HistogramImpl::RegisterExternalReferences(registry); | |
| 232 | 306 | } | |
| 233 | 307 | ||
@@ -264,11 +338,11 @@ Local<FunctionTemplate> IntervalHistogram::GetConstructorTemplate( | |||
| 264 | 338 | tmpl = NewFunctionTemplate(isolate, nullptr); | |
| 265 | 339 | tmpl->Inherit(HandleWrap::GetConstructorTemplate(env)); | |
| 266 | 340 | tmpl->SetClassName(OneByteString(isolate, "Histogram")); | |
| 267 | - tmpl->InstanceTemplate()->SetInternalFieldCount( | ||
| 268 | - HistogramImpl::kInternalFieldCount); | ||
| 341 | + auto instance = tmpl->InstanceTemplate(); | ||
| 342 | + instance->SetInternalFieldCount(HistogramImpl::kInternalFieldCount); | ||
| 269 | 343 | HistogramImpl::AddMethods(isolate, tmpl); | |
| 270 | - SetProtoMethod(isolate, tmpl, "start", Start); | ||
| 271 | - SetProtoMethod(isolate, tmpl, "stop", Stop); | ||
| 344 | + SetFastMethod(isolate, instance, "start", Start, &fast_start_); | ||
| 345 | + SetFastMethod(isolate, instance, "stop", Stop, &fast_stop_); | ||
| 272 | 346 | env->set_intervalhistogram_constructor_template(tmpl); | |
| 273 | 347 | } | |
| 274 | 348 | return tmpl; | |
@@ -278,6 +352,10 @@ void IntervalHistogram::RegisterExternalReferences( | |||
| 278 | 352 | ExternalReferenceRegistry* registry) { | |
| 279 | 353 | registry->Register(Start); | |
| 280 | 354 | registry->Register(Stop); | |
| 355 | + registry->Register(fast_start_.GetTypeInfo()); | ||
| 356 | + registry->Register(fast_stop_.GetTypeInfo()); | ||
| 357 | + registry->Register(FastStart); | ||
| 358 | + registry->Register(FastStop); | ||
| 281 | 359 | HistogramImpl::RegisterExternalReferences(registry); | |
| 282 | 360 | } | |
| 283 | 361 | ||
@@ -358,12 +436,24 @@ void IntervalHistogram::Start(const FunctionCallbackInfo<Value>& args) { | |||
| 358 | 436 | histogram->OnStart(args[0]->IsTrue() ? StartFlags::RESET : StartFlags::NONE); | |
| 359 | 437 | } | |
| 360 | 438 | ||
| 439 | + void IntervalHistogram::FastStart(Local<Value> receiver, bool reset) { | ||
| 440 | + IntervalHistogram* histogram; | ||
| 441 | + ASSIGN_OR_RETURN_UNWRAP(&histogram, receiver); | ||
| 442 | + histogram->OnStart(reset ? StartFlags::RESET : StartFlags::NONE); | ||
| 443 | + } | ||
| 444 | + | ||
| 361 | 445 | void IntervalHistogram::Stop(const FunctionCallbackInfo<Value>& args) { | |
| 362 | 446 | IntervalHistogram* histogram; | |
| 363 | 447 | ASSIGN_OR_RETURN_UNWRAP(&histogram, args.Holder()); | |
| 364 | 448 | histogram->OnStop(); | |
| 365 | 449 | } | |
| 366 | 450 | ||
| 451 | + void IntervalHistogram::FastStop(Local<Value> receiver) { | ||
| 452 | + IntervalHistogram* histogram; | ||
| 453 | + ASSIGN_OR_RETURN_UNWRAP(&histogram, receiver); | ||
| 454 | + histogram->OnStop(); | ||
| 455 | + } | ||
| 456 | + | ||
| 367 | 457 | void HistogramImpl::GetCount(const FunctionCallbackInfo<Value>& args) { | |
| 368 | 458 | HistogramImpl* histogram = HistogramImpl::FromJSObject(args.Holder()); | |
| 369 | 459 | double value = static_cast<double>((*histogram)->Count()); | |
@@ -474,6 +564,47 @@ void HistogramImpl::DoReset(const FunctionCallbackInfo<Value>& args) { | |||
| 474 | 564 | (*histogram)->Reset(); | |
| 475 | 565 | } | |
| 476 | 566 | ||
| 567 | + void HistogramImpl::FastReset(Local<Value> receiver) { | ||
| 568 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 569 | + (*histogram)->Reset(); | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + double HistogramImpl::FastGetCount(Local<Value> receiver) { | ||
| 573 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 574 | + return static_cast<double>((*histogram)->Count()); | ||
| 575 | + } | ||
| 576 | + | ||
| 577 | + double HistogramImpl::FastGetMin(Local<Value> receiver) { | ||
| 578 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 579 | + return static_cast<double>((*histogram)->Min()); | ||
| 580 | + } | ||
| 581 | + | ||
| 582 | + double HistogramImpl::FastGetMax(Local<Value> receiver) { | ||
| 583 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 584 | + return static_cast<double>((*histogram)->Max()); | ||
| 585 | + } | ||
| 586 | + | ||
| 587 | + double HistogramImpl::FastGetMean(Local<Value> receiver) { | ||
| 588 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 589 | + return (*histogram)->Mean(); | ||
| 590 | + } | ||
| 591 | + | ||
| 592 | + double HistogramImpl::FastGetExceeds(Local<Value> receiver) { | ||
| 593 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 594 | + return static_cast<double>((*histogram)->Exceeds()); | ||
| 595 | + } | ||
| 596 | + | ||
| 597 | + double HistogramImpl::FastGetStddev(Local<Value> receiver) { | ||
| 598 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 599 | + return (*histogram)->Stddev(); | ||
| 600 | + } | ||
| 601 | + | ||
| 602 | + double HistogramImpl::FastGetPercentile(Local<Value> receiver, | ||
| 603 | + const double percentile) { | ||
| 604 | + HistogramImpl* histogram = HistogramImpl::FromJSObject(receiver); | ||
| 605 | + return static_cast<double>((*histogram)->Percentile(percentile)); | ||
| 606 | + } | ||
| 607 | + | ||
| 477 | 608 | HistogramImpl* HistogramImpl::FromJSObject(Local<Value> value) { | |
| 478 | 609 | auto obj = value.As<Object>(); | |
| 479 | 610 | DCHECK_GE(obj->InternalFieldCount(), HistogramImpl::kInternalFieldCount); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -101,6 +101,16 @@ class HistogramImpl { | |||
| 101 | 101 | static void GetPercentilesBigInt( | |
| 102 | 102 | const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 103 | 103 | ||
| 104 | + static void FastReset(v8::Local<v8::Value> receiver); | ||
| 105 | + static double FastGetCount(v8::Local<v8::Value> receiver); | ||
| 106 | + static double FastGetMin(v8::Local<v8::Value> receiver); | ||
| 107 | + static double FastGetMax(v8::Local<v8::Value> receiver); | ||
| 108 | + static double FastGetMean(v8::Local<v8::Value> receiver); | ||
| 109 | + static double FastGetExceeds(v8::Local<v8::Value> receiver); | ||
| 110 | + static double FastGetStddev(v8::Local<v8::Value> receiver); | ||
| 111 | + static double FastGetPercentile(v8::Local<v8::Value> receiver, | ||
| 112 | + const double percentile); | ||
| 113 | + | ||
| 104 | 114 | static void AddMethods(v8::Isolate* isolate, | |
| 105 | 115 | v8::Local<v8::FunctionTemplate> tmpl); | |
| 106 | 116 | ||
@@ -110,6 +120,15 @@ class HistogramImpl { | |||
| 110 | 120 | ||
| 111 | 121 | private: | |
| 112 | 122 | std::shared_ptr<Histogram> histogram_; | |
| 123 | + | ||
| 124 | + static v8::CFunction fast_reset_; | ||
| 125 | + static v8::CFunction fast_get_count_; | ||
| 126 | + static v8::CFunction fast_get_min_; | ||
| 127 | + static v8::CFunction fast_get_max_; | ||
| 128 | + static v8::CFunction fast_get_mean_; | ||
| 129 | + static v8::CFunction fast_get_exceeds_; | ||
| 130 | + static v8::CFunction fast_get_stddev_; | ||
| 131 | + static v8::CFunction fast_get_percentile_; | ||
| 113 | 132 | }; | |
| 114 | 133 | ||
| 115 | 134 | class HistogramBase final : public BaseObject, public HistogramImpl { | |
@@ -138,6 +157,12 @@ class HistogramBase final : public BaseObject, public HistogramImpl { | |||
| 138 | 157 | static void RecordDelta(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 139 | 158 | static void Add(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 140 | 159 | ||
| 160 | + static void FastRecord( | ||
| 161 | + v8::Local<v8::Value> receiver, | ||
| 162 | + const int64_t value, | ||
| 163 | + v8::FastApiCallbackOptions& options); // NOLINT(runtime/references) | ||
| 164 | + static void FastRecordDelta(v8::Local<v8::Value> receiver); | ||
| 165 | + | ||
| 141 | 166 | HistogramBase( | |
| 142 | 167 | Environment* env, | |
| 143 | 168 | v8::Local<v8::Object> wrap, | |
@@ -173,6 +198,10 @@ class HistogramBase final : public BaseObject, public HistogramImpl { | |||
| 173 | 198 | private: | |
| 174 | 199 | std::shared_ptr<Histogram> histogram_; | |
| 175 | 200 | }; | |
| 201 | + | ||
| 202 | + private: | ||
| 203 | + static v8::CFunction fast_record_; | ||
| 204 | + static v8::CFunction fast_record_delta_; | ||
| 176 | 205 | }; | |
| 177 | 206 | ||
| 178 | 207 | class IntervalHistogram final : public HandleWrap, public HistogramImpl { | |
@@ -204,6 +233,9 @@ class IntervalHistogram final : public HandleWrap, public HistogramImpl { | |||
| 204 | 233 | static void Start(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 205 | 234 | static void Stop(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 206 | 235 | ||
| 236 | + static void FastStart(v8::Local<v8::Value> receiver, bool reset); | ||
| 237 | + static void FastStop(v8::Local<v8::Value> receiver); | ||
| 238 | + | ||
| 207 | 239 | TransferMode GetTransferMode() const override { | |
| 208 | 240 | return TransferMode::kCloneable; | |
| 209 | 241 | } | |
@@ -222,6 +254,9 @@ class IntervalHistogram final : public HandleWrap, public HistogramImpl { | |||
| 222 | 254 | int32_t interval_ = 0; | |
| 223 | 255 | std::function<void(Histogram&)> on_interval_; | |
| 224 | 256 | uv_timer_t timer_; | |
| 257 | + | ||
| 258 | + static v8::CFunction fast_start_; | ||
| 259 | + static v8::CFunction fast_stop_; | ||
| 225 | 260 | }; | |
| 226 | 261 | ||
| 227 | 262 | } // namespace node | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,12 @@ using CFunctionCallbackWithStrings = | |||
| 29 | 29 | const v8::FastOneByteString& base); | |
| 30 | 30 | using CFunctionWithUint32 = uint32_t (*)(v8::Local<v8::Value>, | |
| 31 | 31 | const uint32_t input); | |
| 32 | + using CFunctionWithDoubleReturnDouble = double (*)(v8::Local<v8::Value>, | ||
| 33 | + const double); | ||
| 34 | + using CFunctionWithInt64Fallback = void (*)(v8::Local<v8::Value>, | ||
| 35 | + const int64_t, | ||
| 36 | + v8::FastApiCallbackOptions&); | ||
| 37 | + using CFunctionWithBool = void (*)(v8::Local<v8::Value>, bool); | ||
| 32 | 38 | ||
| 33 | 39 | // This class manages the external references from the V8 heap | |
| 34 | 40 | // to the C++ addresses in Node.js. | |
@@ -46,6 +52,9 @@ class ExternalReferenceRegistry { | |||
| 46 | 52 | V(CFunctionCallbackWithString) \ | |
| 47 | 53 | V(CFunctionCallbackWithStrings) \ | |
| 48 | 54 | V(CFunctionWithUint32) \ | |
| 55 | + V(CFunctionWithDoubleReturnDouble) \ | ||
| 56 | + V(CFunctionWithInt64Fallback) \ | ||
| 57 | + V(CFunctionWithBool) \ | ||
| 49 | 58 | V(const v8::CFunctionInfo*) \ | |
| 50 | 59 | V(v8::FunctionCallback) \ | |
| 51 | 60 | V(v8::AccessorGetterCallback) \ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments