@@ -108,6 +108,11 @@ using v8::V8;
108
108
using v8::Value;
109
109
using v8::kExternalUint32Array ;
110
110
111
+ bool g_standalone_mode = true ;
112
+ bool g_upstream_node_mode = true ;
113
+ bool use_debug_agent = false ;
114
+ bool debug_wait_connect = false ;
115
+
111
116
static bool print_eval = false ;
112
117
static bool force_repl = false ;
113
118
static bool trace_deprecation = false ;
@@ -116,8 +121,6 @@ static bool abort_on_uncaught_exception = false;
116
121
static const char * eval_string = nullptr ;
117
122
static unsigned int preload_module_count = 0 ;
118
123
static const char ** preload_modules = nullptr ;
119
- static bool use_debug_agent = false ;
120
- static bool debug_wait_connect = false ;
121
124
static int debug_port = 5858 ;
122
125
static bool v8_is_profiling = false ;
123
126
static bool node_is_initialized = false ;
@@ -1089,6 +1092,7 @@ Handle<Value> MakeCallback(Environment* env,
1089
1092
env->tick_callback_function ()->Call (process, 0 , nullptr );
1090
1093
CHECK_EQ (env->context (), env->isolate ()->GetCurrentContext ());
1091
1094
1095
+ if (!g_standalone_mode) try_catch.Reset ();
1092
1096
if (try_catch.HasCaught ()) {
1093
1097
return Undefined (env->isolate ());
1094
1098
}
@@ -1115,6 +1119,7 @@ Handle<Value> MakeCallback(Environment* env,
1115
1119
1116
1120
tick_info->set_in_tick (false );
1117
1121
1122
+ if (!g_standalone_mode) try_catch.Reset ();
1118
1123
if (try_catch.HasCaught ()) {
1119
1124
tick_info->set_last_threw (true );
1120
1125
return Undefined (env->isolate ());
@@ -2891,8 +2896,12 @@ static void RawDebug(const FunctionCallbackInfo<Value>& args) {
2891
2896
void LoadEnvironment (Environment* env) {
2892
2897
HandleScope handle_scope (env->isolate ());
2893
2898
2899
+ if (g_upstream_node_mode) { // No indent to minimize diff.
2894
2900
env->isolate ()->SetFatalErrorHandler (node::OnFatalError);
2901
+ } // g_upstream_node_mode
2902
+ if (g_standalone_mode) { // No indent to minimize diff.
2895
2903
env->isolate ()->AddMessageListener (OnMessage);
2904
+ } // g_standalone_mode
2896
2905
2897
2906
// Compile, execute the src/node.js file. (Which was included as static C
2898
2907
// string in node_natives.h. 'natve_node' is the string containing that
@@ -3188,7 +3197,7 @@ static void DispatchMessagesDebugAgentCallback(Environment* env) {
3188
3197
}
3189
3198
3190
3199
3191
- static void StartDebug (Environment* env, bool wait ) {
3200
+ void StartDebug (Environment* env, bool wait ) {
3192
3201
CHECK (!debugger_running);
3193
3202
3194
3203
env->debugger_agent ()->set_dispatch_handler (
@@ -3203,7 +3212,7 @@ static void StartDebug(Environment* env, bool wait) {
3203
3212
3204
3213
3205
3214
// Called from the main thread.
3206
- static void EnableDebug (Environment* env) {
3215
+ void EnableDebug (Environment* env) {
3207
3216
CHECK (debugger_running);
3208
3217
3209
3218
// Send message to enable debug in workers
@@ -3531,6 +3540,7 @@ void Init(int* argc,
3531
3540
// Initialize prog_start_time to get relative uptime.
3532
3541
prog_start_time = static_cast <double >(uv_now (uv_default_loop ()));
3533
3542
3543
+ if (g_upstream_node_mode) { // No indent to minimize diff.
3534
3544
// Make inherited handles noninheritable.
3535
3545
uv_disable_stdio_inheritance ();
3536
3546
@@ -3595,12 +3605,17 @@ void Init(int* argc,
3595
3605
const char expose_debug_as[] = " --expose_debug_as=v8debug" ;
3596
3606
V8::SetFlagsFromString (expose_debug_as, sizeof (expose_debug_as) - 1 );
3597
3607
}
3608
+ } // g_upstream_node_mode
3598
3609
3610
+ #if 0
3599
3611
V8::SetArrayBufferAllocator(&ArrayBufferAllocator::the_singleton);
3612
+ #endif
3600
3613
3614
+ if (g_upstream_node_mode) { // No indent to minimize diff.
3601
3615
if (!use_debug_agent) {
3602
3616
RegisterDebugSignalHandler ();
3603
3617
}
3618
+ } // g_upstream_node_mode
3604
3619
3605
3620
// We should set node_is_initialized here instead of in node::Start,
3606
3621
// otherwise embedders using node::Init to initialize everything will not be
0 commit comments