Skip to content

Commit dd6e3f6

Browse files
committed
src: fix comments re PER_ISOLATE macros
PR-URL: #12899 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James Snell <[email protected]>
1 parent 13487c4 commit dd6e3f6

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/env-inl.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636

3737
namespace node {
3838

39-
// Create string properties as internalized one byte strings.
39+
inline IsolateData::IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop,
40+
uint32_t* zero_fill_field) :
41+
42+
// Create string and private symbol properties as internalized one byte strings.
4043
//
4144
// Internalized because it makes property lookups a little faster and because
4245
// the string is created in the old space straight away. It's going to end up
@@ -45,9 +48,6 @@ namespace node {
4548
//
4649
// One byte because our strings are ASCII and we can safely skip V8's UTF-8
4750
// decoding step. It's a one-time cost, but why pay it when you don't have to?
48-
inline IsolateData::IsolateData(v8::Isolate* isolate, uv_loop_t* event_loop,
49-
uint32_t* zero_fill_field)
50-
:
5151
#define V(PropertyName, StringValue) \
5252
PropertyName ## _( \
5353
isolate, \

src/env.h

+11-8
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@
4040
#include <stdint.h>
4141
#include <vector>
4242

43-
// Caveat emptor: we're going slightly crazy with macros here but the end
44-
// hopefully justifies the means. We have a lot of per-context properties
45-
// and adding and maintaining their getters and setters by hand would be
46-
// a nightmare so let's make the preprocessor generate them for us.
47-
//
48-
// Make sure that any macros defined here are undefined again at the bottom
49-
// of context-inl.h. The exceptions are NODE_CONTEXT_EMBEDDER_DATA_INDEX
50-
// and NODE_ISOLATE_SLOT, they may have been defined externally.
5143
namespace node {
5244

5345
// Pick an index that's hopefully out of the way when we're embedded inside
@@ -64,6 +56,17 @@ namespace node {
6456
#define NODE_PUSH_VAL_TO_ARRAY_MAX 8
6557
#endif
6658

59+
// PER_ISOLATE_* macros: We have a lot of per-isolate properties
60+
// and adding and maintaining their getters and setters by hand would be
61+
// difficult so let's make the preprocessor generate them for us.
62+
//
63+
// In each macro, `V` is expected to be the name of a macro or function which
64+
// accepts the number of arguments provided in each tuple in the macro body,
65+
// typically two. The named function will be invoked against each tuple.
66+
//
67+
// Make sure that any macro V defined for use with the PER_ISOLATE_* macros is
68+
// undefined again after use.
69+
6770
// Private symbols are per-isolate primitives but Environment proxies them
6871
// for the sake of convenience. Strings should be ASCII-only and have a
6972
// "node:" prefix to avoid name clashes with third-party code.

0 commit comments

Comments
 (0)