Commit 0c19621 2 people authored and committed
1 parent f5494fa commit 0c19621 Copy full SHA for 0c19621
File tree 2 files changed +9
-10
lines changed
2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -168,15 +168,13 @@ bool AsyncHooks::pop_async_context(double async_id) {
168
168
}
169
169
170
170
void AsyncHooks::clear_async_id_stack () {
171
- if (env ()->can_call_into_js ()) {
171
+ if (!js_execution_async_resources_. IsEmpty () && env ()->can_call_into_js ()) {
172
172
Isolate* isolate = env ()->isolate ();
173
173
HandleScope handle_scope (isolate);
174
- if (!js_execution_async_resources_.IsEmpty ()) {
175
- USE (PersistentToLocal::Strong (js_execution_async_resources_)
176
- ->Set (env ()->context (),
177
- env ()->length_string (),
178
- Integer::NewFromUnsigned (isolate, 0 )));
179
- }
174
+ USE (PersistentToLocal::Strong (js_execution_async_resources_)
175
+ ->Set (env ()->context (),
176
+ env ()->length_string (),
177
+ Integer::NewFromUnsigned (isolate, 0 )));
180
178
}
181
179
182
180
native_execution_async_resources_.clear ();
Original file line number Diff line number Diff line change @@ -969,6 +969,10 @@ class Environment : public MemoryRetainer {
969
969
uv_async_t task_queues_async_;
970
970
int64_t task_queues_async_refs_ = 0 ;
971
971
972
+ // These may be read by ctors and should be listed before complex fields.
973
+ std::atomic_bool is_stopping_{false };
974
+ std::atomic_bool can_call_into_js_{true };
975
+
972
976
AsyncHooks async_hooks_;
973
977
ImmediateInfo immediate_info_;
974
978
AliasedInt32Array timeout_info_;
@@ -1034,7 +1038,6 @@ class Environment : public MemoryRetainer {
1034
1038
1035
1039
bool has_serialized_options_ = false ;
1036
1040
1037
- std::atomic_bool can_call_into_js_ { true };
1038
1041
uint64_t flags_;
1039
1042
uint64_t thread_id_;
1040
1043
std::unordered_set<worker::Worker*> sub_worker_contexts_;
@@ -1092,8 +1095,6 @@ class Environment : public MemoryRetainer {
1092
1095
CleanupQueue cleanup_queue_;
1093
1096
bool started_cleanup_ = false ;
1094
1097
1095
- std::atomic_bool is_stopping_ { false };
1096
-
1097
1098
std::unordered_set<int > unmanaged_fds_;
1098
1099
1099
1100
std::function<void (Environment*, int )> process_exit_handler_ {
You can’t perform that action at this time.
0 commit comments