@@ -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 );
@@ -1525,7 +1536,7 @@ void FatalException(Isolate* isolate,
1525
1536
!code->IsInt32 ()) {
1526
1537
exit (1 );
1527
1538
}
1528
- exit (code.As <v8:: Int32>()->Value ());
1539
+ exit (code.As <Int32>()->Value ());
1529
1540
}
1530
1541
}
1531
1542
}
@@ -1574,20 +1585,20 @@ static Maybe<bool> ProcessEmitWarningGeneric(Environment* env,
1574
1585
// do proper error checking for string creation.
1575
1586
if (!String::NewFromUtf8 (env->isolate (),
1576
1587
warning,
1577
- v8:: NewStringType::kNormal ).ToLocal (&args[argc++])) {
1588
+ NewStringType::kNormal ).ToLocal (&args[argc++])) {
1578
1589
return Nothing<bool >();
1579
1590
}
1580
1591
if (type != nullptr ) {
1581
1592
if (!String::NewFromOneByte (env->isolate (),
1582
1593
reinterpret_cast <const uint8_t *>(type),
1583
- v8:: NewStringType::kNormal )
1594
+ NewStringType::kNormal )
1584
1595
.ToLocal (&args[argc++])) {
1585
1596
return Nothing<bool >();
1586
1597
}
1587
1598
if (code != nullptr &&
1588
1599
!String::NewFromOneByte (env->isolate (),
1589
1600
reinterpret_cast <const uint8_t *>(code),
1590
- v8:: NewStringType::kNormal )
1601
+ NewStringType::kNormal )
1591
1602
.ToLocal (&args[argc++])) {
1592
1603
return Nothing<bool >();
1593
1604
}
@@ -1732,7 +1743,7 @@ static void GetLinkedBinding(const FunctionCallbackInfo<Value>& args) {
1732
1743
Local<Object> module = Object::New (env->isolate ());
1733
1744
Local<Object> exports = Object::New (env->isolate ());
1734
1745
Local<String> exports_prop = String::NewFromUtf8 (env->isolate (), " exports" ,
1735
- v8:: NewStringType::kNormal ).ToLocalChecked ();
1746
+ NewStringType::kNormal ).ToLocalChecked ();
1736
1747
module->Set (exports_prop, exports);
1737
1748
1738
1749
if (mod->nm_context_register_func != nullptr ) {
@@ -1816,16 +1827,15 @@ namespace {
1816
1827
obj->DefineOwnProperty (env->context (), \
1817
1828
OneByteString (env->isolate (), str), \
1818
1829
var, \
1819
- v8:: ReadOnly).FromJust (); \
1830
+ ReadOnly).FromJust (); \
1820
1831
} while (0 )
1821
1832
1822
1833
#define READONLY_DONT_ENUM_PROPERTY (obj, str, var ) \
1823
1834
do { \
1824
1835
obj->DefineOwnProperty (env->context (), \
1825
1836
OneByteString (env->isolate (), str), \
1826
1837
var, \
1827
- static_cast <v8::PropertyAttribute>(v8::ReadOnly | \
1828
- v8::DontEnum)) \
1838
+ static_cast <PropertyAttribute>(ReadOnly|DontEnum)) \
1829
1839
.FromJust (); \
1830
1840
} while (0 )
1831
1841
@@ -1845,8 +1855,8 @@ void SetupProcessObject(Environment* env,
1845
1855
ProcessTitleGetter,
1846
1856
env->is_main_thread () ? ProcessTitleSetter : nullptr ,
1847
1857
env->as_external (),
1848
- v8:: DEFAULT,
1849
- v8:: None,
1858
+ DEFAULT,
1859
+ None,
1850
1860
SideEffectType::kHasNoSideEffect ).FromJust ());
1851
1861
1852
1862
// process.version
@@ -1975,7 +1985,7 @@ void SetupProcessObject(Environment* env,
1975
1985
for (size_t i = 0 ; i < args.size (); ++i) {
1976
1986
arguments->Set (env->context (), i,
1977
1987
String::NewFromUtf8 (env->isolate (), args[i].c_str (),
1978
- v8:: NewStringType::kNormal ).ToLocalChecked ())
1988
+ NewStringType::kNormal ).ToLocalChecked ())
1979
1989
.FromJust ();
1980
1990
}
1981
1991
process->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " argv" ), arguments);
@@ -1985,7 +1995,7 @@ void SetupProcessObject(Environment* env,
1985
1995
for (size_t i = 0 ; i < exec_args.size (); ++i) {
1986
1996
exec_arguments->Set (env->context (), i,
1987
1997
String::NewFromUtf8 (env->isolate (), exec_args[i].c_str (),
1988
- v8:: NewStringType::kNormal ).ToLocalChecked ())
1998
+ NewStringType::kNormal ).ToLocalChecked ())
1989
1999
.FromJust ();
1990
2000
}
1991
2001
process->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " execArgv" ),
@@ -2021,7 +2031,7 @@ void SetupProcessObject(Environment* env,
2021
2031
String::NewFromUtf8 (
2022
2032
env->isolate (),
2023
2033
env->options ()->eval_string .c_str (),
2024
- v8:: NewStringType::kNormal ).ToLocalChecked ());
2034
+ NewStringType::kNormal ).ToLocalChecked ());
2025
2035
}
2026
2036
2027
2037
// -p, --print
@@ -2047,7 +2057,7 @@ void SetupProcessObject(Environment* env,
2047
2057
for (unsigned int i = 0 ; i < preload_modules.size (); ++i) {
2048
2058
Local<String> module = String::NewFromUtf8 (env->isolate (),
2049
2059
preload_modules[i].c_str (),
2050
- v8:: NewStringType::kNormal )
2060
+ NewStringType::kNormal )
2051
2061
.ToLocalChecked ();
2052
2062
array->Set (i, module);
2053
2063
}
@@ -2134,11 +2144,11 @@ void SetupProcessObject(Environment* env,
2134
2144
if (uv_exepath (exec_path, &exec_path_len) == 0 ) {
2135
2145
exec_path_value = String::NewFromUtf8 (env->isolate (),
2136
2146
exec_path,
2137
- v8:: NewStringType::kInternalized ,
2147
+ NewStringType::kInternalized ,
2138
2148
exec_path_len).ToLocalChecked ();
2139
2149
} else {
2140
2150
exec_path_value = String::NewFromUtf8 (env->isolate (), args[0 ].c_str (),
2141
- v8:: NewStringType::kInternalized ).ToLocalChecked ();
2151
+ NewStringType::kInternalized ).ToLocalChecked ();
2142
2152
}
2143
2153
process->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " execPath" ),
2144
2154
exec_path_value);
@@ -2302,15 +2312,15 @@ void LoadEnvironment(Environment* env) {
2302
2312
global->Set (FIXED_ONE_BYTE_STRING (env->isolate (), " global" ), global);
2303
2313
2304
2314
// Create binding loaders
2305
- v8:: Local<v8:: Function> get_binding_fn =
2315
+ Local<Function> get_binding_fn =
2306
2316
env->NewFunctionTemplate (GetBinding)->GetFunction (env->context ())
2307
2317
.ToLocalChecked ();
2308
2318
2309
- v8:: Local<v8:: Function> get_linked_binding_fn =
2319
+ Local<Function> get_linked_binding_fn =
2310
2320
env->NewFunctionTemplate (GetLinkedBinding)->GetFunction (env->context ())
2311
2321
.ToLocalChecked ();
2312
2322
2313
- v8:: Local<v8:: Function> get_internal_binding_fn =
2323
+ Local<Function> get_internal_binding_fn =
2314
2324
env->NewFunctionTemplate (GetInternalBinding)->GetFunction (env->context ())
2315
2325
.ToLocalChecked ();
2316
2326
@@ -2842,7 +2852,7 @@ void RunAtExit(Environment* env) {
2842
2852
}
2843
2853
2844
2854
2845
- uv_loop_t * GetCurrentEventLoop (v8:: Isolate* isolate) {
2855
+ uv_loop_t * GetCurrentEventLoop (Isolate* isolate) {
2846
2856
HandleScope handle_scope (isolate);
2847
2857
auto context = isolate->GetCurrentContext ();
2848
2858
if (context.IsEmpty ())
@@ -2984,7 +2994,7 @@ MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform() {
2984
2994
2985
2995
MultiIsolatePlatform* CreatePlatform (
2986
2996
int thread_pool_size,
2987
- v8:: TracingController* tracing_controller) {
2997
+ TracingController* tracing_controller) {
2988
2998
return new NodePlatform (thread_pool_size, tracing_controller);
2989
2999
}
2990
3000
@@ -3007,8 +3017,8 @@ Local<Context> NewContext(Isolate* isolate,
3007
3017
// Run lib/internal/per_context.js
3008
3018
Context::Scope context_scope (context);
3009
3019
Local<String> per_context = NodePerContextSource (isolate);
3010
- v8:: ScriptCompiler::Source per_context_src (per_context, nullptr );
3011
- Local<v8:: Script> s = v8:: ScriptCompiler::Compile (
3020
+ ScriptCompiler::Source per_context_src (per_context, nullptr );
3021
+ Local<Script> s = ScriptCompiler::Compile (
3012
3022
context,
3013
3023
&per_context_src).ToLocalChecked ();
3014
3024
s->Run (context).ToLocalChecked ();
@@ -3117,7 +3127,7 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator) {
3117
3127
3118
3128
isolate->AddMessageListener (OnMessage);
3119
3129
isolate->SetAbortOnUncaughtExceptionCallback (ShouldAbortOnUncaughtException);
3120
- isolate->SetMicrotasksPolicy (v8:: MicrotasksPolicy::kExplicit );
3130
+ isolate->SetMicrotasksPolicy (MicrotasksPolicy::kExplicit );
3121
3131
isolate->SetFatalErrorHandler (OnFatalError);
3122
3132
isolate->SetAllowWasmCodeGenerationCallback (AllowWasmCodeGenerationCallback);
3123
3133
0 commit comments