summaryrefslogtreecommitdiff
path: root/src/node_perf.cc
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-21 13:47:30 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-04-26 14:23:31 +0800
commit0ae46a7a862e26ccd611aed4d189a5e480639a4c (patch)
tree9b37a35a1e512b1c09c6e8f45ab3a45d3e67c43b /src/node_perf.cc
parent5fe4d5966fd9c2b30b3da3ec7cb47132aa8cdfdd (diff)
downloadandroid-node-v8-0ae46a7a862e26ccd611aed4d189a5e480639a4c.tar.gz
android-node-v8-0ae46a7a862e26ccd611aed4d189a5e480639a4c.tar.bz2
android-node-v8-0ae46a7a862e26ccd611aed4d189a5e480639a4c.zip
src: use predefined AliasedBuffer types in the code base
Instead of allowing the callers to instantiate the template with any numeric types (such as aliasing a Uint8Array to double[]), predefine types that make sense and use those instead. PR-URL: https://github.com/nodejs/node/pull/27334 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_perf.cc')
-rw-r--r--src/node_perf.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/node_perf.cc b/src/node_perf.cc
index b9e1c0cb9c..8f982049c7 100644
--- a/src/node_perf.cc
+++ b/src/node_perf.cc
@@ -114,8 +114,7 @@ void PerformanceEntry::Notify(Environment* env,
PerformanceEntryType type,
Local<Value> object) {
Context::Scope scope(env->context());
- AliasedBuffer<uint32_t, Uint32Array>& observers =
- env->performance_state()->observers;
+ AliasedUint32Array& observers = env->performance_state()->observers;
if (type != NODE_PERFORMANCE_ENTRY_TYPE_INVALID &&
observers[type]) {
node::MakeCallback(env->isolate(),
@@ -173,8 +172,7 @@ void Measure(const FunctionCallbackInfo<Value>& args) {
Utf8Value startMark(env->isolate(), args[1]);
Utf8Value endMark(env->isolate(), args[2]);
- AliasedBuffer<double, v8::Float64Array>& milestones =
- env->performance_state()->milestones;
+ AliasedFloat64Array& milestones = env->performance_state()->milestones;
uint64_t startTimestamp = timeOrigin;
uint64_t start = GetPerformanceMark(env, *startMark);
@@ -235,8 +233,7 @@ void PerformanceGCCallback(Environment* env, void* ptr) {
HandleScope scope(env->isolate());
Local<Context> context = env->context();
- AliasedBuffer<uint32_t, Uint32Array>& observers =
- env->performance_state()->observers;
+ AliasedUint32Array& observers = env->performance_state()->observers;
if (observers[NODE_PERFORMANCE_ENTRY_TYPE_GC]) {
Local<Object> obj;
if (!entry->ToObject().ToLocal(&obj)) return;
@@ -342,8 +339,7 @@ void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) {
return;
args.GetReturnValue().Set(ret.ToLocalChecked());
- AliasedBuffer<uint32_t, Uint32Array>& observers =
- env->performance_state()->observers;
+ AliasedUint32Array& observers = env->performance_state()->observers;
if (!observers[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION])
return;