@@ -132,11 +132,14 @@ using v8::Array;
132
132
using v8::ArrayBuffer;
133
133
using v8::Boolean ;
134
134
using v8::Context;
135
+ using v8::DEFAULT;
136
+ using v8::DontEnum;
135
137
using v8::EscapableHandleScope;
136
138
using v8::Exception;
137
139
using v8::Function;
138
140
using v8::FunctionCallbackInfo;
139
141
using v8::HandleScope;
142
+ using v8::Int32;
140
143
using v8::Integer;
141
144
using v8::Isolate;
142
145
using v8::Just;
@@ -145,19 +148,27 @@ using v8::Locker;
145
148
using v8::Maybe;
146
149
using v8::MaybeLocal;
147
150
using v8::Message;
151
+ using v8::MicrotasksPolicy;
148
152
using v8::Name;
149
153
using v8::NamedPropertyHandlerConfiguration;
154
+ using v8::NewStringType;
155
+ using v8::None;
150
156
using v8::Nothing;
151
157
using v8::Null;
152
158
using v8::Number;
153
159
using v8::Object;
154
160
using v8::ObjectTemplate;
155
161
using v8::Promise;
162
+ using v8::PropertyAttribute;
156
163
using v8::PropertyCallbackInfo;
164
+ using v8::ReadOnly;
165
+ using v8::Script;
166
+ using v8::ScriptCompiler;
157
167
using v8::ScriptOrigin;
158
168
using v8::SealHandleScope;
159
169
using v8::SideEffectType;
160
170
using v8::String;
171
+ using v8::TracingController;
161
172
using v8::TryCatch;
162
173
using v8::Undefined;
163
174
using v8::V8;
@@ -190,12 +201,12 @@ std::shared_ptr<PerProcessOptions> per_process_opts {
190
201
new PerProcessOptions () };
191
202
192
203
static Mutex node_isolate_mutex;
193
- static v8:: Isolate* node_isolate;
204
+ static Isolate* node_isolate;
194
205
195
206
// Ensures that __metadata trace events are only emitted
196
207
// when tracing is enabled.
197
208
class NodeTraceStateObserver :
198
- public v8:: TracingController::TraceStateObserver {
209
+ public TracingController::TraceStateObserver {
199
210
public:
200
211
void OnTraceEnabled () override {
201
212
char name_buffer[512 ];
@@ -278,12 +289,12 @@ class NodeTraceStateObserver :
278
289
UNREACHABLE ();
279
290
}
280
291
281
- explicit NodeTraceStateObserver (v8:: TracingController* controller) :
292
+ explicit NodeTraceStateObserver (TracingController* controller) :
282
293
controller_(controller) {}
283
294
~NodeTraceStateObserver () override {}
284
295
285
296
private:
286
- v8:: TracingController* controller_;
297
+ TracingController* controller_;
287
298
};
288
299
289
300
static struct {
@@ -692,20 +703,20 @@ bool ShouldAbortOnUncaughtException(Isolate* isolate) {
692
703
} // anonymous namespace
693
704
694
705
695
- void AddPromiseHook (v8:: Isolate* isolate, promise_hook_func fn, void * arg) {
706
+ void AddPromiseHook (Isolate* isolate, promise_hook_func fn, void * arg) {
696
707
Environment* env = Environment::GetCurrent (isolate);
697
708
env->AddPromiseHook (fn, arg);
698
709
}
699
710
700
- void AddEnvironmentCleanupHook (v8:: Isolate* isolate,
711
+ void AddEnvironmentCleanupHook (Isolate* isolate,
701
712
void (*fun)(void * arg),
702
713
void* arg) {
703
714
Environment* env = Environment::GetCurrent (isolate);
704
715
env->AddCleanupHook (fun, arg);
705
716
}
706
717
707
718
708
- void RemoveEnvironmentCleanupHook (v8:: Isolate* isolate,
719
+ void RemoveEnvironmentCleanupHook (Isolate* isolate,
709
720
void (*fun)(void * arg),
710
721
void* arg) {
711
722
Environment* env = Environment::GetCurrent (isolate);
@@ -759,7 +770,7 @@ MaybeLocal<Value> MakeCallback(Isolate* isolate,
759
770
Local<Value> argv[],
760
771
async_context asyncContext) {
761
772
Local<String> method_string =
762
- String::NewFromUtf8 (isolate, method, v8:: NewStringType::kNormal )
773
+ String::NewFromUtf8 (isolate, method, NewStringType::kNormal )
763
774
.ToLocalChecked ();
764
775
return MakeCallback (isolate, recv, method_string, argc, argv, asyncContext);
765
776
}
@@ -945,7 +956,7 @@ void AppendExceptionLine(Environment* env,
945
956
arrow[off + 1 ] = ' \0 ' ;
946
957
947
958
Local<String> arrow_str = String::NewFromUtf8 (env->isolate (), arrow,
948
- v8:: NewStringType::kNormal ).ToLocalChecked ();
959
+ NewStringType::kNormal ).ToLocalChecked ();
949
960
950
961
const bool can_set_arrow = !arrow_str.IsEmpty () && !err_obj.IsEmpty ();
951
962
// If allocating arrow_str failed, print it out. There's not much else to do.
@@ -1071,8 +1082,8 @@ static MaybeLocal<Value> ExecuteString(Environment* env,
1071
1082
try_catch.SetVerbose (false );
1072
1083
1073
1084
ScriptOrigin origin (filename);
1074
- MaybeLocal<v8:: Script> script =
1075
- v8:: Script::Compile (env->context (), source, &origin);
1085
+ MaybeLocal<Script> script =
1086
+ Script::Compile (env->context (), source, &origin);
1076
1087
if (script.IsEmpty ()) {
1077
1088
ReportException (env, try_catch);
1078
1089
env->Exit (3 );
@@ -1526,7 +1537,7 @@ void FatalException(Isolate* isolate,
1526
1537
!code->IsInt32 ()) {
1527
1538
exit (1 );
1528
1539
}
1529
- exit (code.As <v8:: Int32>()->Value ());
1540
+ exit (code.As <Int32>()->Value ());
1530
1541
}
1531
1542
}
1532
1543
}
@@ -1575,20 +1586,20 @@ static Maybe<bool> ProcessEmitWarningGeneric(Environment* env,
1575
1586
// do proper error checking for string creation.
1576
1587
if (!String::NewFromUtf8 (env->isolate (),
1577
1588
warning,
1578
- v8:: NewStringType::kNormal ).ToLocal (&args[argc++])) {
1589
+ NewStringType::kNormal ).ToLocal (&args[argc++])) {
1579
1590
return Nothing<bool >();
1580
1591
}
1581
1592
if (type != nullptr ) {
1582
1593
if (!String::NewFromOneByte (env->isolate (),
1583
1594
reinterpret_cast <const uint8_t *>(type),
1584
- v8:: NewStringType::kNormal )
1595
+ NewStringType::kNormal )
1585
1596
.ToLocal (&args[argc++])) {
1586
1597
return Nothing<bool >();
1587
1598
}
1588
1599
if (code != nullptr &&
1589
1600
!String::NewFromOneByte (env->isolate (),
1590
1601
reinterpret_cast <const uint8_t *>(code),
1591
- v8:: NewStringType::kNormal )
1602
+ NewStringType::kNormal )
1592
1603
.ToLocal (&args[argc++])) {
1593
1604
return Nothing<bool >();
1594
1605
}
@@ -1733,7 +1744,7 @@ static void GetLinkedBinding(const FunctionCallbackInfo<Value>& args) {
1733
1744
Local<Object> module = Object::New (env->isolate ());
1734
1745
Local<Object> exports = Object::New (env->isolate ());
1735
1746
Local<String> exports_prop = String::NewFromUtf8 (env->isolate (), " exports" ,
1736
- v8:: NewStringType::kNormal ).ToLocalChecked ();
1747
+ NewStringType::kNormal ).ToLocalChecked ();
1737
1748
module->Set (exports_prop, exports);
1738
1749
1739
1750
if (mod->nm_context_register_func != nullptr ) {
@@ -1817,16 +1828,15 @@ namespace {
1817
1828
obj->DefineOwnProperty (env->context (), \
1818
1829
OneByteString (env->isolate (), str), \
1819
1830
var, \
1820
- v8:: ReadOnly).FromJust (); \
1831
+ ReadOnly).FromJust (); \
1821
1832
} while (0 )
1822
1833
1823
1834
#define READONLY_DONT_ENUM_PROPERTY (obj, str, var ) \
1824
1835
do { \
1825
1836
obj->DefineOwnProperty (env->context (), \
1826
1837
OneByteString (env->isolate (), str), \
1827
1838
var, \
1828
- static_cast <v8::PropertyAttribute>(v8::ReadOnly | \
1829
- v8::DontEnum)) \
1839
+ static_cast <PropertyAttribute>(ReadOnly|DontEnum)) \
1830
1840
.FromJust (); \
1831
1841
} while (0 )
1832
1842
@@ -1846,8 +1856,8 @@ void SetupProcessObject(Environment* env,
1846
1856
ProcessTitleGetter,
1847
1857
env->is_main_thread () ? ProcessTitleSetter : nullptr ,
1848
1858
env->as_external (),
1849
- v8:: DEFAULT,
1850
- v8:: None,
1859
+ DEFAULT,
1860
+ None,
1851
1861
SideEffectType::kHasNoSideEffect ).FromJust ());
1852
1862
1853
1863
// process.version
@@ -1976,7 +1986,7 @@ void SetupProcessObject(Environment* env,
1976
1986
for (size_t i = 0 ; i < args.size (); ++i) {
1977
1987
arguments->Set (env->context (), i,
1978
1988
String::NewFromUtf8 (env->isolate (), args[i].c_str (),
1979
- v8:: NewStringType::kNormal ).ToLocalChecked ())
1989
+ NewStringType::kNormal ).ToLocalChecked ())
1980
1990
.FromJust ();
1981
1991
}
1982
1992
process->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " argv" ), arguments);
@@ -1986,7 +1996,7 @@ void SetupProcessObject(Environment* env,
1986
1996
for (size_t i = 0 ; i < exec_args.size (); ++i) {
1987
1997
exec_arguments->Set (env->context (), i,
1988
1998
String::NewFromUtf8 (env->isolate (), exec_args[i].c_str (),
1989
- v8:: NewStringType::kNormal ).ToLocalChecked ())
1999
+ NewStringType::kNormal ).ToLocalChecked ())
1990
2000
.FromJust ();
1991
2001
}
1992
2002
process->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " execArgv" ),
@@ -2022,7 +2032,7 @@ void SetupProcessObject(Environment* env,
2022
2032
String::NewFromUtf8 (
2023
2033
env->isolate (),
2024
2034
env->options ()->eval_string .c_str (),
2025
- v8:: NewStringType::kNormal ).ToLocalChecked ());
2035
+ NewStringType::kNormal ).ToLocalChecked ());
2026
2036
}
2027
2037
2028
2038
// -p, --print
@@ -2048,7 +2058,7 @@ void SetupProcessObject(Environment* env,
2048
2058
for (unsigned int i = 0 ; i < preload_modules.size (); ++i) {
2049
2059
Local<String> module = String::NewFromUtf8 (env->isolate (),
2050
2060
preload_modules[i].c_str (),
2051
- v8:: NewStringType::kNormal )
2061
+ NewStringType::kNormal )
2052
2062
.ToLocalChecked ();
2053
2063
array->Set (i, module);
2054
2064
}
@@ -2135,11 +2145,11 @@ void SetupProcessObject(Environment* env,
2135
2145
if (uv_exepath (exec_path, &exec_path_len) == 0 ) {
2136
2146
exec_path_value = String::NewFromUtf8 (env->isolate (),
2137
2147
exec_path,
2138
- v8:: NewStringType::kInternalized ,
2148
+ NewStringType::kInternalized ,
2139
2149
exec_path_len).ToLocalChecked ();
2140
2150
} else {
2141
2151
exec_path_value = String::NewFromUtf8 (env->isolate (), args[0 ].c_str (),
2142
- v8:: NewStringType::kInternalized ).ToLocalChecked ();
2152
+ NewStringType::kInternalized ).ToLocalChecked ();
2143
2153
}
2144
2154
process->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " execPath" ),
2145
2155
exec_path_value);
@@ -2303,15 +2313,15 @@ void LoadEnvironment(Environment* env) {
2303
2313
global->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " global" ), global);
2304
2314
2305
2315
// Create binding loaders
2306
- v8:: Local<v8:: Function> get_binding_fn =
2316
+ Local<Function> get_binding_fn =
2307
2317
env->NewFunctionTemplate (GetBinding)->GetFunction (env->context ())
2308
2318
.ToLocalChecked ();
2309
2319
2310
- v8:: Local<v8:: Function> get_linked_binding_fn =
2320
+ Local<Function> get_linked_binding_fn =
2311
2321
env->NewFunctionTemplate (GetLinkedBinding)->GetFunction (env->context ())
2312
2322
.ToLocalChecked ();
2313
2323
2314
- v8:: Local<v8:: Function> get_internal_binding_fn =
2324
+ Local<Function> get_internal_binding_fn =
2315
2325
env->NewFunctionTemplate (GetInternalBinding)->GetFunction (env->context ())
2316
2326
.ToLocalChecked ();
2317
2327
@@ -2843,7 +2853,7 @@ void RunAtExit(Environment* env) {
2843
2853
}
2844
2854
2845
2855
2846
- uv_loop_t * GetCurrentEventLoop (v8:: Isolate* isolate) {
2856
+ uv_loop_t * GetCurrentEventLoop (Isolate* isolate) {
2847
2857
HandleScope handle_scope (isolate);
2848
2858
auto context = isolate->GetCurrentContext ();
2849
2859
if (context.IsEmpty ())
@@ -2976,7 +2986,7 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
2976
2986
2977
2987
MultiIsolatePlatform* CreatePlatform (
2978
2988
int thread_pool_size,
2979
- v8:: TracingController* tracing_controller) {
2989
+ TracingController* tracing_controller) {
2980
2990
return new NodePlatform (thread_pool_size, tracing_controller);
2981
2991
}
2982
2992
@@ -2999,8 +3009,8 @@ Local<Context> NewContext(Isolate* isolate,
2999
3009
// Run lib/internal/per_context.js
3000
3010
Context::Scope context_scope (context);
3001
3011
Local<String> per_context = NodePerContextSource (isolate);
3002
- v8:: ScriptCompiler::Source per_context_src (per_context, nullptr );
3003
- Local<v8:: Script> s = v8:: ScriptCompiler::Compile (
3012
+ ScriptCompiler::Source per_context_src (per_context, nullptr );
3013
+ Local<Script> s = ScriptCompiler::Compile (
3004
3014
context,
3005
3015
&per_context_src).ToLocalChecked ();
3006
3016
s->Run (context).ToLocalChecked ();
@@ -3109,7 +3119,7 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator) {
3109
3119
3110
3120
isolate->AddMessageListener (OnMessage);
3111
3121
isolate->SetAbortOnUncaughtExceptionCallback (ShouldAbortOnUncaughtException);
3112
- isolate->SetMicrotasksPolicy (v8:: MicrotasksPolicy::kExplicit );
3122
+ isolate->SetMicrotasksPolicy (MicrotasksPolicy::kExplicit );
3113
3123
isolate->SetFatalErrorHandler (OnFatalError);
3114
3124
isolate->SetAllowWasmCodeGenerationCallback (AllowWasmCodeGenerationCallback);
3115
3125
0 commit comments