@@ -95,76 +95,51 @@ using namespace v8;
9595extern char **environ;
9696# endif
9797
98- namespace node {
99-
100- static Persistent<Object> process;
101-
102- static Persistent<String> errno_symbol;
103- static Persistent<String> syscall_symbol;
104- static Persistent<String> errpath_symbol;
105- static Persistent<String> code_symbol;
106-
107- static Persistent<String> rss_symbol;
108- static Persistent<String> heap_total_symbol;
109- static Persistent<String> heap_used_symbol;
110-
111- static Persistent<String> listeners_symbol;
112- static Persistent<String> uncaught_exception_symbol;
113- static Persistent<String> emit_symbol;
11498
99+ #include < node_vars.h>
100+
101+ // We do the following to minimize the detal between v0.6 branch. We want to
102+ // use the variables as they were being used before.
103+ #define check_tick_watcher NODE_VAR (check_tick_watcher)
104+ #define code_symbol NODE_VAR (code_symbol)
105+ #define debug_port NODE_VAR (debug_port)
106+ #define debug_wait_connect NODE_VAR (debug_wait_connect)
107+ #define emit_symbol NODE_VAR (emit_symbol)
108+ #define errno_symbol NODE_VAR (errno_symbol)
109+ #define errpath_symbol NODE_VAR (errpath_symbol)
110+ #define eval_string NODE_VAR (eval_string)
111+ #define gc_check NODE_VAR (gc_check)
112+ #define gc_idle NODE_VAR (gc_idle)
113+ #define gc_timer NODE_VAR (gc_timer)
114+ #define getbuf NODE_VAR (getbuf)
115+ #define heap_total_symbol NODE_VAR (heap_total_symbol)
116+ #define heap_used_symbol NODE_VAR (heap_used_symbol)
117+ #define listeners_symbol NODE_VAR (listeners_symbol)
118+ #define max_stack_size NODE_VAR (max_stack_size)
119+ #define need_tick_cb NODE_VAR (need_tick_cb)
120+ #define option_end_index NODE_VAR (option_end_index)
121+ #define prepare_tick_watcher NODE_VAR (prepare_tick_watcher)
122+ #define print_eval NODE_VAR (print_eval)
123+ #define process NODE_VAR (process)
124+ #define rss_symbol NODE_VAR (rss_symbol)
125+ #define syscall_symbol NODE_VAR (syscall_symbol)
126+ #define tick_callback_sym NODE_VAR (tick_callback_sym)
127+ #define tick_spinner NODE_VAR (tick_spinner)
128+ #define tick_time_head NODE_VAR (tick_time_head)
129+ #define tick_times NODE_VAR (tick_times)
130+ #define uncaught_exception_symbol NODE_VAR (uncaught_exception_symbol)
131+ #define use_debug_agent NODE_VAR (use_debug_agent)
132+ #define use_npn NODE_VAR (use_npn)
133+ #define use_sni NODE_VAR (use_sni)
115134
116- static bool print_eval = false ;
117- static char *eval_string = NULL ;
118- static int option_end_index = 0 ;
119- static bool use_debug_agent = false ;
120- static bool debug_wait_connect = false ;
121- static int debug_port=5858 ;
122- static int max_stack_size = 0 ;
123135
124- static uv_check_t check_tick_watcher;
125- static uv_prepare_t prepare_tick_watcher;
126- static uv_idle_t tick_spinner;
127- static bool need_tick_cb;
128- static Persistent<String> tick_callback_sym;
129-
130-
131- #ifdef OPENSSL_NPN_NEGOTIATED
132- static bool use_npn = true ;
133- #else
134- static bool use_npn = false ;
135- #endif
136+ namespace node {
136137
137- #ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
138- static bool use_sni = true ;
139- #else
140- static bool use_sni = false ;
141- #endif
142138
143- #ifdef __POSIX__
144- // Buffer for getpwnam_r(), getgrpam_r() and other misc callers; keep this
145- // scoped at file-level rather than method-level to avoid excess stack usage.
146- static char getbuf[PATH_MAX + 1 ];
147- #endif
148139
149- // We need to notify V8 when we're idle so that it can run the garbage
150- // collector. The interface to this is V8::IdleNotification(). It returns
151- // true if the heap hasn't be fully compacted, and needs to be run again.
152- // Returning false means that it doesn't have anymore work to do.
153- //
154- // A rather convoluted algorithm has been devised to determine when Node is
155- // idle. You'll have to figure it out for yourself.
156- static uv_check_t gc_check;
157- static uv_idle_t gc_idle;
158- static uv_timer_t gc_timer;
159- bool need_gc;
140+ #define TICK_TIME (n ) tick_times[(tick_time_head - (n)) % RPM_SAMPLES]
160141
161142
162- #define FAST_TICK 700 .
163- #define GC_WAIT_TIME 5000 .
164- #define RPM_SAMPLES 100
165- #define TICK_TIME (n ) tick_times[(tick_time_head - (n)) % RPM_SAMPLES]
166- static int64_t tick_times[RPM_SAMPLES];
167- static int tick_time_head;
168143
169144static void CheckStatus (uv_timer_t * watcher, int status);
170145
0 commit comments