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