GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage/nodes/benchmark/out/../src/env.h Lines: 27 27 100.0 %
Date: 2019-01-07 12:15:22 Branches: 1 2 50.0 %

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_H_
23
#define SRC_ENV_H_
24
25
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
27
#include "aliased_buffer.h"
28
#if HAVE_INSPECTOR
29
#include "inspector_agent.h"
30
#endif
31
#include "handle_wrap.h"
32
#include "node.h"
33
#include "node_binding.h"
34
#include "node_http2_state.h"
35
#include "node_options.h"
36
#include "req_wrap.h"
37
#include "util.h"
38
#include "uv.h"
39
#include "v8.h"
40
41
#include <stdint.h>
42
#include <functional>
43
#include <list>
44
#include <unordered_map>
45
#include <unordered_set>
46
#include <vector>
47
48
struct nghttp2_rcbuf;
49
50
namespace node {
51
52
namespace contextify {
53
class ContextifyScript;
54
}
55
56
namespace fs {
57
class FileHandleReadWrap;
58
}
59
60
namespace performance {
61
class performance_state;
62
}
63
64
namespace tracing {
65
class AgentWriterHandle;
66
}
67
68
namespace worker {
69
class Worker;
70
}
71
72
namespace loader {
73
class ModuleWrap;
74
75
115
struct PackageConfig {
76
  enum class Exists { Yes, No };
77
  enum class IsValid { Yes, No };
78
  enum class HasMain { Yes, No };
79
80
  Exists exists;
81
  IsValid is_valid;
82
  HasMain has_main;
83
  std::string main;
84
};
85
}  // namespace loader
86
87
// Stat fields buffers contain twice the number of entries in an uv_stat_t
88
// because `fs.StatWatcher` needs room to store 2 `fs.Stats` instances.
89
constexpr size_t kFsStatsFieldsNumber = 14;
90
constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
91
92
// PER_ISOLATE_* macros: We have a lot of per-isolate properties
93
// and adding and maintaining their getters and setters by hand would be
94
// difficult so let's make the preprocessor generate them for us.
95
//
96
// In each macro, `V` is expected to be the name of a macro or function which
97
// accepts the number of arguments provided in each tuple in the macro body,
98
// typically two. The named function will be invoked against each tuple.
99
//
100
// Make sure that any macro V defined for use with the PER_ISOLATE_* macros is
101
// undefined again after use.
102
103
// Private symbols are per-isolate primitives but Environment proxies them
104
// for the sake of convenience.  Strings should be ASCII-only and have a
105
// "node:" prefix to avoid name clashes with third-party code.
106
#define PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(V)                              \
107
  V(alpn_buffer_private_symbol, "node:alpnBuffer")                            \
108
  V(arrow_message_private_symbol, "node:arrowMessage")                        \
109
  V(contextify_context_private_symbol, "node:contextify:context")             \
110
  V(contextify_global_private_symbol, "node:contextify:global")               \
111
  V(decorated_private_symbol, "node:decorated")                               \
112
  V(napi_env, "node:napi:env")                                                \
113
  V(napi_wrapper, "node:napi:wrapper")                                        \
114
  V(sab_lifetimepartner_symbol, "node:sharedArrayBufferLifetimePartner")      \
115
116
// Symbols are per-isolate primitives but Environment proxies them
117
// for the sake of convenience.
118
#define PER_ISOLATE_SYMBOL_PROPERTIES(V)                                      \
119
  V(handle_onclose_symbol, "handle_onclose")                                  \
120
  V(oninit_symbol, "oninit")                                                  \
121
  V(owner_symbol, "owner")                                                    \
122
123
// Strings are per-isolate primitives but Environment proxies them
124
// for the sake of convenience.  Strings should be ASCII-only.
125
#define PER_ISOLATE_STRING_PROPERTIES(V)                                       \
126
  V(address_string, "address")                                                 \
127
  V(aliases_string, "aliases")                                                 \
128
  V(args_string, "args")                                                       \
129
  V(asn1curve_string, "asn1Curve")                                             \
130
  V(async_ids_stack_string, "async_ids_stack")                                 \
131
  V(bits_string, "bits")                                                       \
132
  V(buffer_string, "buffer")                                                   \
133
  V(bytes_parsed_string, "bytesParsed")                                        \
134
  V(bytes_read_string, "bytesRead")                                            \
135
  V(bytes_written_string, "bytesWritten")                                      \
136
  V(cached_data_produced_string, "cachedDataProduced")                         \
137
  V(cached_data_rejected_string, "cachedDataRejected")                         \
138
  V(cached_data_string, "cachedData")                                          \
139
  V(change_string, "change")                                                   \
140
  V(channel_string, "channel")                                                 \
141
  V(chunks_sent_since_last_write_string, "chunksSentSinceLastWrite")           \
142
  V(code_string, "code")                                                       \
143
  V(config_string, "config")                                                   \
144
  V(constants_string, "constants")                                             \
145
  V(crypto_dsa_string, "dsa")                                                  \
146
  V(crypto_ec_string, "ec")                                                    \
147
  V(crypto_rsa_string, "rsa")                                                  \
148
  V(cwd_string, "cwd")                                                         \
149
  V(dest_string, "dest")                                                       \
150
  V(destroyed_string, "destroyed")                                             \
151
  V(detached_string, "detached")                                               \
152
  V(dns_a_string, "A")                                                         \
153
  V(dns_aaaa_string, "AAAA")                                                   \
154
  V(dns_cname_string, "CNAME")                                                 \
155
  V(dns_mx_string, "MX")                                                       \
156
  V(dns_naptr_string, "NAPTR")                                                 \
157
  V(dns_ns_string, "NS")                                                       \
158
  V(dns_ptr_string, "PTR")                                                     \
159
  V(dns_soa_string, "SOA")                                                     \
160
  V(dns_srv_string, "SRV")                                                     \
161
  V(dns_txt_string, "TXT")                                                     \
162
  V(duration_string, "duration")                                               \
163
  V(emit_warning_string, "emitWarning")                                        \
164
  V(encoding_string, "encoding")                                               \
165
  V(entries_string, "entries")                                                 \
166
  V(entry_type_string, "entryType")                                            \
167
  V(env_pairs_string, "envPairs")                                              \
168
  V(env_var_settings_string, "envVarSettings")                                 \
169
  V(errno_string, "errno")                                                     \
170
  V(error_string, "error")                                                     \
171
  V(exchange_string, "exchange")                                               \
172
  V(exit_code_string, "exitCode")                                              \
173
  V(expire_string, "expire")                                                   \
174
  V(exponent_string, "exponent")                                               \
175
  V(exports_string, "exports")                                                 \
176
  V(ext_key_usage_string, "ext_key_usage")                                     \
177
  V(external_stream_string, "_externalStream")                                 \
178
  V(family_string, "family")                                                   \
179
  V(fatal_exception_string, "_fatalException")                                 \
180
  V(fd_string, "fd")                                                           \
181
  V(file_string, "file")                                                       \
182
  V(fingerprint256_string, "fingerprint256")                                   \
183
  V(fingerprint_string, "fingerprint")                                         \
184
  V(flags_string, "flags")                                                     \
185
  V(fragment_string, "fragment")                                               \
186
  V(function_string, "function")                                               \
187
  V(get_data_clone_error_string, "_getDataCloneError")                         \
188
  V(get_shared_array_buffer_id_string, "_getSharedArrayBufferId")              \
189
  V(gid_string, "gid")                                                         \
190
  V(handle_string, "handle")                                                   \
191
  V(help_text_string, "helpText")                                              \
192
  V(homedir_string, "homedir")                                                 \
193
  V(host_string, "host")                                                       \
194
  V(hostmaster_string, "hostmaster")                                           \
195
  V(ignore_string, "ignore")                                                   \
196
  V(infoaccess_string, "infoAccess")                                           \
197
  V(inherit_string, "inherit")                                                 \
198
  V(input_string, "input")                                                     \
199
  V(internal_binding_string, "internalBinding")                                \
200
  V(internal_string, "internal")                                               \
201
  V(ipv4_string, "IPv4")                                                       \
202
  V(ipv6_string, "IPv6")                                                       \
203
  V(isclosing_string, "isClosing")                                             \
204
  V(issuer_string, "issuer")                                                   \
205
  V(issuercert_string, "issuerCertificate")                                    \
206
  V(kill_signal_string, "killSignal")                                          \
207
  V(kind_string, "kind")                                                       \
208
  V(library_string, "library")                                                 \
209
  V(mac_string, "mac")                                                         \
210
  V(main_string, "main")                                                       \
211
  V(max_buffer_string, "maxBuffer")                                            \
212
  V(message_port_constructor_string, "MessagePort")                            \
213
  V(message_port_string, "messagePort")                                        \
214
  V(message_string, "message")                                                 \
215
  V(minttl_string, "minttl")                                                   \
216
  V(module_string, "module")                                                   \
217
  V(modulus_string, "modulus")                                                 \
218
  V(name_string, "name")                                                       \
219
  V(netmask_string, "netmask")                                                 \
220
  V(nistcurve_string, "nistCurve")                                             \
221
  V(nsname_string, "nsname")                                                   \
222
  V(ocsp_request_string, "OCSPRequest")                                        \
223
  V(oncertcb_string, "oncertcb")                                               \
224
  V(onchange_string, "onchange")                                               \
225
  V(onclienthello_string, "onclienthello")                                     \
226
  V(oncomplete_string, "oncomplete")                                           \
227
  V(onconnection_string, "onconnection")                                       \
228
  V(ondone_string, "ondone")                                                   \
229
  V(onerror_string, "onerror")                                                 \
230
  V(onexit_string, "onexit")                                                   \
231
  V(onhandshakedone_string, "onhandshakedone")                                 \
232
  V(onhandshakestart_string, "onhandshakestart")                               \
233
  V(onmessage_string, "onmessage")                                             \
234
  V(onnewsession_string, "onnewsession")                                       \
235
  V(onocspresponse_string, "onocspresponse")                                   \
236
  V(onread_string, "onread")                                                   \
237
  V(onreadstart_string, "onreadstart")                                         \
238
  V(onreadstop_string, "onreadstop")                                           \
239
  V(onshutdown_string, "onshutdown")                                           \
240
  V(onsignal_string, "onsignal")                                               \
241
  V(onunpipe_string, "onunpipe")                                               \
242
  V(onwrite_string, "onwrite")                                                 \
243
  V(openssl_error_stack, "opensslErrorStack")                                  \
244
  V(options_string, "options")                                                 \
245
  V(order_string, "order")                                                     \
246
  V(output_string, "output")                                                   \
247
  V(parse_error_string, "Parse Error")                                         \
248
  V(password_string, "password")                                               \
249
  V(path_string, "path")                                                       \
250
  V(pending_handle_string, "pendingHandle")                                    \
251
  V(pid_string, "pid")                                                         \
252
  V(pipe_source_string, "pipeSource")                                          \
253
  V(pipe_string, "pipe")                                                       \
254
  V(pipe_target_string, "pipeTarget")                                          \
255
  V(port1_string, "port1")                                                     \
256
  V(port2_string, "port2")                                                     \
257
  V(port_string, "port")                                                       \
258
  V(preference_string, "preference")                                           \
259
  V(priority_string, "priority")                                               \
260
  V(process_string, "process")                                                 \
261
  V(promise_string, "promise")                                                 \
262
  V(pubkey_string, "pubkey")                                                   \
263
  V(query_string, "query")                                                     \
264
  V(raw_string, "raw")                                                         \
265
  V(read_host_object_string, "_readHostObject")                                \
266
  V(readable_string, "readable")                                               \
267
  V(reason_string, "reason")                                                   \
268
  V(refresh_string, "refresh")                                                 \
269
  V(regexp_string, "regexp")                                                   \
270
  V(rename_string, "rename")                                                   \
271
  V(replacement_string, "replacement")                                         \
272
  V(require_string, "require")                                                 \
273
  V(retry_string, "retry")                                                     \
274
  V(scheme_string, "scheme")                                                   \
275
  V(scopeid_string, "scopeid")                                                 \
276
  V(serial_number_string, "serialNumber")                                      \
277
  V(serial_string, "serial")                                                   \
278
  V(servername_string, "servername")                                           \
279
  V(service_string, "service")                                                 \
280
  V(session_id_string, "sessionId")                                            \
281
  V(shell_string, "shell")                                                     \
282
  V(signal_string, "signal")                                                   \
283
  V(sink_string, "sink")                                                       \
284
  V(size_string, "size")                                                       \
285
  V(sni_context_err_string, "Invalid SNI context")                             \
286
  V(sni_context_string, "sni_context")                                         \
287
  V(source_string, "source")                                                   \
288
  V(stack_string, "stack")                                                     \
289
  V(start_time_string, "startTime")                                            \
290
  V(status_string, "status")                                                   \
291
  V(stdio_string, "stdio")                                                     \
292
  V(subject_string, "subject")                                                 \
293
  V(subjectaltname_string, "subjectaltname")                                   \
294
  V(syscall_string, "syscall")                                                 \
295
  V(thread_id_string, "threadId")                                              \
296
  V(ticketkeycallback_string, "onticketkeycallback")                           \
297
  V(timeout_string, "timeout")                                                 \
298
  V(tls_ticket_string, "tlsTicket")                                            \
299
  V(ttl_string, "ttl")                                                         \
300
  V(type_string, "type")                                                       \
301
  V(uid_string, "uid")                                                         \
302
  V(unknown_string, "<unknown>")                                               \
303
  V(url_string, "url")                                                         \
304
  V(username_string, "username")                                               \
305
  V(valid_from_string, "valid_from")                                           \
306
  V(valid_to_string, "valid_to")                                               \
307
  V(value_string, "value")                                                     \
308
  V(verify_error_string, "verifyError")                                        \
309
  V(version_string, "version")                                                 \
310
  V(weight_string, "weight")                                                   \
311
  V(windows_hide_string, "windowsHide")                                        \
312
  V(windows_verbatim_arguments_string, "windowsVerbatimArguments")             \
313
  V(wrap_string, "wrap")                                                       \
314
  V(writable_string, "writable")                                               \
315
  V(write_host_object_string, "_writeHostObject")                              \
316
  V(write_queue_size_string, "writeQueueSize")                                 \
317
  V(x_forwarded_string, "x-forwarded-for")                                     \
318
  V(zero_return_string, "ZERO_RETURN")                                         \
319
320
#define ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)                            \
321
  V(as_external, v8::External)                                                 \
322
  V(async_hooks_after_function, v8::Function)                                  \
323
  V(async_hooks_before_function, v8::Function)                                 \
324
  V(async_hooks_binding, v8::Object)                                           \
325
  V(async_hooks_destroy_function, v8::Function)                                \
326
  V(async_hooks_init_function, v8::Function)                                   \
327
  V(async_hooks_promise_resolve_function, v8::Function)                        \
328
  V(async_wrap_ctor_template, v8::FunctionTemplate)                            \
329
  V(async_wrap_object_ctor_template, v8::FunctionTemplate)                     \
330
  V(buffer_prototype_object, v8::Object)                                       \
331
  V(context, v8::Context)                                                      \
332
  V(crypto_key_object_constructor, v8::Function)                               \
333
  V(domain_callback, v8::Function)                                             \
334
  V(domexception_function, v8::Function)                                       \
335
  V(fd_constructor_template, v8::ObjectTemplate)                               \
336
  V(fdclose_constructor_template, v8::ObjectTemplate)                          \
337
  V(filehandlereadwrap_template, v8::ObjectTemplate)                           \
338
  V(fs_use_promises_symbol, v8::Symbol)                                        \
339
  V(fsreqpromise_constructor_template, v8::ObjectTemplate)                     \
340
  V(handle_wrap_ctor_template, v8::FunctionTemplate)                           \
341
  V(host_import_module_dynamically_callback, v8::Function)                     \
342
  V(host_initialize_import_meta_object_callback, v8::Function)                 \
343
  V(http2ping_constructor_template, v8::ObjectTemplate)                        \
344
  V(http2session_on_altsvc_function, v8::Function)                             \
345
  V(http2session_on_error_function, v8::Function)                              \
346
  V(http2session_on_frame_error_function, v8::Function)                        \
347
  V(http2session_on_goaway_data_function, v8::Function)                        \
348
  V(http2session_on_headers_function, v8::Function)                            \
349
  V(http2session_on_origin_function, v8::Function)                             \
350
  V(http2session_on_ping_function, v8::Function)                               \
351
  V(http2session_on_priority_function, v8::Function)                           \
352
  V(http2session_on_select_padding_function, v8::Function)                     \
353
  V(http2session_on_settings_function, v8::Function)                           \
354
  V(http2session_on_stream_close_function, v8::Function)                       \
355
  V(http2session_on_stream_trailers_function, v8::Function)                    \
356
  V(http2settings_constructor_template, v8::ObjectTemplate)                    \
357
  V(http2stream_constructor_template, v8::ObjectTemplate)                      \
358
  V(immediate_callback_function, v8::Function)                                 \
359
  V(inspector_console_api_object, v8::Object)                                  \
360
  V(libuv_stream_wrap_ctor_template, v8::FunctionTemplate)                     \
361
  V(message_port, v8::Object)                                                  \
362
  V(message_port_constructor_template, v8::FunctionTemplate)                   \
363
  V(performance_entry_callback, v8::Function)                                  \
364
  V(performance_entry_template, v8::Function)                                  \
365
  V(pipe_constructor_template, v8::FunctionTemplate)                           \
366
  V(process_object, v8::Object)                                                \
367
  V(promise_reject_callback, v8::Function)                                     \
368
  V(promise_wrap_template, v8::ObjectTemplate)                                 \
369
  V(sab_lifetimepartner_constructor_template, v8::FunctionTemplate)            \
370
  V(script_context_constructor_template, v8::FunctionTemplate)                 \
371
  V(script_data_constructor_function, v8::Function)                            \
372
  V(secure_context_constructor_template, v8::FunctionTemplate)                 \
373
  V(shutdown_wrap_template, v8::ObjectTemplate)                                \
374
  V(start_execution_function, v8::Function)                                    \
375
  V(tcp_constructor_template, v8::FunctionTemplate)                            \
376
  V(tick_callback_function, v8::Function)                                      \
377
  V(timers_callback_function, v8::Function)                                    \
378
  V(tls_wrap_constructor_function, v8::Function)                               \
379
  V(trace_category_state_function, v8::Function)                               \
380
  V(tty_constructor_template, v8::FunctionTemplate)                            \
381
  V(udp_constructor_function, v8::Function)                                    \
382
  V(url_constructor_function, v8::Function)                                    \
383
  V(write_wrap_template, v8::ObjectTemplate)
384
385
class Environment;
386
387
class IsolateData {
388
 public:
389
  IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop,
390
              MultiIsolatePlatform* platform = nullptr,
391
              uint32_t* zero_fill_field = nullptr);
392
  ~IsolateData();
393
  inline uv_loop_t* event_loop() const;
394
  inline uint32_t* zero_fill_field() const;
395
  inline MultiIsolatePlatform* platform() const;
396
  inline std::shared_ptr<PerIsolateOptions> options();
397
398
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
399
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
400
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
401
#define V(TypeName, PropertyName)                                             \
402
  inline v8::Local<TypeName> PropertyName(v8::Isolate* isolate) const;
403
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
404
  PER_ISOLATE_SYMBOL_PROPERTIES(VY)
405
  PER_ISOLATE_STRING_PROPERTIES(VS)
406
#undef V
407
#undef VS
408
#undef VP
409
410
  std::unordered_map<nghttp2_rcbuf*, v8::Eternal<v8::String>> http2_static_strs;
411
  inline v8::Isolate* isolate() const;
412
413
 private:
414
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
415
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
416
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
417
#define V(TypeName, PropertyName)                                             \
418
  v8::Eternal<TypeName> PropertyName ## _;
419
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
420
  PER_ISOLATE_SYMBOL_PROPERTIES(VY)
421
  PER_ISOLATE_STRING_PROPERTIES(VS)
422
#undef V
423
#undef VS
424
#undef VP
425
426
  v8::Isolate* const isolate_;
427
  uv_loop_t* const event_loop_;
428
  uint32_t* const zero_fill_field_;
429
  MultiIsolatePlatform* platform_;
430
  std::shared_ptr<PerIsolateOptions> options_;
431
432
  DISALLOW_COPY_AND_ASSIGN(IsolateData);
433
};
434
435
7754
struct ContextInfo {
436
7754
  explicit ContextInfo(const std::string& name) : name(name) {}
437
  const std::string name;
438
  std::string origin;
439
  bool is_default = false;
440
};
441
442
// Listing the AsyncWrap provider types first enables us to cast directly
443
// from a provider type to a debug category.
444
#define DEBUG_CATEGORY_NAMES(V) \
445
    NODE_ASYNC_PROVIDER_TYPES(V) \
446
    V(INSPECTOR_SERVER)
447
448
enum class DebugCategory {
449
#define V(name) name,
450
  DEBUG_CATEGORY_NAMES(V)
451
#undef V
452
  CATEGORY_COUNT
453
};
454
455
class Environment {
456
 public:
457
3338
  class AsyncHooks {
458
   public:
459
    // Reason for both UidFields and Fields are that one is stored as a double*
460
    // and the other as a uint32_t*.
461
    enum Fields {
462
      kInit,
463
      kBefore,
464
      kAfter,
465
      kDestroy,
466
      kPromiseResolve,
467
      kTotals,
468
      kCheck,
469
      kStackLength,
470
      kFieldsCount,
471
    };
472
473
    enum UidFields {
474
      kExecutionAsyncId,
475
      kTriggerAsyncId,
476
      kAsyncIdCounter,
477
      kDefaultTriggerAsyncId,
478
      kUidFieldsCount,
479
    };
480
481
    inline AliasedBuffer<uint32_t, v8::Uint32Array>& fields();
482
    inline AliasedBuffer<double, v8::Float64Array>& async_id_fields();
483
    inline AliasedBuffer<double, v8::Float64Array>& async_ids_stack();
484
485
    inline v8::Local<v8::String> provider_string(int idx);
486
487
    inline void no_force_checks();
488
    inline Environment* env();
489
490
    inline void push_async_ids(double async_id, double trigger_async_id);
491
    inline bool pop_async_id(double async_id);
492
    inline void clear_async_id_stack();  // Used in fatal exceptions.
493
494
    // Used to set the kDefaultTriggerAsyncId in a scope. This is instead of
495
    // passing the trigger_async_id along with other constructor arguments.
496
    class DefaultTriggerAsyncIdScope {
497
     public:
498
      DefaultTriggerAsyncIdScope() = delete;
499
      explicit DefaultTriggerAsyncIdScope(Environment* env,
500
                                          double init_trigger_async_id);
501
      explicit DefaultTriggerAsyncIdScope(AsyncWrap* async_wrap);
502
      ~DefaultTriggerAsyncIdScope();
503
504
     private:
505
      AsyncHooks* async_hooks_;
506
      double old_default_trigger_async_id_;
507
508
      DISALLOW_COPY_AND_ASSIGN(DefaultTriggerAsyncIdScope);
509
    };
510
511
512
   private:
513
    friend class Environment;  // So we can call the constructor.
514
    inline AsyncHooks();
515
    // Keep a list of all Persistent strings used for Provider types.
516
    v8::Eternal<v8::String> providers_[AsyncWrap::PROVIDERS_LENGTH];
517
    // Keep track of the environment copy itself.
518
    Environment* env_;
519
    // Stores the ids of the current execution context stack.
520
    AliasedBuffer<double, v8::Float64Array> async_ids_stack_;
521
    // Attached to a Uint32Array that tracks the number of active hooks for
522
    // each type.
523
    AliasedBuffer<uint32_t, v8::Uint32Array> fields_;
524
    // Attached to a Float64Array that tracks the state of async resources.
525
    AliasedBuffer<double, v8::Float64Array> async_id_fields_;
526
527
    void grow_async_ids_stack();
528
529
    DISALLOW_COPY_AND_ASSIGN(AsyncHooks);
530
  };
531
532
  class AsyncCallbackScope {
533
   public:
534
    AsyncCallbackScope() = delete;
535
    explicit AsyncCallbackScope(Environment* env);
536
    ~AsyncCallbackScope();
537
538
   private:
539
    Environment* env_;
540
541
    DISALLOW_COPY_AND_ASSIGN(AsyncCallbackScope);
542
  };
543
544
  inline size_t makecallback_depth() const;
545
546
3338
  class ImmediateInfo {
547
   public:
548
    inline AliasedBuffer<uint32_t, v8::Uint32Array>& fields();
549
    inline uint32_t count() const;
550
    inline uint32_t ref_count() const;
551
    inline bool has_outstanding() const;
552
553
    inline void count_inc(uint32_t increment);
554
    inline void count_dec(uint32_t decrement);
555
556
    inline void ref_count_inc(uint32_t increment);
557
    inline void ref_count_dec(uint32_t decrement);
558
559
   private:
560
    friend class Environment;  // So we can call the constructor.
561
    inline explicit ImmediateInfo(v8::Isolate* isolate);
562
563
    enum Fields {
564
      kCount,
565
      kRefCount,
566
      kHasOutstanding,
567
      kFieldsCount
568
    };
569
570
    AliasedBuffer<uint32_t, v8::Uint32Array> fields_;
571
572
    DISALLOW_COPY_AND_ASSIGN(ImmediateInfo);
573
  };
574
575
3338
  class TickInfo {
576
   public:
577
    inline AliasedBuffer<uint8_t, v8::Uint8Array>& fields();
578
    inline bool has_tick_scheduled() const;
579
    inline bool has_rejection_to_warn() const;
580
581
   private:
582
    friend class Environment;  // So we can call the constructor.
583
    inline explicit TickInfo(v8::Isolate* isolate);
584
585
    enum Fields {
586
      kHasTickScheduled = 0,
587
      kHasRejectionToWarn,
588
      kFieldsCount
589
    };
590
591
    AliasedBuffer<uint8_t, v8::Uint8Array> fields_;
592
593
    DISALLOW_COPY_AND_ASSIGN(TickInfo);
594
  };
595
596
  static inline Environment* GetCurrent(v8::Isolate* isolate);
597
  static inline Environment* GetCurrent(v8::Local<v8::Context> context);
598
  static inline Environment* GetCurrent(
599
      const v8::FunctionCallbackInfo<v8::Value>& info);
600
601
  template <typename T>
602
  static inline Environment* GetCurrent(
603
      const v8::PropertyCallbackInfo<T>& info);
604
605
  static uv_key_t thread_local_env;
606
  static inline Environment* GetThreadLocalEnv();
607
608
  Environment(IsolateData* isolate_data,
609
              v8::Local<v8::Context> context);
610
  ~Environment();
611
612
  void Start(const std::vector<std::string>& args,
613
             const std::vector<std::string>& exec_args,
614
             bool start_profiler_idle_notifier);
615
616
  typedef void (*HandleCleanupCb)(Environment* env,
617
                                  uv_handle_t* handle,
618
                                  void* arg);
619
  struct HandleCleanup {
620
    uv_handle_t* handle_;
621
    HandleCleanupCb cb_;
622
    void* arg_;
623
  };
624
625
  void RegisterHandleCleanups();
626
  void CleanupHandles();
627
  void Exit(int code);
628
629
  // Register clean-up cb to be called on environment destruction.
630
  inline void RegisterHandleCleanup(uv_handle_t* handle,
631
                                    HandleCleanupCb cb,
632
                                    void* arg);
633
634
  template <typename T, typename OnCloseCallback>
635
  inline void CloseHandle(T* handle, OnCloseCallback callback);
636
637
  inline void AssignToContext(v8::Local<v8::Context> context,
638
                              const ContextInfo& info);
639
640
  void StartProfilerIdleNotifier();
641
  void StopProfilerIdleNotifier();
642
  inline bool profiler_idle_notifier_started() const;
643
644
  inline v8::Isolate* isolate() const;
645
  inline uv_loop_t* event_loop() const;
646
  inline uint32_t watched_providers() const;
647
  inline void TryLoadAddon(const char* filename,
648
                           int flags,
649
                           std::function<bool(binding::DLib*)> was_loaded);
650
651
  static inline Environment* from_timer_handle(uv_timer_t* handle);
652
  inline uv_timer_t* timer_handle();
653
654
  static inline Environment* from_immediate_check_handle(uv_check_t* handle);
655
  inline uv_check_t* immediate_check_handle();
656
  inline uv_idle_t* immediate_idle_handle();
657
658
  inline void IncreaseWaitingRequestCounter();
659
  inline void DecreaseWaitingRequestCounter();
660
661
  inline AsyncHooks* async_hooks();
662
  inline ImmediateInfo* immediate_info();
663
  inline TickInfo* tick_info();
664
  inline uint64_t timer_base() const;
665
666
  inline IsolateData* isolate_data() const;
667
668
  inline bool printed_error() const;
669
  inline void set_printed_error(bool value);
670
671
  void PrintSyncTrace() const;
672
  inline void set_trace_sync_io(bool value);
673
674
  // This stores whether the --abort-on-uncaught-exception flag was passed
675
  // to Node.
676
  inline bool abort_on_uncaught_exception() const;
677
  inline void set_abort_on_uncaught_exception(bool value);
678
  // This is a pseudo-boolean that keeps track of whether an uncaught exception
679
  // should abort the process or not if --abort-on-uncaught-exception was
680
  // passed to Node. If the flag was not passed, it is ignored.
681
  inline AliasedBuffer<uint32_t, v8::Uint32Array>&
682
  should_abort_on_uncaught_toggle();
683
684
  inline AliasedBuffer<uint8_t, v8::Uint8Array>& trace_category_state();
685
  inline AliasedBuffer<int32_t, v8::Int32Array>& stream_base_state();
686
687
  // The necessary API for async_hooks.
688
  inline double new_async_id();
689
  inline double execution_async_id();
690
  inline double trigger_async_id();
691
  inline double get_default_trigger_async_id();
692
693
  // List of id's that have been destroyed and need the destroy() cb called.
694
  inline std::vector<double>* destroy_async_id_list();
695
696
  std::set<std::string> native_modules_with_cache;
697
  std::set<std::string> native_modules_without_cache;
698
699
  std::unordered_multimap<int, loader::ModuleWrap*> hash_to_module_map;
700
  std::unordered_map<uint32_t, loader::ModuleWrap*> id_to_module_map;
701
  std::unordered_map<uint32_t, contextify::ContextifyScript*>
702
      id_to_script_map;
703
704
  inline uint32_t get_next_module_id();
705
  inline uint32_t get_next_script_id();
706
707
  std::unordered_map<std::string, const loader::PackageConfig>
708
      package_json_cache;
709
710
  inline double* heap_statistics_buffer() const;
711
  inline void set_heap_statistics_buffer(double* pointer);
712
713
  inline double* heap_space_statistics_buffer() const;
714
  inline void set_heap_space_statistics_buffer(double* pointer);
715
716
  inline char* http_parser_buffer() const;
717
  inline void set_http_parser_buffer(char* buffer);
718
  inline bool http_parser_buffer_in_use() const;
719
  inline void set_http_parser_buffer_in_use(bool in_use);
720
721
  inline http2::Http2State* http2_state() const;
722
  inline void set_http2_state(std::unique_ptr<http2::Http2State> state);
723
724
  inline bool debug_enabled(DebugCategory category) const;
725
  inline void set_debug_enabled(DebugCategory category, bool enabled);
726
  void set_debug_categories(const std::string& cats, bool enabled);
727
728
  inline AliasedBuffer<double, v8::Float64Array>* fs_stats_field_array();
729
  inline AliasedBuffer<uint64_t, v8::BigUint64Array>*
730
      fs_stats_field_bigint_array();
731
732
  inline std::vector<std::unique_ptr<fs::FileHandleReadWrap>>&
733
      file_handle_read_wrap_freelist();
734
735
  inline performance::performance_state* performance_state();
736
  inline std::unordered_map<std::string, uint64_t>* performance_marks();
737
738
  void CollectExceptionInfo(v8::Local<v8::Value> context,
739
                            int errorno,
740
                            const char* syscall = nullptr,
741
                            const char* message = nullptr,
742
                            const char* path = nullptr);
743
744
  void CollectUVExceptionInfo(v8::Local<v8::Value> context,
745
                              int errorno,
746
                              const char* syscall = nullptr,
747
                              const char* message = nullptr,
748
                              const char* path = nullptr,
749
                              const char* dest = nullptr);
750
751
  // If this flag is set, calls into JS (if they would be observable
752
  // from userland) must be avoided.  This flag does not indicate whether
753
  // calling into JS is allowed from a VM perspective at this point.
754
  inline bool can_call_into_js() const;
755
  inline void set_can_call_into_js(bool can_call_into_js);
756
757
  inline bool has_run_bootstrapping_code() const;
758
  inline void set_has_run_bootstrapping_code(bool has_run_bootstrapping_code);
759
760
  inline bool is_main_thread() const;
761
  inline uint64_t thread_id() const;
762
  inline void set_thread_id(uint64_t id);
763
  inline worker::Worker* worker_context() const;
764
  inline void set_worker_context(worker::Worker* context);
765
  inline void add_sub_worker_context(worker::Worker* context);
766
  inline void remove_sub_worker_context(worker::Worker* context);
767
  void stop_sub_worker_contexts();
768
  inline bool is_stopping_worker() const;
769
770
  inline void ThrowError(const char* errmsg);
771
  inline void ThrowTypeError(const char* errmsg);
772
  inline void ThrowRangeError(const char* errmsg);
773
  inline void ThrowErrnoException(int errorno,
774
                                  const char* syscall = nullptr,
775
                                  const char* message = nullptr,
776
                                  const char* path = nullptr);
777
  inline void ThrowUVException(int errorno,
778
                               const char* syscall = nullptr,
779
                               const char* message = nullptr,
780
                               const char* path = nullptr,
781
                               const char* dest = nullptr);
782
783
  inline v8::Local<v8::FunctionTemplate>
784
      NewFunctionTemplate(v8::FunctionCallback callback,
785
                          v8::Local<v8::Signature> signature =
786
                              v8::Local<v8::Signature>(),
787
                          v8::ConstructorBehavior behavior =
788
                              v8::ConstructorBehavior::kAllow,
789
                          v8::SideEffectType side_effect =
790
                              v8::SideEffectType::kHasSideEffect);
791
792
  // Convenience methods for NewFunctionTemplate().
793
  inline void SetMethod(v8::Local<v8::Object> that,
794
                        const char* name,
795
                        v8::FunctionCallback callback);
796
797
  inline void SetProtoMethod(v8::Local<v8::FunctionTemplate> that,
798
                             const char* name,
799
                             v8::FunctionCallback callback);
800
  inline void SetTemplateMethod(v8::Local<v8::FunctionTemplate> that,
801
                                const char* name,
802
                                v8::FunctionCallback callback);
803
804
  // Safe variants denote the function has no side effects.
805
  inline void SetMethodNoSideEffect(v8::Local<v8::Object> that,
806
                                    const char* name,
807
                                    v8::FunctionCallback callback);
808
  inline void SetProtoMethodNoSideEffect(v8::Local<v8::FunctionTemplate> that,
809
                                         const char* name,
810
                                         v8::FunctionCallback callback);
811
  inline void SetTemplateMethodNoSideEffect(
812
      v8::Local<v8::FunctionTemplate> that,
813
      const char* name,
814
      v8::FunctionCallback callback);
815
816
  void BeforeExit(void (*cb)(void* arg), void* arg);
817
  void RunBeforeExitCallbacks();
818
  void AtExit(void (*cb)(void* arg), void* arg);
819
  void RunAtExitCallbacks();
820
821
  // Strings and private symbols are shared across shared contexts
822
  // The getters simply proxy to the per-isolate primitive.
823
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
824
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
825
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)
826
#define V(TypeName, PropertyName)                                             \
827
  inline v8::Local<TypeName> PropertyName() const;
828
  PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES(VP)
829
  PER_ISOLATE_SYMBOL_PROPERTIES(VY)
830
  PER_ISOLATE_STRING_PROPERTIES(VS)
831
#undef V
832
#undef VS
833
#undef VY
834
#undef VP
835
836
#define V(PropertyName, TypeName)                                             \
837
  inline v8::Local<TypeName> PropertyName() const;                            \
838
  inline void set_ ## PropertyName(v8::Local<TypeName> value);
839
  ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
840
#undef V
841
842
#if HAVE_INSPECTOR
843
37023
  inline inspector::Agent* inspector_agent() const {
844
37023
    return inspector_agent_.get();
845
  }
846
#endif
847
848
  typedef ListHead<HandleWrap, &HandleWrap::handle_wrap_queue_> HandleWrapQueue;
849
  typedef ListHead<ReqWrap<uv_req_t>, &ReqWrap<uv_req_t>::req_wrap_queue_>
850
          ReqWrapQueue;
851
852
17586
  inline HandleWrapQueue* handle_wrap_queue() { return &handle_wrap_queue_; }
853
172488
  inline ReqWrapQueue* req_wrap_queue() { return &req_wrap_queue_; }
854
855
  void AddPromiseHook(promise_hook_func fn, void* arg);
856
  bool RemovePromiseHook(promise_hook_func fn, void* arg);
857
1
  inline bool EmitProcessEnvWarning() {
858
1
    bool current_value = emit_env_nonstring_warning_;
859
1
    emit_env_nonstring_warning_ = false;
860
1
    return current_value;
861
  }
862
863
1
  inline bool EmitErrNameWarning() {
864
1
    bool current_value = emit_err_name_warning_;
865
1
    emit_err_name_warning_ = false;
866
1
    return current_value;
867
  }
868
869
  typedef void (*native_immediate_callback)(Environment* env, void* data);
870
  // cb will be called as cb(env, data) on the next event loop iteration.
871
  // obj will be kept alive between now and after the callback has run.
872
  inline void SetImmediate(native_immediate_callback cb,
873
                           void* data,
874
                           v8::Local<v8::Object> obj = v8::Local<v8::Object>());
875
  inline void SetUnrefImmediate(native_immediate_callback cb,
876
                                void* data,
877
                                v8::Local<v8::Object> obj =
878
                                    v8::Local<v8::Object>());
879
  // This needs to be available for the JS-land setImmediate().
880
  void ToggleImmediateRef(bool ref);
881
882
6676
  class TrackingTraceStateObserver :
883
      public v8::TracingController::TraceStateObserver {
884
   public:
885
3685
    explicit TrackingTraceStateObserver(Environment* env) : env_(env) {}
886
887
75
    void OnTraceEnabled() override {
888
75
      UpdateTraceCategoryState();
889
75
    }
890
891
11
    void OnTraceDisabled() override {
892
11
      UpdateTraceCategoryState();
893
11
    }
894
895
   private:
896
    void UpdateTraceCategoryState();
897
898
    Environment* env_;
899
  };
900
901
  class ShouldNotAbortOnUncaughtScope {
902
   public:
903
    explicit inline ShouldNotAbortOnUncaughtScope(Environment* env);
904
    inline void Close();
905
    inline ~ShouldNotAbortOnUncaughtScope();
906
907
   private:
908
    Environment* env_;
909
  };
910
911
  inline bool inside_should_not_abort_on_uncaught_scope() const;
912
913
  static inline Environment* ForAsyncHooks(AsyncHooks* hooks);
914
915
  v8::Local<v8::Value> GetNow();
916
  void ScheduleTimer(int64_t duration);
917
  void ToggleTimerRef(bool ref);
918
919
  inline void AddCleanupHook(void (*fn)(void*), void* arg);
920
  inline void RemoveCleanupHook(void (*fn)(void*), void* arg);
921
  void RunCleanup();
922
923
  static void BuildEmbedderGraph(v8::Isolate* isolate,
924
                                 v8::EmbedderGraph* graph,
925
                                 void* data);
926
927
  inline std::shared_ptr<EnvironmentOptions> options();
928
  inline std::shared_ptr<HostPort> inspector_host_port();
929
930
 private:
931
  inline void CreateImmediate(native_immediate_callback cb,
932
                              void* data,
933
                              v8::Local<v8::Object> obj,
934
                              bool ref);
935
936
  inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
937
                         const char* errmsg);
938
939
  std::list<binding::DLib> loaded_addons_;
940
  v8::Isolate* const isolate_;
941
  IsolateData* const isolate_data_;
942
  uv_timer_t timer_handle_;
943
  uv_check_t immediate_check_handle_;
944
  uv_idle_t immediate_idle_handle_;
945
  uv_prepare_t idle_prepare_handle_;
946
  uv_check_t idle_check_handle_;
947
  bool profiler_idle_notifier_started_ = false;
948
949
  AsyncHooks async_hooks_;
950
  ImmediateInfo immediate_info_;
951
  TickInfo tick_info_;
952
  const uint64_t timer_base_;
953
  bool printed_error_;
954
  bool abort_on_uncaught_exception_;
955
  bool emit_env_nonstring_warning_;
956
  bool emit_err_name_warning_;
957
  size_t makecallback_cntr_;
958
  std::vector<double> destroy_async_id_list_;
959
960
  std::shared_ptr<EnvironmentOptions> options_;
961
  // options_ contains debug options parsed from CLI arguments,
962
  // while inspector_host_port_ stores the actual inspector host
963
  // and port being used. For example the port is -1 by default
964
  // and can be specified as 0 (meaning any port allocated when the
965
  // server starts listening), but when the inspector server starts
966
  // the inspector_host_port_->port() will be the actual port being
967
  // used.
968
  std::shared_ptr<HostPort> inspector_host_port_;
969
970
  uint32_t module_id_counter_ = 0;
971
  uint32_t script_id_counter_ = 0;
972
973
  AliasedBuffer<uint32_t, v8::Uint32Array> should_abort_on_uncaught_toggle_;
974
  int should_not_abort_scope_counter_ = 0;
975
976
  // Attached to a Uint8Array that tracks the state of trace category
977
  AliasedBuffer<uint8_t, v8::Uint8Array> trace_category_state_;
978
  std::unique_ptr<TrackingTraceStateObserver> trace_state_observer_;
979
980
  AliasedBuffer<int32_t, v8::Int32Array> stream_base_state_;
981
982
  std::unique_ptr<performance::performance_state> performance_state_;
983
  std::unordered_map<std::string, uint64_t> performance_marks_;
984
985
  bool has_run_bootstrapping_code_ = false;
986
  bool can_call_into_js_ = true;
987
  uint64_t thread_id_ = 0;
988
  std::unordered_set<worker::Worker*> sub_worker_contexts_;
989
990
  static void* const kNodeContextTagPtr;
991
  static int const kNodeContextTag;
992
993
#if HAVE_INSPECTOR
994
  std::unique_ptr<inspector::Agent> inspector_agent_;
995
#endif
996
997
  // handle_wrap_queue_ and req_wrap_queue_ needs to be at a fixed offset from
998
  // the start of the class because it is used by
999
  // src/node_postmortem_metadata.cc to calculate offsets and generate debug
1000
  // symbols for Environment, which assumes that the position of members in
1001
  // memory are predictable. For more information please refer to
1002
  // `doc/guides/node-postmortem-support.md`
1003
  friend int GenDebugSymbols();
1004
  HandleWrapQueue handle_wrap_queue_;
1005
  ReqWrapQueue req_wrap_queue_;
1006
  std::list<HandleCleanup> handle_cleanup_queue_;
1007
  int handle_cleanup_waiting_ = 0;
1008
  int request_waiting_ = 0;
1009
1010
  double* heap_statistics_buffer_ = nullptr;
1011
  double* heap_space_statistics_buffer_ = nullptr;
1012
1013
  char* http_parser_buffer_;
1014
  bool http_parser_buffer_in_use_ = false;
1015
  std::unique_ptr<http2::Http2State> http2_state_;
1016
1017
  bool debug_enabled_[static_cast<int>(DebugCategory::CATEGORY_COUNT)] = {0};
1018
1019
  AliasedBuffer<double, v8::Float64Array> fs_stats_field_array_;
1020
  AliasedBuffer<uint64_t, v8::BigUint64Array> fs_stats_field_bigint_array_;
1021
1022
  std::vector<std::unique_ptr<fs::FileHandleReadWrap>>
1023
      file_handle_read_wrap_freelist_;
1024
1025
  worker::Worker* worker_context_ = nullptr;
1026
1027
  static void RunTimers(uv_timer_t* handle);
1028
1029
  struct ExitCallback {
1030
    void (*cb_)(void* arg);
1031
    void* arg_;
1032
  };
1033
  std::list<ExitCallback> before_exit_functions_;
1034
1035
  std::list<ExitCallback> at_exit_functions_;
1036
1037
  struct PromiseHookCallback {
1038
    promise_hook_func cb_;
1039
    void* arg_;
1040
    size_t enable_count_;
1041
  };
1042
  std::vector<PromiseHookCallback> promise_hooks_;
1043
1044
154475
  struct NativeImmediateCallback {
1045
    native_immediate_callback cb_;
1046
    void* data_;
1047
    std::unique_ptr<Persistent<v8::Object>> keep_alive_;
1048
    bool refed_;
1049
  };
1050
  std::vector<NativeImmediateCallback> native_immediate_callbacks_;
1051
  void RunAndClearNativeImmediates();
1052
  static void CheckImmediate(uv_check_t* handle);
1053
1054
  struct CleanupHookCallback {
1055
    void (*fn_)(void*);
1056
    void* arg_;
1057
1058
    // We keep track of the insertion order for these objects, so that we can
1059
    // call the callbacks in reverse order when we are cleaning up.
1060
    uint64_t insertion_order_counter_;
1061
1062
    // Only hashes `arg_`, since that is usually enough to identify the hook.
1063
    struct Hash {
1064
      inline size_t operator()(const CleanupHookCallback& cb) const;
1065
    };
1066
1067
    // Compares by `fn_` and `arg_` being equal.
1068
    struct Equal {
1069
      inline bool operator()(const CleanupHookCallback& a,
1070
                             const CleanupHookCallback& b) const;
1071
    };
1072
1073
    inline BaseObject* GetBaseObject() const;
1074
  };
1075
1076
  // Use an unordered_set, so that we have efficient insertion and removal.
1077
  std::unordered_set<CleanupHookCallback,
1078
                     CleanupHookCallback::Hash,
1079
                     CleanupHookCallback::Equal> cleanup_hooks_;
1080
  uint64_t cleanup_hook_counter_ = 0;
1081
1082
  static void EnvPromiseHook(v8::PromiseHookType type,
1083
                             v8::Local<v8::Promise> promise,
1084
                             v8::Local<v8::Value> parent);
1085
1086
  template <typename T>
1087
  void ForEachBaseObject(T&& iterator);
1088
1089
#define V(PropertyName, TypeName) Persistent<TypeName> PropertyName ## _;
1090
  ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V)
1091
#undef V
1092
1093
  DISALLOW_COPY_AND_ASSIGN(Environment);
1094
};
1095
1096
}  // namespace node
1097
1098
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
1099
1100
#endif  // SRC_ENV_H_