GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/env-inl.h Lines: 628 637 98.6 %
Date: 2021-01-16 04:10:54 Branches: 98 136 72.1 %

Line Branch Exec Source
1
// Copyright Joyent, Inc. and other Node contributors.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a
4
// copy of this software and associated documentation files (the
5
// "Software"), to deal in the Software without restriction, including
6
// without limitation the rights to use, copy, modify, merge, publish,
7
// distribute, sublicense, and/or sell copies of the Software, and to permit
8
// persons to whom the Software is furnished to do so, subject to the
9
// following conditions:
10
//
11
// The above copyright notice and this permission notice shall be included
12
// in all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22
#ifndef SRC_ENV_INL_H_
23
#define SRC_ENV_INL_H_
24
25
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
27
#include "aliased_buffer.h"
28
#include "callback_queue-inl.h"
29
#include "env.h"
30
#include "node.h"
31
#include "util-inl.h"
32
#include "uv.h"
33
#include "v8.h"
34
#include "node_perf_common.h"
35
#include "node_context_data.h"
36
37
#include <cstddef>
38
#include <cstdint>
39
40
#include <utility>
41
42
namespace node {
43
44
inline v8::Isolate* IsolateData::isolate() const {
45
  return isolate_;
46
}
47
48
820502
inline uv_loop_t* IsolateData::event_loop() const {
49
820502
  return event_loop_;
50
}
51
52
654477
inline NodeArrayBufferAllocator* IsolateData::node_allocator() const {
53
654477
  return node_allocator_;
54
}
55
56
27802
inline MultiIsolatePlatform* IsolateData::platform() const {
57
27802
  return platform_;
58
}
59
60
400
inline void IsolateData::set_worker_context(worker::Worker* context) {
61
400
  CHECK_NULL(worker_context_);  // Should be set only once.
62
400
  worker_context_ = context;
63
400
}
64
65
11940
inline worker::Worker* IsolateData::worker_context() const {
66
11940
  return worker_context_;
67
}
68
69
215842
inline v8::Local<v8::String> IsolateData::async_wrap_provider(int index) const {
70
431684
  return async_wrap_providers_[index].Get(isolate_);
71
}
72
73
4403629
inline AliasedUint32Array& AsyncHooks::fields() {
74
4403629
  return fields_;
75
}
76
77
2494814
inline AliasedFloat64Array& AsyncHooks::async_id_fields() {
78
2494814
  return async_id_fields_;
79
}
80
81
439
inline AliasedFloat64Array& AsyncHooks::async_ids_stack() {
82
439
  return async_ids_stack_;
83
}
84
85
1343012
v8::Local<v8::Array> AsyncHooks::js_execution_async_resources() {
86
2686024
  if (UNLIKELY(js_execution_async_resources_.IsEmpty())) {
87
439
    js_execution_async_resources_.Reset(
88
878
        env()->isolate(), v8::Array::New(env()->isolate()));
89
  }
90
1343012
  return PersistentToLocal::Strong(js_execution_async_resources_);
91
}
92
93
278
v8::Local<v8::Object> AsyncHooks::native_execution_async_resource(size_t i) {
94
278
  if (i >= native_execution_async_resources_.size()) return {};
95
278
  return PersistentToLocal::Strong(native_execution_async_resources_[i]);
96
}
97
98
215354
inline v8::Local<v8::String> AsyncHooks::provider_string(int idx) {
99
215354
  return env()->isolate_data()->async_wrap_provider(idx);
100
}
101
102
1
inline void AsyncHooks::no_force_checks() {
103
1
  fields_[kCheck] -= 1;
104
1
}
105
106
1831344
inline Environment* AsyncHooks::env() {
107
1831344
  return Environment::ForAsyncHooks(this);
108
}
109
110
// Remember to keep this code aligned with pushAsyncContext() in JS.
111
1255142
inline void AsyncHooks::push_async_context(double async_id,
112
                                           double trigger_async_id,
113
                                           v8::Local<v8::Object> resource) {
114
  // Since async_hooks is experimental, do only perform the check
115
  // when async_hooks is enabled.
116
1255142
  if (fields_[kCheck] > 0) {
117
1255105
    CHECK_GE(async_id, -1);
118
1255105
    CHECK_GE(trigger_async_id, -1);
119
  }
120
121
1255133
  uint32_t offset = fields_[kStackLength];
122
1255051
  if (offset * 2 >= async_ids_stack_.Length())
123
10
    grow_async_ids_stack();
124
1255046
  async_ids_stack_[2 * offset] = async_id_fields_[kExecutionAsyncId];
125
1255051
  async_ids_stack_[2 * offset + 1] = async_id_fields_[kTriggerAsyncId];
126
1255050
  fields_[kStackLength] += 1;
127
1255035
  async_id_fields_[kExecutionAsyncId] = async_id;
128
1255028
  async_id_fields_[kTriggerAsyncId] = trigger_async_id;
129
130
#ifdef DEBUG
131
  for (uint32_t i = offset; i < native_execution_async_resources_.size(); i++)
132
    CHECK(native_execution_async_resources_[i].IsEmpty());
133
#endif
134
135
  // When this call comes from JS (as a way of increasing the stack size),
136
  // `resource` will be empty, because JS caches these values anyway, and
137
  // we should avoid creating strong global references that might keep
138
  // these JS resource objects alive longer than necessary.
139
1254994
  if (!resource.IsEmpty()) {
140
1255000
    native_execution_async_resources_.resize(offset + 1);
141
1254884
    native_execution_async_resources_[offset].Reset(env()->isolate(), resource);
142
  }
143
1255073
}
144
145
// Remember to keep this code aligned with popAsyncContext() in JS.
146
1254531
inline bool AsyncHooks::pop_async_context(double async_id) {
147
  // In case of an exception then this may have already been reset, if the
148
  // stack was multiple MakeCallback()'s deep.
149
1254531
  if (fields_[kStackLength] == 0) return false;
150
151
  // Ask for the async_id to be restored as a check that the stack
152
  // hasn't been corrupted.
153
  // Since async_hooks is experimental, do only perform the check
154
  // when async_hooks is enabled.
155

1253473
  if (fields_[kCheck] > 0 && async_id_fields_[kExecutionAsyncId] != async_id) {
156
4
    fprintf(stderr,
157
            "Error: async hook stack has become corrupted ("
158
            "actual: %.f, expected: %.f)\n",
159
            async_id_fields_.GetValue(kExecutionAsyncId),
160
4
            async_id);
161
4
    DumpBacktrace(stderr);
162
4
    fflush(stderr);
163
4
    if (!env()->abort_on_uncaught_exception())
164
4
      exit(1);
165
    fprintf(stderr, "\n");
166
    fflush(stderr);
167
    ABORT_NO_BACKTRACE();
168
  }
169
170
1253497
  uint32_t offset = fields_[kStackLength] - 1;
171
1253494
  async_id_fields_[kExecutionAsyncId] = async_ids_stack_[2 * offset];
172
1253578
  async_id_fields_[kTriggerAsyncId] = async_ids_stack_[2 * offset + 1];
173
1253585
  fields_[kStackLength] = offset;
174
175

2507133
  if (LIKELY(offset < native_execution_async_resources_.size() &&
176
             !native_execution_async_resources_[offset].IsEmpty())) {
177
#ifdef DEBUG
178
    for (uint32_t i = offset + 1;
179
         i < native_execution_async_resources_.size();
180
         i++) {
181
      CHECK(native_execution_async_resources_[i].IsEmpty());
182
    }
183
#endif
184
1253547
    native_execution_async_resources_.resize(offset);
185
2506990
    if (native_execution_async_resources_.size() <
186

1479298
            native_execution_async_resources_.capacity() / 2 &&
187
225806
        native_execution_async_resources_.size() > 16) {
188
      native_execution_async_resources_.shrink_to_fit();
189
    }
190
  }
191
192
2506974
  if (UNLIKELY(js_execution_async_resources()->Length() > offset)) {
193
178174
    v8::HandleScope handle_scope(env()->isolate());
194
267261
    USE(js_execution_async_resources()->Set(
195
        env()->context(),
196
        env()->length_string(),
197
445435
        v8::Integer::NewFromUnsigned(env()->isolate(), offset)));
198
  }
199
200
1253488
  return fields_[kStackLength] > 0;
201
}
202
203
1713
void AsyncHooks::clear_async_id_stack() {
204
1713
  v8::Isolate* isolate = env()->isolate();
205
3426
  v8::HandleScope handle_scope(isolate);
206
3426
  if (!js_execution_async_resources_.IsEmpty()) {
207
3822
    USE(PersistentToLocal::Strong(js_execution_async_resources_)->Set(
208
        env()->context(),
209
        env()->length_string(),
210
6370
        v8::Integer::NewFromUnsigned(isolate, 0)));
211
  }
212
1713
  native_execution_async_resources_.clear();
213
1713
  native_execution_async_resources_.shrink_to_fit();
214
215
1713
  async_id_fields_[kExecutionAsyncId] = 0;
216
1713
  async_id_fields_[kTriggerAsyncId] = 0;
217
1713
  fields_[kStackLength] = 0;
218
1713
}
219
220
// The DefaultTriggerAsyncIdScope(AsyncWrap*) constructor is defined in
221
// async_wrap-inl.h to avoid a circular dependency.
222
223
511701
inline AsyncHooks::DefaultTriggerAsyncIdScope ::DefaultTriggerAsyncIdScope(
224
511701
    Environment* env, double default_trigger_async_id)
225
511701
    : async_hooks_(env->async_hooks()) {
226
511701
  if (env->async_hooks()->fields()[AsyncHooks::kCheck] > 0) {
227
511701
    CHECK_GE(default_trigger_async_id, 0);
228
  }
229
230
511701
  old_default_trigger_async_id_ =
231
1023402
    async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId];
232
511701
  async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
233
511701
    default_trigger_async_id;
234
511701
}
235
236
1023400
inline AsyncHooks::DefaultTriggerAsyncIdScope ::~DefaultTriggerAsyncIdScope() {
237
511700
  async_hooks_->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId] =
238
1023400
    old_default_trigger_async_id_;
239
511700
}
240
241
1831227
Environment* Environment::ForAsyncHooks(AsyncHooks* hooks) {
242
1831227
  return ContainerOf(&Environment::async_hooks_, hooks);
243
}
244
245
1243901
inline size_t Environment::async_callback_scope_depth() const {
246
1243901
  return async_callback_scope_depth_;
247
}
248
249
1254322
inline void Environment::PushAsyncCallbackScope() {
250
1254322
  async_callback_scope_depth_++;
251
1254322
}
252
253
1253827
inline void Environment::PopAsyncCallbackScope() {
254
1253827
  async_callback_scope_depth_--;
255
1253827
}
256
257
439
inline AliasedUint32Array& ImmediateInfo::fields() {
258
439
  return fields_;
259
}
260
261
475292
inline uint32_t ImmediateInfo::count() const {
262
475292
  return fields_[kCount];
263
}
264
265
627305
inline uint32_t ImmediateInfo::ref_count() const {
266
627305
  return fields_[kRefCount];
267
}
268
269
106613
inline bool ImmediateInfo::has_outstanding() const {
270
106613
  return fields_[kHasOutstanding] == 1;
271
}
272
273
33235
inline void ImmediateInfo::ref_count_inc(uint32_t increment) {
274
33235
  fields_[kRefCount] += increment;
275
33235
}
276
277
488394
inline void ImmediateInfo::ref_count_dec(uint32_t decrement) {
278
488394
  fields_[kRefCount] -= decrement;
279
488402
}
280
281
439
inline AliasedUint8Array& TickInfo::fields() {
282
439
  return fields_;
283
}
284
285
2323912
inline bool TickInfo::has_tick_scheduled() const {
286
2323912
  return fields_[kHasTickScheduled] == 1;
287
}
288
289
750491
inline bool TickInfo::has_rejection_to_warn() const {
290
750491
  return fields_[kHasRejectionToWarn] == 1;
291
}
292
293
5549
inline void Environment::AssignToContext(v8::Local<v8::Context> context,
294
                                         const ContextInfo& info) {
295
5549
  context->SetAlignedPointerInEmbedderData(
296
5549
      ContextEmbedderIndex::kEnvironment, this);
297
  // Used by Environment::GetCurrent to know that we are on a node context.
298
11098
  context->SetAlignedPointerInEmbedderData(
299
5549
    ContextEmbedderIndex::kContextTag, Environment::kNodeContextTagPtr);
300
  // Used to retrieve bindings
301
5549
  context->SetAlignedPointerInEmbedderData(
302
11098
      ContextEmbedderIndex::kBindingListIndex, &(this->bindings_));
303
304
#if HAVE_INSPECTOR
305
5549
  inspector_agent()->ContextCreated(context, info);
306
#endif  // HAVE_INSPECTOR
307
5549
}
308
309
1289779
inline Environment* Environment::GetCurrent(v8::Isolate* isolate) {
310
1289779
  if (UNLIKELY(!isolate->InContext())) return nullptr;
311
2575924
  v8::HandleScope handle_scope(isolate);
312
1287886
  return GetCurrent(isolate->GetCurrentContext());
313
}
314
315
6352516
inline Environment* Environment::GetCurrent(v8::Local<v8::Context> context) {
316
6352516
  if (UNLIKELY(context.IsEmpty())) {
317
1
    return nullptr;
318
  }
319
6352515
  if (UNLIKELY(context->GetNumberOfEmbedderDataFields() <=
320
               ContextEmbedderIndex::kContextTag)) {
321
11
    return nullptr;
322
  }
323
12705364
  if (UNLIKELY(context->GetAlignedPointerFromEmbedderData(
324
                   ContextEmbedderIndex::kContextTag) !=
325
               Environment::kNodeContextTagPtr)) {
326
    return nullptr;
327
  }
328
  return static_cast<Environment*>(
329
6352682
      context->GetAlignedPointerFromEmbedderData(
330
6352682
          ContextEmbedderIndex::kEnvironment));
331
}
332
333
3694760
inline Environment* Environment::GetCurrent(
334
    const v8::FunctionCallbackInfo<v8::Value>& info) {
335
3694760
  return GetCurrent(info.GetIsolate()->GetCurrentContext());
336
}
337
338
template <typename T>
339
969633
inline Environment* Environment::GetCurrent(
340
    const v8::PropertyCallbackInfo<T>& info) {
341
969633
  return GetCurrent(info.GetIsolate()->GetCurrentContext());
342
}
343
344
template <typename T, typename U>
345
inline T* Environment::GetBindingData(const v8::PropertyCallbackInfo<U>& info) {
346
  return GetBindingData<T>(info.GetIsolate()->GetCurrentContext());
347
}
348
349
template <typename T>
350
645255
inline T* Environment::GetBindingData(
351
    const v8::FunctionCallbackInfo<v8::Value>& info) {
352
645255
  return GetBindingData<T>(info.GetIsolate()->GetCurrentContext());
353
}
354
355
template <typename T>
356
645257
inline T* Environment::GetBindingData(v8::Local<v8::Context> context) {
357
  BindingDataStore* map = static_cast<BindingDataStore*>(
358
645257
      context->GetAlignedPointerFromEmbedderData(
359
645257
          ContextEmbedderIndex::kBindingListIndex));
360
  DCHECK_NOT_NULL(map);
361
645257
  auto it = map->find(T::binding_data_name);
362
645258
  if (UNLIKELY(it == map->end())) return nullptr;
363
645257
  T* result = static_cast<T*>(it->second.get());
364
  DCHECK_NOT_NULL(result);
365
  DCHECK_EQ(result->env(), GetCurrent(context));
366
645256
  return result;
367
}
368
369
template <typename T>
370
6621
inline T* Environment::AddBindingData(
371
    v8::Local<v8::Context> context,
372
    v8::Local<v8::Object> target) {
373
  DCHECK_EQ(GetCurrent(context), this);
374
  // This won't compile if T is not a BaseObject subclass.
375
13242
  BaseObjectPtr<T> item = MakeDetachedBaseObject<T>(this, target);
376
  BindingDataStore* map = static_cast<BindingDataStore*>(
377
6621
      context->GetAlignedPointerFromEmbedderData(
378
6621
          ContextEmbedderIndex::kBindingListIndex));
379
  DCHECK_NOT_NULL(map);
380
6621
  auto result = map->emplace(T::binding_data_name, item);
381
6621
  CHECK(result.second);
382
  DCHECK_EQ(GetBindingData<T>(context), item.get());
383
13242
  return item.get();
384
}
385
386
28862142
inline v8::Isolate* Environment::isolate() const {
387
28862142
  return isolate_;
388
}
389
390
3890
inline Environment* Environment::from_timer_handle(uv_timer_t* handle) {
391
3890
  return ContainerOf(&Environment::timer_handle_, handle);
392
}
393
394
21259
inline uv_timer_t* Environment::timer_handle() {
395
21259
  return &timer_handle_;
396
}
397
398
475291
inline Environment* Environment::from_immediate_check_handle(
399
    uv_check_t* handle) {
400
475291
  return ContainerOf(&Environment::immediate_check_handle_, handle);
401
}
402
403
19956
inline uv_check_t* Environment::immediate_check_handle() {
404
19956
  return &immediate_check_handle_;
405
}
406
407
516974
inline uv_idle_t* Environment::immediate_idle_handle() {
408
516974
  return &immediate_idle_handle_;
409
}
410
411
19956
inline void Environment::RegisterHandleCleanup(uv_handle_t* handle,
412
                                               HandleCleanupCb cb,
413
                                               void* arg) {
414
19956
  handle_cleanup_queue_.push_back(HandleCleanup{handle, cb, arg});
415
19956
}
416
417
template <typename T, typename OnCloseCallback>
418
21740
inline void Environment::CloseHandle(T* handle, OnCloseCallback callback) {
419
21740
  handle_cleanup_waiting_++;
420
  static_assert(sizeof(T) >= sizeof(uv_handle_t), "T is a libuv handle");
421
  static_assert(offsetof(T, data) == offsetof(uv_handle_t, data),
422
                "T is a libuv handle");
423
  static_assert(offsetof(T, close_cb) == offsetof(uv_handle_t, close_cb),
424
                "T is a libuv handle");
425
  struct CloseData {
426
    Environment* env;
427
    OnCloseCallback callback;
428
    void* original_data;
429
  };
430
21740
  handle->data = new CloseData { this, callback, handle->data };
431
86959
  uv_close(reinterpret_cast<uv_handle_t*>(handle), [](uv_handle_t* handle) {
432
43479
    std::unique_ptr<CloseData> data { static_cast<CloseData*>(handle->data) };
433
21741
    data->env->handle_cleanup_waiting_--;
434
21741
    handle->data = data->original_data;
435
21741
    data->callback(reinterpret_cast<T*>(handle));
436
21741
  });
437
21740
}
438
439
83377
void Environment::IncreaseWaitingRequestCounter() {
440
83377
  request_waiting_++;
441
83377
}
442
443
83371
void Environment::DecreaseWaitingRequestCounter() {
444
83371
  request_waiting_--;
445
83371
  CHECK_GE(request_waiting_, 0);
446
83371
}
447
448
815480
inline uv_loop_t* Environment::event_loop() const {
449
815480
  return isolate_data()->event_loop();
450
}
451
452
154
inline void Environment::TryLoadAddon(
453
    const char* filename,
454
    int flags,
455
    const std::function<bool(binding::DLib*)>& was_loaded) {
456
154
  loaded_addons_.emplace_back(filename, flags);
457
154
  if (!was_loaded(&loaded_addons_.back())) {
458
8
    loaded_addons_.pop_back();
459
  }
460
154
}
461
462
#if HAVE_INSPECTOR
463
17427
inline bool Environment::is_in_inspector_console_call() const {
464
17427
  return is_in_inspector_console_call_;
465
}
466
467
34852
inline void Environment::set_is_in_inspector_console_call(bool value) {
468
34852
  is_in_inspector_console_call_ = value;
469
34852
}
470
#endif
471
472
7216056
inline AsyncHooks* Environment::async_hooks() {
473
7216056
  return &async_hooks_;
474
}
475
476
1731286
inline ImmediateInfo* Environment::immediate_info() {
477
1731286
  return &immediate_info_;
478
}
479
480
1162361
inline TickInfo* Environment::tick_info() {
481
1162361
  return &tick_info_;
482
}
483
484
44145
inline uint64_t Environment::timer_base() const {
485
44145
  return timer_base_;
486
}
487
488
986343
inline std::shared_ptr<KVStore> Environment::env_vars() {
489
986343
  return env_vars_;
490
}
491
492
5407
inline void Environment::set_env_vars(std::shared_ptr<KVStore> env_vars) {
493
5407
  env_vars_ = env_vars;
494
5407
}
495
496
18
inline bool Environment::printed_error() const {
497
18
  return printed_error_;
498
}
499
500
18
inline void Environment::set_printed_error(bool value) {
501
18
  printed_error_ = value;
502
18
}
503
504
8961
inline void Environment::set_trace_sync_io(bool value) {
505
8961
  trace_sync_io_ = value;
506
8961
}
507
508
80
inline bool Environment::abort_on_uncaught_exception() const {
509
80
  return options_->abort_on_uncaught_exception;
510
}
511
512
inline void Environment::set_force_context_aware(bool value) {
513
  options_->force_context_aware = value;
514
}
515
516
42
inline bool Environment::force_context_aware() const {
517
42
  return options_->force_context_aware;
518
}
519
520
388
inline void Environment::set_abort_on_uncaught_exception(bool value) {
521
388
  options_->abort_on_uncaught_exception = value;
522
388
}
523
524
469
inline AliasedUint32Array& Environment::should_abort_on_uncaught_toggle() {
525
469
  return should_abort_on_uncaught_toggle_;
526
}
527
528
1294234
inline AliasedInt32Array& Environment::stream_base_state() {
529
1294234
  return stream_base_state_;
530
}
531
532
33757
inline uint32_t Environment::get_next_module_id() {
533
33757
  return module_id_counter_++;
534
}
535
1947
inline uint32_t Environment::get_next_script_id() {
536
1947
  return script_id_counter_++;
537
}
538
30960
inline uint32_t Environment::get_next_function_id() {
539
30960
  return function_id_counter_++;
540
}
541
542
69221
ShouldNotAbortOnUncaughtScope::ShouldNotAbortOnUncaughtScope(
543
69221
    Environment* env)
544
69221
    : env_(env) {
545
69221
  env_->PushShouldNotAbortOnUncaughtScope();
546
69221
}
547
548
138440
ShouldNotAbortOnUncaughtScope::~ShouldNotAbortOnUncaughtScope() {
549
69220
  Close();
550
69220
}
551
552
69404
void ShouldNotAbortOnUncaughtScope::Close() {
553
69404
  if (env_ != nullptr) {
554
69220
    env_->PopShouldNotAbortOnUncaughtScope();
555
69220
    env_ = nullptr;
556
  }
557
69404
}
558
559
69221
inline void Environment::PushShouldNotAbortOnUncaughtScope() {
560
69221
  should_not_abort_scope_counter_++;
561
69221
}
562
563
69220
inline void Environment::PopShouldNotAbortOnUncaughtScope() {
564
69220
  should_not_abort_scope_counter_--;
565
69220
}
566
567
1
inline bool Environment::inside_should_not_abort_on_uncaught_scope() const {
568
1
  return should_not_abort_scope_counter_ > 0;
569
}
570
571
380448
inline std::vector<double>* Environment::destroy_async_id_list() {
572
380448
  return &destroy_async_id_list_;
573
}
574
575
215941
inline double Environment::new_async_id() {
576
215941
  async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter] += 1;
577
215941
  return async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter];
578
}
579
580
247231
inline double Environment::execution_async_id() {
581
247231
  return async_hooks()->async_id_fields()[AsyncHooks::kExecutionAsyncId];
582
}
583
584
64227
inline double Environment::trigger_async_id() {
585
64227
  return async_hooks()->async_id_fields()[AsyncHooks::kTriggerAsyncId];
586
}
587
588
215938
inline double Environment::get_default_trigger_async_id() {
589
  double default_trigger_async_id =
590
215938
    async_hooks()->async_id_fields()[AsyncHooks::kDefaultTriggerAsyncId];
591
  // If defaultTriggerAsyncId isn't set, use the executionAsyncId
592
215938
  if (default_trigger_async_id < 0)
593
172312
    default_trigger_async_id = execution_async_id();
594
215938
  return default_trigger_async_id;
595
}
596
597
56687
inline std::shared_ptr<EnvironmentOptions> Environment::options() {
598
56687
  return options_;
599
}
600
601
14485
inline const std::vector<std::string>& Environment::argv() {
602
14485
  return argv_;
603
}
604
605
5520
inline const std::vector<std::string>& Environment::exec_argv() {
606
5520
  return exec_argv_;
607
}
608
609
9978
inline const std::string& Environment::exec_path() const {
610
9978
  return exec_path_;
611
}
612
613
10
inline std::string Environment::GetCwd() {
614
  char cwd[PATH_MAX_BYTES];
615
10
  size_t size = PATH_MAX_BYTES;
616
10
  const int err = uv_cwd(cwd, &size);
617
618
10
  if (err == 0) {
619
10
    CHECK_GT(size, 0);
620
10
    return cwd;
621
  }
622
623
  // This can fail if the cwd is deleted. In that case, fall back to
624
  // exec_path.
625
  const std::string& exec_path = exec_path_;
626
  return exec_path.substr(0, exec_path.find_last_of(kPathSeparator));
627
}
628
629
#if HAVE_INSPECTOR
630
4984
inline void Environment::set_coverage_directory(const char* dir) {
631
4984
  coverage_directory_ = std::string(dir);
632
4984
}
633
634
5005
inline void Environment::set_coverage_connection(
635
    std::unique_ptr<profiler::V8CoverageConnection> connection) {
636
5005
  CHECK_NULL(coverage_connection_);
637
5005
  std::swap(coverage_connection_, connection);
638
5005
}
639
640
15014
inline profiler::V8CoverageConnection* Environment::coverage_connection() {
641
15014
  return coverage_connection_.get();
642
}
643
644
4972
inline const std::string& Environment::coverage_directory() const {
645
4972
  return coverage_directory_;
646
}
647
648
12
inline void Environment::set_cpu_profiler_connection(
649
    std::unique_ptr<profiler::V8CpuProfilerConnection> connection) {
650
12
  CHECK_NULL(cpu_profiler_connection_);
651
12
  std::swap(cpu_profiler_connection_, connection);
652
12
}
653
654
inline profiler::V8CpuProfilerConnection*
655
5020
Environment::cpu_profiler_connection() {
656
5020
  return cpu_profiler_connection_.get();
657
}
658
659
12
inline void Environment::set_cpu_prof_interval(uint64_t interval) {
660
12
  cpu_prof_interval_ = interval;
661
12
}
662
663
12
inline uint64_t Environment::cpu_prof_interval() const {
664
12
  return cpu_prof_interval_;
665
}
666
667
12
inline void Environment::set_cpu_prof_name(const std::string& name) {
668
12
  cpu_prof_name_ = name;
669
12
}
670
671
12
inline const std::string& Environment::cpu_prof_name() const {
672
12
  return cpu_prof_name_;
673
}
674
675
12
inline void Environment::set_cpu_prof_dir(const std::string& dir) {
676
12
  cpu_prof_dir_ = dir;
677
12
}
678
679
12
inline const std::string& Environment::cpu_prof_dir() const {
680
12
  return cpu_prof_dir_;
681
}
682
683
6
inline void Environment::set_heap_profiler_connection(
684
    std::unique_ptr<profiler::V8HeapProfilerConnection> connection) {
685
6
  CHECK_NULL(heap_profiler_connection_);
686
6
  std::swap(heap_profiler_connection_, connection);
687
6
}
688
689
inline profiler::V8HeapProfilerConnection*
690
5002
Environment::heap_profiler_connection() {
691
5002
  return heap_profiler_connection_.get();
692
}
693
694
6
inline void Environment::set_heap_prof_name(const std::string& name) {
695
6
  heap_prof_name_ = name;
696
6
}
697
698
6
inline const std::string& Environment::heap_prof_name() const {
699
6
  return heap_prof_name_;
700
}
701
702
6
inline void Environment::set_heap_prof_dir(const std::string& dir) {
703
6
  heap_prof_dir_ = dir;
704
6
}
705
706
6
inline const std::string& Environment::heap_prof_dir() const {
707
6
  return heap_prof_dir_;
708
}
709
710
6
inline void Environment::set_heap_prof_interval(uint64_t interval) {
711
6
  heap_prof_interval_ = interval;
712
6
}
713
714
6
inline uint64_t Environment::heap_prof_interval() const {
715
6
  return heap_prof_interval_;
716
}
717
718
#endif  // HAVE_INSPECTOR
719
720
inline
721
10139
std::shared_ptr<ExclusiveAccess<HostPort>> Environment::inspector_host_port() {
722
10139
  return inspector_host_port_;
723
}
724
725
68967
inline std::shared_ptr<PerIsolateOptions> IsolateData::options() {
726
68967
  return options_;
727
}
728
729
100
inline void IsolateData::set_options(
730
    std::shared_ptr<PerIsolateOptions> options) {
731
100
  options_ = std::move(options);
732
100
}
733
734
template <typename Fn>
735
55514
void Environment::SetImmediate(Fn&& cb, CallbackFlags::Flags flags) {
736
111028
  auto callback = native_immediates_.CreateCallback(std::move(cb), flags);
737
55514
  native_immediates_.Push(std::move(callback));
738
739


55514
  if (flags & CallbackFlags::kRefed) {
740


33235
    if (immediate_info()->ref_count() == 0)
741
25012
      ToggleImmediateRef(true);
742
33235
    immediate_info()->ref_count_inc(1);
743
  }
744
55514
}
745
746
template <typename Fn>
747
1228
void Environment::SetImmediateThreadsafe(Fn&& cb, CallbackFlags::Flags flags) {
748
  auto callback = native_immediates_threadsafe_.CreateCallback(
749
2456
      std::move(cb), flags);
750
  {
751
2456
    Mutex::ScopedLock lock(native_immediates_threadsafe_mutex_);
752
1228
    native_immediates_threadsafe_.Push(std::move(callback));
753

1228
    if (task_queues_async_initialized_)
754
966
      uv_async_send(&task_queues_async_);
755
  }
756
1228
}
757
758
template <typename Fn>
759
8055
void Environment::RequestInterrupt(Fn&& cb) {
760
  auto callback = native_immediates_interrupts_.CreateCallback(
761
16110
      std::move(cb), CallbackFlags::kRefed);
762
  {
763
16109
    Mutex::ScopedLock lock(native_immediates_threadsafe_mutex_);
764
8055
    native_immediates_interrupts_.Push(std::move(callback));
765
8054
    if (task_queues_async_initialized_)
766
2925
      uv_async_send(&task_queues_async_);
767
  }
768
8055
  RequestInterruptFromV8();
769
8055
}
770
771
4450461
inline bool Environment::can_call_into_js() const {
772

4450461
  return can_call_into_js_ && !is_stopping();
773
}
774
775
1064
inline void Environment::set_can_call_into_js(bool can_call_into_js) {
776
1064
  can_call_into_js_ = can_call_into_js;
777
1066
}
778
779
1109169
inline bool Environment::has_run_bootstrapping_code() const {
780
1109169
  return has_run_bootstrapping_code_;
781
}
782
783
5023
inline void Environment::set_has_run_bootstrapping_code(bool value) {
784
5023
  has_run_bootstrapping_code_ = value;
785
5023
}
786
787
19
inline bool Environment::has_serialized_options() const {
788
19
  return has_serialized_options_;
789
}
790
791
4989
inline void Environment::set_has_serialized_options(bool value) {
792
4989
  has_serialized_options_ = value;
793
4989
}
794
795
6582
inline bool Environment::is_main_thread() const {
796
6582
  return worker_context() == nullptr;
797
}
798
799
4989
inline bool Environment::should_not_register_esm_loader() const {
800
4989
  return flags_ & EnvironmentFlags::kNoRegisterESMLoader;
801
}
802
803
12299
inline bool Environment::owns_process_state() const {
804
12299
  return flags_ & EnvironmentFlags::kOwnsProcessState;
805
}
806
807
5014
inline bool Environment::owns_inspector() const {
808
5014
  return flags_ & EnvironmentFlags::kOwnsInspector;
809
}
810
811
96850
inline bool Environment::tracks_unmanaged_fds() const {
812
96850
  return flags_ & EnvironmentFlags::kTrackUnmanagedFds;
813
}
814
815
3
bool Environment::filehandle_close_warning() const {
816
3
  return emit_filehandle_warning_;
817
}
818
819
3
void Environment::set_filehandle_close_warning(bool on) {
820
3
  emit_filehandle_warning_ = on;
821
3
}
822
823
8
void Environment::set_source_maps_enabled(bool on) {
824
8
  source_maps_enabled_ = on;
825
8
}
826
827
928
bool Environment::source_maps_enabled() const {
828
928
  return source_maps_enabled_;
829
}
830
831
5871
inline uint64_t Environment::thread_id() const {
832
5871
  return thread_id_;
833
}
834
835
11940
inline worker::Worker* Environment::worker_context() const {
836
11940
  return isolate_data()->worker_context();
837
}
838
839
626
inline void Environment::add_sub_worker_context(worker::Worker* context) {
840
626
  sub_worker_contexts_.insert(context);
841
626
}
842
843
652
inline void Environment::remove_sub_worker_context(worker::Worker* context) {
844
652
  sub_worker_contexts_.erase(context);
845
652
}
846
847
template <typename Fn>
848
22
inline void Environment::ForEachWorker(Fn&& iterator) {
849
22
  for (worker::Worker* w : sub_worker_contexts_) iterator(w);
850
22
}
851
852
1235
inline void Environment::add_refs(int64_t diff) {
853
1235
  task_queues_async_refs_ += diff;
854
1235
  CHECK_GE(task_queues_async_refs_, 0);
855
1235
  if (task_queues_async_refs_ == 0)
856
154
    uv_unref(reinterpret_cast<uv_handle_t*>(&task_queues_async_));
857
  else
858
1081
    uv_ref(reinterpret_cast<uv_handle_t*>(&task_queues_async_));
859
1235
}
860
861
6873525
inline bool Environment::is_stopping() const {
862
6873525
  return is_stopping_.load();
863
}
864
865
4533
inline void Environment::set_stopping(bool value) {
866
4533
  is_stopping_.store(value);
867
4534
}
868
869
3
inline std::list<node_module>* Environment::extra_linked_bindings() {
870
3
  return &extra_linked_bindings_;
871
}
872
873
7
inline node_module* Environment::extra_linked_bindings_head() {
874
10
  return extra_linked_bindings_.size() > 0 ?
875
10
      &extra_linked_bindings_.front() : nullptr;
876
}
877
878
7
inline const Mutex& Environment::extra_linked_bindings_mutex() const {
879
7
  return extra_linked_bindings_mutex_;
880
}
881
882
42733
inline performance::PerformanceState* Environment::performance_state() {
883
42733
  return performance_state_.get();
884
}
885
886
inline std::unordered_map<std::string, uint64_t>*
887
50
    Environment::performance_marks() {
888
50
  return &performance_marks_;
889
}
890
891
5581666
inline IsolateData* Environment::isolate_data() const {
892
5581666
  return isolate_data_;
893
}
894
895
std::unordered_map<char*, std::unique_ptr<v8::BackingStore>>*
896
623204
    Environment::released_allocated_buffers() {
897
623204
  return &released_allocated_buffers_;
898
}
899
900
7
inline void Environment::ThrowError(const char* errmsg) {
901
7
  ThrowError(v8::Exception::Error, errmsg);
902
7
}
903
904
inline void Environment::ThrowTypeError(const char* errmsg) {
905
  ThrowError(v8::Exception::TypeError, errmsg);
906
}
907
908
inline void Environment::ThrowRangeError(const char* errmsg) {
909
  ThrowError(v8::Exception::RangeError, errmsg);
910
}
911
912
7
inline void Environment::ThrowError(
913
    v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
914
    const char* errmsg) {
915
14
  v8::HandleScope handle_scope(isolate());
916
7
  isolate()->ThrowException(fun(OneByteString(isolate(), errmsg)));
917
7
}
918
919
7
inline void Environment::ThrowErrnoException(int errorno,
920
                                             const char* syscall,
921
                                             const char* message,
922
                                             const char* path) {
923
  isolate()->ThrowException(
924
7
      ErrnoException(isolate(), errorno, syscall, message, path));
925
7
}
926
927
14
inline void Environment::ThrowUVException(int errorno,
928
                                          const char* syscall,
929
                                          const char* message,
930
                                          const char* path,
931
                                          const char* dest) {
932
  isolate()->ThrowException(
933
14
      UVException(isolate(), errorno, syscall, message, path, dest));
934
14
}
935
936
inline v8::Local<v8::FunctionTemplate>
937
1218039
    Environment::NewFunctionTemplate(v8::FunctionCallback callback,
938
                                     v8::Local<v8::Signature> signature,
939
                                     v8::ConstructorBehavior behavior,
940
                                     v8::SideEffectType side_effect_type) {
941
  return v8::FunctionTemplate::New(isolate(), callback, v8::Local<v8::Value>(),
942
1218039
                                   signature, 0, behavior, side_effect_type);
943
}
944
945
438495
inline void Environment::SetMethod(v8::Local<v8::Object> that,
946
                                   const char* name,
947
                                   v8::FunctionCallback callback) {
948
438495
  v8::Local<v8::Context> context = isolate()->GetCurrentContext();
949
  v8::Local<v8::Function> function =
950
876994
      NewFunctionTemplate(callback, v8::Local<v8::Signature>(),
951
                          v8::ConstructorBehavior::kThrow,
952
438501
                          v8::SideEffectType::kHasSideEffect)
953
876998
          ->GetFunction(context)
954
438501
          .ToLocalChecked();
955
  // kInternalized strings are created in the old space.
956
438501
  const v8::NewStringType type = v8::NewStringType::kInternalized;
957
  v8::Local<v8::String> name_string =
958
877002
      v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
959
876990
  that->Set(context, name_string, function).Check();
960
438489
  function->SetName(name_string);  // NODE_SET_METHOD() compatibility.
961
438505
}
962
963
51726
inline void Environment::SetMethodNoSideEffect(v8::Local<v8::Object> that,
964
                                               const char* name,
965
                                               v8::FunctionCallback callback) {
966
51726
  v8::Local<v8::Context> context = isolate()->GetCurrentContext();
967
  v8::Local<v8::Function> function =
968
103448
      NewFunctionTemplate(callback, v8::Local<v8::Signature>(),
969
                          v8::ConstructorBehavior::kThrow,
970
51724
                          v8::SideEffectType::kHasNoSideEffect)
971
103451
          ->GetFunction(context)
972
51724
          .ToLocalChecked();
973
  // kInternalized strings are created in the old space.
974
51724
  const v8::NewStringType type = v8::NewStringType::kInternalized;
975
  v8::Local<v8::String> name_string =
976
103451
      v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
977
103452
  that->Set(context, name_string, function).Check();
978
51725
  function->SetName(name_string);  // NODE_SET_METHOD() compatibility.
979
51726
}
980
981
512470
inline void Environment::SetProtoMethod(v8::Local<v8::FunctionTemplate> that,
982
                                        const char* name,
983
                                        v8::FunctionCallback callback) {
984
512470
  v8::Local<v8::Signature> signature = v8::Signature::New(isolate(), that);
985
  v8::Local<v8::FunctionTemplate> t =
986
      NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow,
987
512471
                          v8::SideEffectType::kHasSideEffect);
988
  // kInternalized strings are created in the old space.
989
512473
  const v8::NewStringType type = v8::NewStringType::kInternalized;
990
  v8::Local<v8::String> name_string =
991
1024944
      v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
992
1024940
  that->PrototypeTemplate()->Set(name_string, t);
993
512472
  t->SetClassName(name_string);  // NODE_SET_PROTOTYPE_METHOD() compatibility.
994
512473
}
995
996
48561
inline void Environment::SetProtoMethodNoSideEffect(
997
    v8::Local<v8::FunctionTemplate> that,
998
    const char* name,
999
    v8::FunctionCallback callback) {
1000
48561
  v8::Local<v8::Signature> signature = v8::Signature::New(isolate(), that);
1001
  v8::Local<v8::FunctionTemplate> t =
1002
      NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow,
1003
48561
                          v8::SideEffectType::kHasNoSideEffect);
1004
  // kInternalized strings are created in the old space.
1005
48561
  const v8::NewStringType type = v8::NewStringType::kInternalized;
1006
  v8::Local<v8::String> name_string =
1007
97122
      v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
1008
97122
  that->PrototypeTemplate()->Set(name_string, t);
1009
48561
  t->SetClassName(name_string);  // NODE_SET_PROTOTYPE_METHOD() compatibility.
1010
48561
}
1011
1012
32
inline void Environment::SetInstanceMethod(v8::Local<v8::FunctionTemplate> that,
1013
                                           const char* name,
1014
                                           v8::FunctionCallback callback) {
1015
32
  v8::Local<v8::Signature> signature = v8::Signature::New(isolate(), that);
1016
  v8::Local<v8::FunctionTemplate> t =
1017
      NewFunctionTemplate(callback, signature, v8::ConstructorBehavior::kThrow,
1018
32
                          v8::SideEffectType::kHasSideEffect);
1019
  // kInternalized strings are created in the old space.
1020
32
  const v8::NewStringType type = v8::NewStringType::kInternalized;
1021
  v8::Local<v8::String> name_string =
1022
64
      v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
1023
64
  that->InstanceTemplate()->Set(name_string, t);
1024
32
  t->SetClassName(name_string);
1025
32
}
1026
1027
103033
inline void Environment::SetConstructorFunction(
1028
    v8::Local<v8::Object> that,
1029
    const char* name,
1030
    v8::Local<v8::FunctionTemplate> tmpl) {
1031
103033
  SetConstructorFunction(that, OneByteString(isolate(), name), tmpl);
1032
103033
}
1033
1034
109982
inline void Environment::SetConstructorFunction(
1035
    v8::Local<v8::Object> that,
1036
    v8::Local<v8::String> name,
1037
    v8::Local<v8::FunctionTemplate> tmpl) {
1038
109982
  tmpl->SetClassName(name);
1039
219964
  that->Set(
1040
      context(),
1041
      name,
1042
549910
      tmpl->GetFunction(context()).ToLocalChecked()).Check();
1043
109982
}
1044
1045
329301
void Environment::AddCleanupHook(CleanupCallback fn, void* arg) {
1046
658603
  auto insertion_info = cleanup_hooks_.emplace(CleanupHookCallback {
1047
329301
    fn, arg, cleanup_hook_counter_++
1048
329301
  });
1049
  // Make sure there was no existing element with these values.
1050
329302
  CHECK_EQ(insertion_info.second, true);
1051
329302
}
1052
1053
315804
void Environment::RemoveCleanupHook(CleanupCallback fn, void* arg) {
1054
315804
  CleanupHookCallback search { fn, arg, 0 };
1055
315805
  cleanup_hooks_.erase(search);
1056
315812
}
1057
1058
869611
size_t CleanupHookCallback::Hash::operator()(
1059
    const CleanupHookCallback& cb) const {
1060
869611
  return std::hash<void*>()(cb.arg_);
1061
}
1062
1063
431850
bool CleanupHookCallback::Equal::operator()(
1064
    const CleanupHookCallback& a, const CleanupHookCallback& b) const {
1065

431850
  return a.fn_ == b.fn_ && a.arg_ == b.arg_;
1066
}
1067
1068
406
BaseObject* CleanupHookCallback::GetBaseObject() const {
1069
406
  if (fn_ == BaseObject::DeleteMe)
1070
384
    return static_cast<BaseObject*>(arg_);
1071
  else
1072
22
    return nullptr;
1073
}
1074
1075
template <typename T>
1076
22
void Environment::ForEachBaseObject(T&& iterator) {
1077

428
  for (const auto& hook : cleanup_hooks_) {
1078
406
    BaseObject* obj = hook.GetBaseObject();
1079

406
    if (obj != nullptr)
1080
384
      iterator(obj);
1081
  }
1082
22
}
1083
1084
633358
void Environment::modify_base_object_count(int64_t delta) {
1085
633358
  base_object_count_ += delta;
1086
633358
}
1087
1088
10061
int64_t Environment::base_object_count() const {
1089
10061
  return base_object_count_ - initial_base_object_count_;
1090
}
1091
1092
15
void Environment::set_main_utf16(std::unique_ptr<v8::String::Value> str) {
1093
15
  CHECK(!main_utf16_);
1094
15
  main_utf16_ = std::move(str);
1095
15
}
1096
1097
388
void Environment::set_process_exit_handler(
1098
    std::function<void(Environment*, int)>&& handler) {
1099
388
  process_exit_handler_ = std::move(handler);
1100
388
}
1101
1102
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
1103
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
1104
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
1105
#define V(TypeName, PropertyName)                                             \
1106
  inline                                                                      \
1107
  v8::Local<TypeName> IsolateData::PropertyName() const {                     \
1108
    return PropertyName ## _ .Get(isolate_);                                  \
1109
  }
1110
212
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
1111
4416
  PER_ISOLATE_SYMBOL_PROPERTIES(VY)
1112
6783492
  PER_ISOLATE_STRING_PROPERTIES(VS)
1113
239375
#undef V
1114
16079
#undef VS
1115
8284
#undef VY
1116
4559
#undef VP
1117
29144
1118
114465
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
1119
16788
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
1120
26875
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
1121
61299
#define V(TypeName, PropertyName)                                             \
1122
24406
  inline v8::Local<TypeName> Environment::PropertyName() const {              \
1123
101
    return isolate_data()->PropertyName();                                    \
1124
118
  }
1125
31221
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
1126
64655
  PER_ISOLATE_SYMBOL_PROPERTIES(VY)
1127
3486460
  PER_ISOLATE_STRING_PROPERTIES(VS)
1128
112032
#undef V
1129
2385
#undef VS
1130
12979
#undef VY
1131
3050
#undef VP
1132
46369
1133
98853
#define V(PropertyName, TypeName)                                             \
1134
8199
  inline v8::Local<TypeName> Environment::PropertyName() const {              \
1135
14740
    return PersistentToLocal::Strong(PropertyName ## _);                      \
1136
15245
  }                                                                           \
1137
1502
  inline void Environment::set_ ## PropertyName(v8::Local<TypeName> value) {  \
1138
64
    PropertyName ## _.Reset(isolate(), value);                                \
1139
64
  }
1140
625280
  ENVIRONMENT_STRONG_PERSISTENT_TEMPLATES(V)
1141
1959102
  ENVIRONMENT_STRONG_PERSISTENT_VALUES(V)
1142
72920
#undef V
1143
73839
1144
8412469
v8::Local<v8::Context> Environment::context() const {
1145
9046981
  return PersistentToLocal::Strong(context_);
1146
696897
}
1147
10044
1148
40
}  // namespace node
1149
5022
1150
27284
// These two files depend on each other. Including base_object-inl.h after this
1151
27723
// file is the easiest way to avoid issues with that circular dependency.
1152
49385
#include "base_object-inl.h"
1153
43924
1154
32110
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
1155
26649
1156
5461
#endif  // SRC_ENV_INL_H_