-
Notifications
You must be signed in to change notification settings - Fork 6
/
node-v10.15.3_mods.patch
1721 lines (1629 loc) · 59.3 KB
/
node-v10.15.3_mods.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From 1a771d378d000d0a1bc04ba07d20e098faabad91 Mon Sep 17 00:00:00 2001
From: mfiess200 <[email protected]>
Date: Sat, 11 Apr 2020 17:16:06 -0400
Subject: [PATCH] inspector updates
---
libnode-v10.15.3/common.gypi | 72 +++++++--
libnode-v10.15.3/configure.py | 16 +-
libnode-v10.15.3/deps/http_parser/http_parser.gyp | 8 +-
libnode-v10.15.3/deps/uv/common.gypi | 4 +-
libnode-v10.15.3/deps/uv/include/uv.h | 3 +
libnode-v10.15.3/deps/uv/src/unix/core.c | 44 ++++-
libnode-v10.15.3/deps/uv/src/win/handle.c | 5 +
libnode-v10.15.3/deps/v8/BUILD.gn | 10 +-
libnode-v10.15.3/deps/v8/gypfiles/toolchain.gypi | 16 +-
libnode-v10.15.3/deps/v8/gypfiles/v8.gyp | 14 +-
libnode-v10.15.3/deps/v8/src/isolate.cc | 8 +
libnode-v10.15.3/lib/_tls_wrap.js | 6 +-
libnode-v10.15.3/lib/dns.js | 27 +++-
libnode-v10.15.3/lib/internal/bootstrap/node.js | 19 ++-
.../lib/internal/vm/source_text_module.js | 4 +-
libnode-v10.15.3/lib/net.js | 179 ++++++++++++++++++++-
libnode-v10.15.3/node.gyp | 20 ---
libnode-v10.15.3/src/bootstrapper.cc | 16 +-
libnode-v10.15.3/src/env-inl.h | 21 ++-
libnode-v10.15.3/src/env.h | 14 +-
libnode-v10.15.3/src/module_wrap.cc | 8 +
libnode-v10.15.3/src/module_wrap.h | 2 +
libnode-v10.15.3/src/node.cc | 124 ++++++++++++--
libnode-v10.15.3/src/node.h | 22 ++-
libnode-v10.15.3/src/node_contextify.cc | 79 +++++++++
libnode-v10.15.3/src/node_contextify_mods.h | 19 +++
libnode-v10.15.3/src/node_http_parser.cc | 10 +-
libnode-v10.15.3/src/node_internals.h | 4 +-
libnode-v10.15.3/src/node_platform.cc | 38 +++--
libnode-v10.15.3/src/node_watchdog.cc | 5 +-
libnode-v10.15.3/src/stream_wrap.h | 11 +-
libnode-v10.15.3/src/tcp_wrap.cc | 21 ++-
libnode-v10.15.3/src/tcp_wrap.h | 3 +
libnode-v10.15.3/vcbuild.bat | 12 ++
34 files changed, 744 insertions(+), 120 deletions(-)
create mode 100644 libnode-v10.15.3/src/node_contextify_mods.h
diff --git a/libnode-v10.15.3/common.gypi b/libnode-v10.15.3/common.gypi
index 4c64339..6b40aec 100755
--- a/libnode-v10.15.3/common.gypi
+++ b/libnode-v10.15.3/common.gypi
@@ -107,7 +107,9 @@
'v8_enable_handle_zapping': 1,
},
'defines': [ 'DEBUG', '_DEBUG', 'V8_ENABLE_CHECKS' ],
- 'cflags': [ '-g', '-O0' ],
+ # MODIFIED CODE BEGIN
+ 'cflags': [ '-Os' ],
+ # MODIFIED CODE END
'conditions': [
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
@@ -178,7 +180,9 @@
'variables': {
'v8_enable_handle_zapping': 0,
},
- 'cflags': [ '-O3' ],
+ # MODIFIED CODE BEGIN
+ 'cflags': [ '-Os' ],
+ # MODIFIED CODE END
'conditions': [
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
@@ -215,6 +219,35 @@
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
}],
+ # MODIFIED CODE BEGIN
+ [ 'no_optimization==1', {
+ 'cflags': [ '-O0' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': 0, # /Od, no optimization
+ }
+ }
+ }],
+ [ 'no_optimization!=1', {
+ 'cflags': [ '-Os' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': 3, # /Ox, full optimization
+ 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
+ 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
+ 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalOptions': [
+ '/LTCG', # link time code generation
+ ],
+ },
+ 'VCLinkerTool': {
+ 'OptimizeReferences': 2, # /OPT:REF
+ 'EnableCOMDATFolding': 2, # /OPT:ICF
+ }
+ }
+ }],
['node_shared=="true"', {
'msvs_settings': {
'VCCLCompilerTool': {
@@ -231,17 +264,21 @@
}],
['node_with_ltcg=="true"', {
'msvs_settings': {
- 'VCCLCompilerTool': {
- 'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
- },
- 'VCLibrarianTool': {
- 'AdditionalOptions': [
- '/LTCG:INCREMENTAL', # link time code generation
- ]
- },
+ # MODIFIED CODE BEGIN
+ #'VCCLCompilerTool': {
+ # 'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG
+ #},
+ #'VCLibrarianTool': {
+ # 'AdditionalOptions': [
+ # '/LTCG:INCREMENTAL', # link time code generation
+ # ]
+ #},
+ # MODIFIED CODE END
'VCLinkerTool': {
- 'OptimizeReferences': 2, # /OPT:REF
- 'EnableCOMDATFolding': 2, # /OPT:ICF
+ # MODIFIED CODE BEGIN
+ #'OptimizeReferences': 2, # /OPT:REF
+ #'EnableCOMDATFolding': 2, # /OPT:ICF
+ # MODIFIED CODE END
'LinkIncremental': 1, # disable incremental linking
'AdditionalOptions': [
'/LTCG:INCREMENTAL', # incremental link-time code generation
@@ -261,9 +298,11 @@
],
'msvs_settings': {
'VCCLCompilerTool': {
- 'Optimization': 3, # /Ox, full optimization
- 'FavorSizeOrSpeed': 1, # /Ot, favor speed over size
- 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
+ # MODIFIED CODE BEGIN
+ #'Optimization': 3, # /Ox, full optimization
+ #'FavorSizeOrSpeed': 1, # /Ot, favor speed over size
+ #'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
+ # MODIFIED CODE END
'OmitFramePointers': 'true',
'EnableFunctionLevelLinking': 'true',
'EnableIntrinsicFunctions': 'true',
@@ -513,6 +552,9 @@
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++1y', # -std=gnu++1y
'CLANG_CXX_LIBRARY': 'libc++',
+ # MODIFIED CODE BEGIN
+ 'MACOSX_DEPLOYMENT_TARGET': '10.9',
+ # MODIFIED CODE END
},
}],
],
diff --git a/libnode-v10.15.3/configure.py b/libnode-v10.15.3/configure.py
index 0ad986a..c215ee6 100755
--- a/libnode-v10.15.3/configure.py
+++ b/libnode-v10.15.3/configure.py
@@ -566,6 +566,13 @@ parser.add_option('--without-bundled-v8',
help='do not use V8 includes from the bundled deps folder. ' +
'(This mode is not officially supported for regular applications)')
+# MODIFIED CODE BEGIN
+parser.add_option('--no-optimization',
+ action='store_true',
+ dest='no_optimization',
+ help='build without optimization')
+# MODIFIED CODE END
+
parser.add_option('--build-v8-with-gn',
action='store_true',
dest='build_v8_with_gn',
@@ -1237,8 +1244,10 @@ def configure_openssl(o):
of modern CPU cryptographic instructions and will therefore be slower.
Please refer to BUILDING.md''')
- if options.openssl_no_asm and options.shared_openssl:
- error('--openssl-no-asm is incompatible with --shared-openssl')
+ #MODIFIED CODE BEGIN
+ #if options.openssl_no_asm and options.shared_openssl:
+ # warn('--openssl-no-asm is incompatible with --shared-openssl')
+ #MODIFIED CODE END
if options.openssl_fips:
error('FIPS is not supported in this version of Node.js')
@@ -1608,6 +1617,9 @@ configure_openssl(output)
configure_intl(output)
configure_static(output)
configure_inspector(output)
+# MODIFIED CODE BEGIN
+output['variables']['no_optimization'] = 1 if options.no_optimization else 0
+# MODIFIED CODE END
# variables should be a root level element,
# move everything else to target_defaults
diff --git a/libnode-v10.15.3/deps/http_parser/http_parser.gyp b/libnode-v10.15.3/deps/http_parser/http_parser.gyp
index 4364f73..7137f82 100755
--- a/libnode-v10.15.3/deps/http_parser/http_parser.gyp
+++ b/libnode-v10.15.3/deps/http_parser/http_parser.gyp
@@ -12,7 +12,9 @@
# RuntimeLibrary MUST MATCH across the entire project
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
- 'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ],
+ # MODIFIED CODE BEGIN
+ 'cflags': [ '-Wall', '-Wextra', '-Os', '-g', '-ftrapv' ],
+ # MODIFIED CODE END
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 1, # static debug
@@ -21,7 +23,9 @@
},
'Release': {
'defines': [ 'NDEBUG' ],
- 'cflags': [ '-Wall', '-Wextra', '-O3' ],
+ # MODIFIED CODE BEGIN
+ 'cflags': [ '-Wall', '-Wextra', '-Os' ],
+ # MODIFIED CODE END
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0, # static release
diff --git a/libnode-v10.15.3/deps/uv/common.gypi b/libnode-v10.15.3/deps/uv/common.gypi
index 2297bdf..8298bea 100755
--- a/libnode-v10.15.3/deps/uv/common.gypi
+++ b/libnode-v10.15.3/deps/uv/common.gypi
@@ -46,7 +46,9 @@
'Release': {
'defines': [ 'NDEBUG' ],
'cflags': [
- '-O3',
+ # MODIFIED CODE BEGIN
+ '-Os',
+ # MODIFIED CODE END
],
'msvs_settings': {
'VCCLCompilerTool': {
diff --git a/libnode-v10.15.3/deps/uv/include/uv.h b/libnode-v10.15.3/deps/uv/include/uv.h
index 717c2e5..d08e863 100755
--- a/libnode-v10.15.3/deps/uv/include/uv.h
+++ b/libnode-v10.15.3/deps/uv/include/uv.h
@@ -449,6 +449,9 @@ UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream);
UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream);
UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
+/* MODIFIED CODE BEGIN */
+UV_EXTERN void uv_close_immediate(uv_handle_t* handle, uv_close_cb close_cb);
+/* MODIFIED CODE END */
UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value);
UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value);
diff --git a/libnode-v10.15.3/deps/uv/src/unix/core.c b/libnode-v10.15.3/deps/uv/src/unix/core.c
index f92446f..e71a205 100755
--- a/libnode-v10.15.3/deps/uv/src/unix/core.c
+++ b/libnode-v10.15.3/deps/uv/src/unix/core.c
@@ -304,6 +304,24 @@ static void uv__run_closing_handles(uv_loop_t* loop) {
}
}
+/* MODIFIED CODE BEGIN */
+void uv_close_immediate(uv_handle_t* handle, uv_close_cb close_cb) {
+ assert(!uv__is_closing(handle));
+
+ handle->flags |= UV_HANDLE_CLOSING;
+ handle->close_cb = close_cb;
+
+ switch (handle->type) {
+ case UV_TCP:
+ uv__tcp_close((uv_tcp_t*)handle);
+ uv__finish_close(handle);
+ break;
+
+ default:
+ assert(1);
+ }
+}
+/* MODIFIED CODE END */
int uv_is_closing(const uv_handle_t* handle) {
return uv__is_closing(handle);
@@ -726,9 +744,12 @@ void uv_disable_stdio_inheritance(void) {
/* Set the CLOEXEC flag on all open descriptors. Unconditionally try the
* first 16 file descriptors. After that, bail out after the first error.
*/
- for (fd = 0; ; fd++)
+ /*MODIFIED CODE BEGIN */
+ //for (fd = 0; ; fd++)
+ for (fd = 3; ; fd++)
if (uv__cloexec(fd, 1) && fd > 15)
break;
+ /*MODIFIED CODE END */
}
@@ -1003,6 +1024,9 @@ int uv__open_cloexec(const char* path, int flags) {
int uv__dup2_cloexec(int oldfd, int newfd) {
int r;
+ /*MODIFIED CODE BEGIN*/
+ int flags = 0;
+ /*MODIFIED CODE END*/
#if (defined(__FreeBSD__) && __FreeBSD__ >= 10) || defined(__NetBSD__)
r = dup3(oldfd, newfd, O_CLOEXEC);
if (r == -1)
@@ -1018,9 +1042,23 @@ int uv__dup2_cloexec(int oldfd, int newfd) {
#elif defined(__linux__)
static int no_dup3;
if (!no_dup3) {
+ /* MODIFIED CODE BEGIN */
+ //do
+ // r = uv__dup3(oldfd, newfd, UV__O_CLOEXEC);
+ //while (r == -1 && errno == EBUSY);
do
- r = uv__dup3(oldfd, newfd, UV__O_CLOEXEC);
- while (r == -1 && errno == EBUSY);
+ {
+ if (newfd >=0 && newfd <= 2)
+ {
+ flags = 0;
+ }
+ else
+ {
+ flags = UV__O_CLOEXEC;
+ }
+ r = uv__dup3(oldfd, newfd, flags);
+ }while (r == -1 && (errno == EINTR || errno == EBUSY));
+ /* MODIFIED CODE END */
if (r != -1)
return r;
if (errno != ENOSYS)
diff --git a/libnode-v10.15.3/deps/uv/src/win/handle.c b/libnode-v10.15.3/deps/uv/src/win/handle.c
index 9d76c3f..ceb42f2 100755
--- a/libnode-v10.15.3/deps/uv/src/win/handle.c
+++ b/libnode-v10.15.3/deps/uv/src/win/handle.c
@@ -148,6 +148,11 @@ void uv_close(uv_handle_t* handle, uv_close_cb cb) {
}
}
+/* MODIFIED CODE BEGIN */
+void uv_close_immediate(uv_handle_t* handle, uv_close_cb cb) {
+ uv_close(handle, cb);
+}
+/* MODIFIED CODE END */
int uv_is_closing(const uv_handle_t* handle) {
return !!(handle->flags & (UV_HANDLE_CLOSING | UV_HANDLE_CLOSED));
diff --git a/libnode-v10.15.3/deps/v8/BUILD.gn b/libnode-v10.15.3/deps/v8/BUILD.gn
index 19ffdb3..ff82ac0 100755
--- a/libnode-v10.15.3/deps/v8/BUILD.gn
+++ b/libnode-v10.15.3/deps/v8/BUILD.gn
@@ -1437,8 +1437,6 @@ v8_source_set("v8_base") {
"//base/trace_event/common/trace_event_common.h",
### gcmole(all) ###
- "include/v8-inspector-protocol.h",
- "include/v8-inspector.h",
"include/v8-platform.h",
"include/v8-profiler.h",
"include/v8-testing.h",
@@ -2753,8 +2751,14 @@ v8_source_set("v8_base") {
":v8_headers",
":v8_libbase",
":v8_libsampler",
- "src/inspector:inspector",
]
+ #MODIFIED CODE BEGIN
+ if (v8_enable_inspector) {
+ deps += ["src/inspector:inspector",]
+ sources += [ "include/v8-inspector-protocol.h",]
+ sources += [ "include/v8-inspector.h",]
+ }
+ #MODIFIED CODE END
if (v8_enable_i18n_support) {
public_deps = [
diff --git a/libnode-v10.15.3/deps/v8/gypfiles/toolchain.gypi b/libnode-v10.15.3/deps/v8/gypfiles/toolchain.gypi
index ea8f1c2..60cd77a 100755
--- a/libnode-v10.15.3/deps/v8/gypfiles/toolchain.gypi
+++ b/libnode-v10.15.3/deps/v8/gypfiles/toolchain.gypi
@@ -1225,10 +1225,14 @@
# Don't use -O3 with sanitizers.
['asan==0 and msan==0 and lsan==0 \
and tsan==0 and ubsan==0 and ubsan_vptr==0', {
- 'cflags': ['-O3'],
+ # MODIFIED CODE BEGIN
+ 'cflags': ['-Os'],
+ # MODIFIED CODE END
'cflags!': ['-O2'],
}, {
- 'cflags': ['-O2'],
+ # MODIFIED CODE BEGIN
+ 'cflags': ['-Os'],
+ # MODIFIED CODE END
'cflags!': ['-O3'],
}],
],
@@ -1347,10 +1351,14 @@
# Don't use -O3 with sanitizers.
['asan==0 and msan==0 and lsan==0 \
and tsan==0 and ubsan==0 and ubsan_vptr==0', {
- 'cflags': ['-O3'],
+ # MODIFIED CODE BEGIN
+ 'cflags': ['-Os'],
+ # MODIFIED CODE END
'cflags!': ['-O2'],
}, {
- 'cflags': ['-O2'],
+ # MODIFIED CODE BEGIN
+ 'cflags': ['-Os'],
+ # MODIFIED CODE end
'cflags!': ['-O3'],
}],
],
diff --git a/libnode-v10.15.3/deps/v8/gypfiles/v8.gyp b/libnode-v10.15.3/deps/v8/gypfiles/v8.gyp
index 8c78f02..9367ca6 100755
--- a/libnode-v10.15.3/deps/v8/gypfiles/v8.gyp
+++ b/libnode-v10.15.3/deps/v8/gypfiles/v8.gyp
@@ -434,7 +434,6 @@
# Since this target is a static-library, but as a side effect it generates
# header files, it needs to be a hard dependency.
'hard_dependency': 1,
- 'includes': [ 'inspector.gypi' ],
'dependencies': [
'v8_libbase',
'v8_libsampler',
@@ -453,9 +452,6 @@
'<(SHARED_INTERMEDIATE_DIR)'
],
'sources': [
- '<@(inspector_all_sources)',
- '../include//v8-inspector-protocol.h',
- '../include//v8-inspector.h',
'../include//v8-platform.h',
'../include//v8-profiler.h',
'../include//v8-testing.h',
@@ -1480,6 +1476,16 @@
'<@(torque_generated_pure_headers)',
],
'conditions': [
+ # MODIFIED CODE BEGIN
+ ['v8_enable_inspector==1', {
+ 'sources': [
+ '<@(inspector_all_sources)',
+ '../include//v8-inspector-protocol.h',
+ '../include//v8-inspector.h',
+ ],
+ 'includes': [ 'inspector.gypi' ],
+ }],
+ # MODIFIED CODE END
['want_separate_host_toolset==1', {
'toolsets': ['host', 'target'],
}, {
diff --git a/libnode-v10.15.3/deps/v8/src/isolate.cc b/libnode-v10.15.3/deps/v8/src/isolate.cc
index 0bdfef5..e79edfb 100755
--- a/libnode-v10.15.3/deps/v8/src/isolate.cc
+++ b/libnode-v10.15.3/deps/v8/src/isolate.cc
@@ -1160,6 +1160,14 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) {
HandleScope scope(this);
Handle<Object> exception_handle(exception, this);
+ /* MODIFIED CODE BEGIN */
+ char const* stack_on_exception_enabled = getenv("DUMP_STACK_ON_EXCEPTION");
+ if (stack_on_exception_enabled && (strcmp(stack_on_exception_enabled,"1") == 0))
+ {
+ PrintCurrentStackTrace(stderr);
+ }
+ /* MODIFIED CODE END */
+
if (FLAG_print_all_exceptions) {
printf("=========================================================\n");
printf("Exception thrown:\n");
diff --git a/libnode-v10.15.3/lib/_tls_wrap.js b/libnode-v10.15.3/lib/_tls_wrap.js
index 9bfdd40..0dc161a 100755
--- a/libnode-v10.15.3/lib/_tls_wrap.js
+++ b/libnode-v10.15.3/lib/_tls_wrap.js
@@ -345,16 +345,16 @@ function TLSSocket(socket, opts) {
}
util.inherits(TLSSocket, net.Socket);
exports.TLSSocket = TLSSocket;
-
+/* MODIFIED CODE BEGIN */
var proxiedMethods = [
- 'ref', 'unref', 'open', 'bind', 'listen', 'connect', 'bind6',
+ 'ref', 'unref', 'open', 'bind', 'listen', 'connect', 'bind6', 'reset',
'connect6', 'getsockname', 'getpeername', 'setNoDelay', 'setKeepAlive',
'setSimultaneousAccepts', 'setBlocking',
// PipeWrap
'setPendingInstances'
];
-
+/* MODIFIED CODE END */
// Proxy HandleWrap, PipeWrap and TCPWrap methods
function makeMethodProxy(name) {
return function methodProxy(...args) {
diff --git a/libnode-v10.15.3/lib/dns.js b/libnode-v10.15.3/lib/dns.js
index f90d7c1..b151f53 100755
--- a/libnode-v10.15.3/lib/dns.js
+++ b/libnode-v10.15.3/lib/dns.js
@@ -69,15 +69,30 @@ function onlookupall(err, addresses) {
}
var family = this.family;
+ /* MODIFIED CODE BEGIN */
+ var ipV4Addresses = [];
+ var ipV4count = 0;
+ var ipV6Addresses = []
+ var ipV6count = 0;
+ var result = {}
for (var i = 0; i < addresses.length; i++) {
const addr = addresses[i];
- addresses[i] = {
- address: addr,
- family: family || (isIPv4(addr) ? 4 : 6)
- };
+ var addrfamily = family || (isIPv4(addr) ? 4 : 6)
+ if (addrfamily == 4) {
+ ipV4Addresses[ipV4count] = {address: addr, family: addrfamily}
+ ipV4count++;
+ }
+ else {
+ ipV6Addresses[ipV6count] = {address: addr, family: addrfamily}
+ ipV6count++;
+ }
}
-
- this.callback(null, addresses);
+ result['v4address'] = ipV4Addresses
+ result['v4count'] = ipV4count
+ result['v6address'] = ipV6Addresses
+ result['v6count'] = ipV6count
+ this.callback(null, result);
+ /* MODIFIED CODE END */
}
diff --git a/libnode-v10.15.3/lib/internal/bootstrap/node.js b/libnode-v10.15.3/lib/internal/bootstrap/node.js
index b168eb0..82cdec8 100755
--- a/libnode-v10.15.3/lib/internal/bootstrap/node.js
+++ b/libnode-v10.15.3/lib/internal/bootstrap/node.js
@@ -257,11 +257,12 @@
// User passed '-e' or '--eval' arguments to Node without '-i' or
// '--interactive'.
preloadModules();
-
- const {
- addBuiltinLibsToObject
- } = NativeModule.require('internal/modules/cjs/helpers');
- addBuiltinLibsToObject(global);
+ /* MODIFIED CODE BEGIN */
+ //const {
+ // addBuiltinLibsToObject
+ //} = NativeModule.require('internal/modules/cjs/helpers');
+ //addBuiltinLibsToObject(global);
+ /* MODIFIED CODE END */
evalScript('[eval]');
} else if (process.argv[1] && process.argv[1] !== '-') {
// Make process.argv[1] into a full path.
@@ -284,7 +285,9 @@
} else {
preloadModules();
// If -i or --interactive were passed, or stdin is a TTY.
- if (process._forceRepl || NativeModule.require('tty').isatty(0)) {
+ /* MODIFIED CODE BEGIN */
+ //if (process._forceRepl || NativeModule.require('tty').isatty(0)) {
+ /* MODIFIED CODE END */
// REPL
const cliRepl = NativeModule.require('internal/repl');
cliRepl.createInternalRepl(process.env, (err, repl) => {
@@ -306,6 +309,8 @@
// User passed '-e' or '--eval'
evalScript('[eval]');
}
+/* MODIFIED CODE BEGIN */
+/*
} else {
// Read all of stdin - execute it.
process.stdin.setEncoding('utf8');
@@ -324,6 +329,8 @@
}
});
}
+*/
+/* MODIFIED CODE END */
}
}
}
diff --git a/libnode-v10.15.3/lib/internal/vm/source_text_module.js b/libnode-v10.15.3/lib/internal/vm/source_text_module.js
index 1898831..8468f94 100755
--- a/libnode-v10.15.3/lib/internal/vm/source_text_module.js
+++ b/libnode-v10.15.3/lib/internal/vm/source_text_module.js
@@ -132,7 +132,9 @@ class SourceTextModule {
Object.defineProperties(this, {
url: { value: url, enumerable: true },
- context: { value: context, enumerable: true },
+ // getter leaks... to prevent this make the property configurable and delete when necessary
+ //context: { value: context, enumerable: true },
+ context: { value: context, enumerable: true, configurable: true},
});
}
diff --git a/libnode-v10.15.3/lib/net.js b/libnode-v10.15.3/lib/net.js
index e40aaa8..793014f 100755
--- a/libnode-v10.15.3/lib/net.js
+++ b/libnode-v10.15.3/lib/net.js
@@ -812,6 +812,119 @@ function checkBindError(err, port, handle) {
return err;
}
+/* MODIFIED CODE BEGIN */
+function internalConnectMultipleAddress(
+ self, address, port, localAddress, localPort) {
+ var ipV4addresses = address['v4address']
+ var ipv4count = address['v4count']
+ var ipV6addresses = address['v6address']
+ var ipv6count = address['v6count']
+ var tempLocalAddress = "";
+ var bindSucceeded = true;
+ var connectSucceeded = false;
+ var err;
+
+ // IPV6 bind
+ bindSucceeded = true;
+ if (localAddress || localPort) {
+ tempLocalAddress = localAddress || '::';
+ err = self._handle.bind6(tempLocalAddress, localPort);
+ debug('binding to localAddress: %s and localPort: %d (addressType: 6)',
+ tempLocalAddress, localPort);
+
+ err = checkBindError(err, localPort, self._handle);
+ if (err) {
+ console.log("Bind error for IPV6 : " + err + " happened for " + tempLocalAddress + " and port " + localPort);
+ bindSucceeded = false;
+ }
+ }
+
+ // IPV6 connect
+ connectSucceeded = false;
+ if (true == bindSucceeded) {
+ for (var i=0; i<ipv6count; i++)
+ {
+ connectSucceeded = internalConnectWithReturn(self, ipV6addresses[i].address, port, ipV6addresses[i].family, tempLocalAddress, localPort);
+ if (true == connectSucceeded)
+ break;
+ }
+ }
+
+ // try for ipv4 if ipv6 connect fails
+ if (false == connectSucceeded) {
+ self._handle.reset(); //call to prepare IPV4 socket
+
+ bindSucceeded = true;
+ // IPV4 bind
+ if (localAddress || localPort) {
+ tempLocalAddress = localAddress || '0.0.0.0';
+ err = self._handle.bind(tempLocalAddress, localPort);
+ debug('binding to localAddress: %s and localPort: %d (addressType: 4)',
+ tempLocalAddress, localPort);
+
+ err = checkBindError(err, localPort, self._handle);
+ if (err) {
+ console.log("Bind error for IPV4 : " + err + " happened for " + tempLocalAddress + " and port " + localPort);
+ bindSucceeded = false;
+ }
+ }
+
+ connectSucceeded = false;
+ if (true == bindSucceeded) {
+ for (var i=0; i<ipv4count; i++)
+ {
+ connectSucceeded = internalConnectWithReturn(self, ipV4addresses[i].address, port, ipV4addresses[i].family, tempLocalAddress, localPort);
+ if (true == connectSucceeded)
+ break;
+ }
+ }
+ }
+
+ if ((false == bindSucceeded) || (false == connectSucceeded))
+ {
+ var details = "Address: " + localAddress + ", port: " + localPort
+ console.log("Multiple address connection failed connect - " + address + ":" + port + " " + details);
+ self.destroy();
+ }
+}
+
+function internalConnectWithReturn(self, address, port, addressType, localAddress, localPort)
+{
+ assert(self.connecting);
+ var ret = false;
+ var err;
+
+ if (addressType === 6 || addressType === 4) {
+ const req = new TCPConnectWrap();
+ req.oncomplete = afterConnectAll;
+ req.address = address;
+ req.port = port;
+ req.localAddress = localAddress;
+ req.localPort = localPort;
+
+ if (addressType === 4)
+ err = self._handle.connect(req, address, port);
+ else
+ err = self._handle.connect6(req, address, port);
+ }
+
+ if (err) {
+ var sockname = self._getsockname();
+ var details;
+
+ if (sockname) {
+ details = sockname.address + ':' + sockname.port;
+ }
+
+ console.log("Connect error happened : " + err + " , " + details + " , " + address + ":" + port + " ,family: " + addressType);
+ }
+ else
+ {
+ ret = true;
+ }
+ return ret;
+}
+/* MODIFIED CODE END */
function internalConnect(
self, address, port, addressType, localAddress, localPort) {
@@ -974,11 +1087,13 @@ function lookupAndConnect(self, options) {
if (dns === undefined) dns = require('dns');
+ /* MODIFIED CODE BEGIN */
var dnsopts = {
family: options.family,
- hints: options.hints || 0
+ hints: options.hints || 0,
};
-
+ dnsopts.all = true;
+ /* MODIFIED CODE END */
if (process.platform !== 'win32' &&
dnsopts.family !== 4 &&
dnsopts.family !== 6 &&
@@ -1008,7 +1123,9 @@ function lookupAndConnect(self, options) {
err.port = options.port;
err.message = err.message + ' ' + options.host + ':' + options.port;
process.nextTick(connectErrorNT, self, err);
- } else if (addressType !== 4 && addressType !== 6) {
+ /* MODIFIED CODE BEGIN */
+ } else if ((false == dnsopts.all) && addressType !== 4 && addressType !== 6) {
+ /* MODIFIED CODE END */
err = new ERR_INVALID_ADDRESS_FAMILY(addressType);
err.host = options.host;
err.port = options.port;
@@ -1016,11 +1133,22 @@ function lookupAndConnect(self, options) {
process.nextTick(connectErrorNT, self, err);
} else {
self._unrefTimer();
- defaultTriggerAsyncIdScope(
- self[async_id_symbol],
- internalConnect,
- self, ip, port, addressType, localAddress, localPort
- );
+ /* MODIFIED CODE BEGIN */
+ if (dnsopts.all) {
+ defaultTriggerAsyncIdScope(
+ self[async_id_symbol],
+ internalConnectMultipleAddress,
+ self, ip, port, localAddress, localPort
+ );
+ }
+ else {
+ defaultTriggerAsyncIdScope(
+ self[async_id_symbol],
+ internalConnect,
+ self, ip, port, addressType, localAddress, localPort
+ );
+ }
+ /* MODIFIED CODE END */
}
});
});
@@ -1107,6 +1235,41 @@ function afterConnect(status, handle, req, readable, writable) {
}
}
+/* MODIFIED CODE BEGIN */
+function afterConnectAll(status, handle, req, readable, writable) {
+ var self = handle[owner_symbol];
+
+ // callback may come after call to destroy
+ if (self.destroyed) {
+ return;
+ }
+
+ debug('afterConnectAll');
+
+ assert(self.connecting);
+
+ if (status === 0) {
+ self.connecting = false;
+ self._sockname = null;
+ self.readable = readable;
+ if (!self._writableState.ended)
+ self.writable = writable;
+ self._unrefTimer();
+
+ self.emit('connect');
+ self.emit('ready');
+
+ // start the first read, or get an immediate EOF.
+ // this doesn't actually consume any bytes, because len=0.
+ if (readable && !self.isPaused())
+ self.read(0);
+
+ } else {
+ if (util === undefined) util = require('util');
+ const code = util.getSystemErrorName(status);
+ }
+}
+/* MODIFIED CODE END */
function Server(options, connectionListener) {
if (!(this instanceof Server))
diff --git a/libnode-v10.15.3/node.gyp b/libnode-v10.15.3/node.gyp
index a8de196..607a7db 100755
--- a/libnode-v10.15.3/node.gyp
+++ b/libnode-v10.15.3/node.gyp
@@ -36,7 +36,6 @@
'lib/console.js',
'lib/constants.js',
'lib/crypto.js',
- 'lib/cluster.js',
'lib/dgram.js',
'lib/dns.js',
'lib/domain.js',
@@ -89,12 +88,6 @@
'lib/internal/buffer.js',
'lib/internal/cli_table.js',
'lib/internal/child_process.js',
- 'lib/internal/cluster/child.js',
- 'lib/internal/cluster/master.js',
- 'lib/internal/cluster/round_robin_handle.js',
- 'lib/internal/cluster/shared_handle.js',
- 'lib/internal/cluster/utils.js',
- 'lib/internal/cluster/worker.js',
'lib/internal/crypto/certificate.js',
'lib/internal/crypto/cipher.js',
'lib/internal/crypto/diffiehellman.js',
@@ -168,8 +161,6 @@
'lib/internal/http2/core.js',
'lib/internal/http2/compat.js',
'lib/internal/http2/util.js',
- 'lib/internal/v8_prof_polyfill.js',
- 'lib/internal/v8_prof_processor.js',
'lib/internal/validators.js',
'lib/internal/stream_base_commons.js',
'lib/internal/vm/source_text_module.js',
@@ -184,17 +175,6 @@
'lib/internal/streams/pipeline.js',
'lib/internal/streams/end-of-stream.js',
'lib/internal/wrap_js_stream.js',
- 'deps/v8/tools/splaytree.js',
- 'deps/v8/tools/codemap.js',
- 'deps/v8/tools/consarray.js',
- 'deps/v8/tools/csvparser.js',
- 'deps/v8/tools/profile.js',
- 'deps/v8/tools/profile_view.js',
- 'deps/v8/tools/logreader.js',
- 'deps/v8/tools/arguments.js',
- 'deps/v8/tools/tickprocessor.js',
- 'deps/v8/tools/SourceMap.js',
- 'deps/v8/tools/tickprocessor-driver.js',
'deps/node-inspect/lib/_inspect.js',
'deps/node-inspect/lib/internal/inspect_client.js',
'deps/node-inspect/lib/internal/inspect_repl.js',
diff --git a/libnode-v10.15.3/src/bootstrapper.cc b/libnode-v10.15.3/src/bootstrapper.cc
index d23a145..ee2f1a2 100755
--- a/libnode-v10.15.3/src/bootstrapper.cc
+++ b/libnode-v10.15.3/src/bootstrapper.cc
@@ -8,6 +8,9 @@
namespace node {
using v8::Array;
+/* MODIFIED CODE BEGIN */
+using v8::ArrayBuffer;
+/* MODIFIED CODE END */
using v8::Context;
using v8::Function;
using v8::FunctionCallbackInfo;
@@ -24,6 +27,10 @@ using v8::Promise;
using v8::PromiseRejectEvent;
using v8::PromiseRejectMessage;
using v8::String;
+/* MODIFIED CODE BEGIN */
+using v8::Uint32Array;
+using v8::Uint8Array;
+/* MODIFIED CODE END */
using v8::Value;
void SetupProcessObject(const FunctionCallbackInfo<Value>& args) {
@@ -51,7 +58,14 @@ void SetupNextTick(const FunctionCallbackInfo<Value>& args) {
run_microtasks_fn->SetName(FIXED_ONE_BYTE_STRING(isolate, "runMicrotasks"));
Local<Array> ret = Array::New(isolate, 2);
- ret->Set(context, 0, env->tick_info()->fields().GetJSArray()).FromJust();
+/* MODIFIED CODE BEGIN */
+ uint32_t* const fields = env->tick_info()->fields();
+ uint32_t const fields_count = env->tick_info()->fields_count();
+ Local<ArrayBuffer> array_buffer =
+ ArrayBuffer::New(env->isolate(), fields, sizeof(*fields) * fields_count);
+ ret->Set(context, 0, Uint32Array::New(array_buffer, 0, fields_count)).FromJust();
+ //ret->Set(context, 0, env->tick_info()->fields().GetJSArray()).FromJust();
+/* MODIFIED CODE END */
ret->Set(context, 1, run_microtasks_fn).FromJust();
args.GetReturnValue().Set(ret);
diff --git a/libnode-v10.15.3/src/env-inl.h b/libnode-v10.15.3/src/env-inl.h
index 4af5add..89a4c03 100755
--- a/libnode-v10.15.3/src/env-inl.h
+++ b/libnode-v10.15.3/src/env-inl.h
@@ -156,13 +156,16 @@ inline bool Environment::AsyncHooks::pop_async_id(double async_id) {
"actual: %.f, expected: %.f)\n",
async_id_fields_.GetValue(kExecutionAsyncId),
async_id);
+ /* MODIFIED CODE BEGIN */
+ /*
DumpBacktrace(stderr);
fflush(stderr);
if (!env()->abort_on_uncaught_exception())
exit(1);
fprintf(stderr, "\n");
fflush(stderr);
- ABORT_NO_BACKTRACE();
+ ABORT_NO_BACKTRACE(); */
+ /* MODIFIED CODE END */
}
uint32_t offset = fields_[kStackLength] - 1;
@@ -259,12 +262,24 @@ inline void Environment::ImmediateInfo::ref_count_dec(uint32_t decrement) {
}
inline Environment::TickInfo::TickInfo(v8::Isolate* isolate)
- : fields_(isolate, kFieldsCount) {}
+/* MODIFIED CODE BEGIN */
+ {
+ for (int i = 0; i < kFieldsCount; ++i)
+ fields_[i] = 0;
+/* MODIFIED CODE END */
+}
-inline AliasedBuffer<uint8_t, v8::Uint8Array>& Environment::TickInfo::fields() {
+/* MODIFIED CODE BEGIN */
+//inline AliasedBuffer<uint8_t, v8::Uint8Array>& Environment::TickInfo::fields() {
+inline uint32_t* Environment::TickInfo::fields() {
return fields_;
}
+inline int Environment::TickInfo::fields_count() const {
+ return kFieldsCount;
+}
+/* MODIFIED CODE END */
+
inline bool Environment::TickInfo::has_scheduled() const {
return fields_[kHasScheduled] == 1;
}
diff --git a/libnode-v10.15.3/src/env.h b/libnode-v10.15.3/src/env.h
index 66c69e8..e229a8f 100755
--- a/libnode-v10.15.3/src/env.h
+++ b/libnode-v10.15.3/src/env.h
@@ -558,7 +558,12 @@ class Environment {
class TickInfo {
public:
- inline AliasedBuffer<uint8_t, v8::Uint8Array>& fields();
+/* MODIFIED CODE BEGIN */
+ //inline AliasedBuffer<uint8_t, v8::Uint8Array>& fields();
+ //inline AliasedBuffer<uint32_t, v8::Uint32Array>& fields();
+ inline uint32_t* fields();
+ inline int fields_count() const;
+/* MODIFIED CODE END */
inline bool has_scheduled() const;
inline bool has_promise_rejections() const;
inline bool has_thrown() const;
@@ -576,9 +581,10 @@ class Environment {
kHasThrown,
kFieldsCount
};
-
- AliasedBuffer<uint8_t, v8::Uint8Array> fields_;
-
+/* MODIFIED CODE BEGIN */
+ //AliasedBuffer<uint32_t, v8::Uint32Array> fields_;
+ uint32_t fields_[kFieldsCount];