Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 44a1993

Browse filesBrowse files
addaleaxMylesBorins
authored andcommitted
src: avoid extra Persistent in DefaultTriggerAsyncIdScope
Instead of getting a reference to the main `AliasedBuffer`, which would always unnecesarily allocate and destroy a `Persistent` handle, store and use a reference to the owning object. PR-URL: #23844 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent 72d2d2c commit 44a1993
Copy full SHA for 44a1993

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,20 @@ inline void Environment::AsyncHooks::clear_async_id_stack() {
186186
inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
187187
::DefaultTriggerAsyncIdScope(Environment* env,
188188
double default_trigger_async_id)
189-
: async_id_fields_ref_(env->async_hooks()->async_id_fields()) {
189+
: async_hooks_(env->async_hooks()) {
190190
if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) {
191191
CHECK_GE(default_trigger_async_id, 0);
192192
}
193193

194194
old_default_trigger_async_id_ =
195-
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId];
196-
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] =
195+
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId];
196+
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
197197
default_trigger_async_id;
198198
}
199199

200200
inline Environment::AsyncHooks::DefaultTriggerAsyncIdScope
201201
::~DefaultTriggerAsyncIdScope() {
202-
async_id_fields_ref_[AsyncHooks::kDefaultTriggerAsyncId] =
202+
async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
203203
old_default_trigger_async_id_;
204204
}
205205

Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ class Environment {
482482
~DefaultTriggerAsyncIdScope();
483483

484484
private:
485-
AliasedBuffer<double, v8::Float64Array> async_id_fields_ref_;
485+
AsyncHooks* async_hooks_;
486486
double old_default_trigger_async_id_;
487487

488488
DISALLOW_COPY_AND_ASSIGN(DefaultTriggerAsyncIdScope);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.