1
- #include " backend/V8Platform .hpp"
1
+ #include " backend/V8Engine .hpp"
2
2
3
3
#include " backend/Interpreter.hpp"
4
4
#include " backend/PhysicalOperator.hpp"
@@ -55,15 +55,15 @@ uint16_t cdt_port = 0;
55
55
56
56
57
57
/* ======================================================================================================================
58
- * V8Platform
58
+ * V8Engine
59
59
*====================================================================================================================*/
60
60
61
- /* * The `V8Platform ` is a `WasmPlatform ` using [V8, Google's open source high-performance JavaScript and WebAssembly
61
+ /* * The `V8Engine ` is a `WasmEngine ` using [V8, Google's open source high-performance JavaScript and WebAssembly
62
62
* engine] (https://v8.dev/). */
63
- struct V8Platform : m::WasmPlatform
63
+ struct V8Engine : m::WasmEngine
64
64
{
65
- friend void create_V8Platform ();
66
- friend void destroy_V8Platform ();
65
+ friend void create_V8Engine ();
66
+ friend void destroy_V8Engine ();
67
67
friend void register_WasmV8 ();
68
68
69
69
private:
@@ -76,11 +76,11 @@ struct V8Platform : m::WasmPlatform
76
76
std::unique_ptr<V8InspectorClientImpl> inspector_;
77
77
78
78
public:
79
- V8Platform ();
80
- V8Platform (const V8Platform &) = delete ;
81
- V8Platform (V8Platform &&) = default ;
79
+ V8Engine ();
80
+ V8Engine (const V8Engine &) = delete ;
81
+ V8Engine (V8Engine &&) = default ;
82
82
83
- ~V8Platform ();
83
+ ~V8Engine ();
84
84
85
85
static v8::Platform * platform () {
86
86
M_insist (bool (PLATFORM_));
@@ -214,7 +214,7 @@ void V8InspectorClientImpl::runMessageLoopOnPause(int)
214
214
is_terminated_ = false ;
215
215
is_nested = true ;
216
216
while (not is_terminated_ and conn_->wait_on_message ())
217
- while (v8::platform::PumpMessageLoop (V8Platform ::platform (), isolate_)) { }
217
+ while (v8::platform::PumpMessageLoop (V8Engine ::platform (), isolate_)) { }
218
218
is_terminated_ = true ;
219
219
is_nested = false ;
220
220
}
@@ -279,7 +279,7 @@ void m::wasm::detail::set_wasm_instance_raw_memory(const v8::FunctionCallbackInf
279
279
v8::Local<v8::WasmModuleObject> wasm_instance = info[0 ].As <v8::WasmModuleObject>();
280
280
v8::Local<v8::Int32> wasm_context_id = info[1 ].As <v8::Int32>();
281
281
282
- auto &wasm_context = WasmPlatform ::Get_Wasm_Context_By_ID (wasm_context_id->Value ());
282
+ auto &wasm_context = WasmEngine ::Get_Wasm_Context_By_ID (wasm_context_id->Value ());
283
283
#ifndef NDEBUG
284
284
std::cerr << " Setting Wasm instance raw memory of the given instance to the VM of Wasm context "
285
285
<< wasm_context_id->Value () << " at " << wasm_context.vm .addr () << " of " << wasm_context.vm .size ()
@@ -290,7 +290,7 @@ void m::wasm::detail::set_wasm_instance_raw_memory(const v8::FunctionCallbackInf
290
290
291
291
void m::wasm::detail::read_result_set (const v8::FunctionCallbackInfo<v8::Value> &info)
292
292
{
293
- auto &context = WasmPlatform ::Get_Wasm_Context_By_ID (Module::ID ());
293
+ auto &context = WasmEngine ::Get_Wasm_Context_By_ID (Module::ID ());
294
294
295
295
auto &schema = context.plan .schema ();
296
296
auto deduplicated_schema = schema.deduplicate ();
@@ -509,7 +509,7 @@ void m::wasm::detail::read_result_set(const v8::FunctionCallbackInfo<v8::Value>
509
509
510
510
511
511
/* ======================================================================================================================
512
- * V8Platform helper classes
512
+ * V8Engine helper classes
513
513
*====================================================================================================================*/
514
514
515
515
namespace {
@@ -609,10 +609,10 @@ struct CollectStringLiterals : ConstOperatorVisitor, ast::ConstASTExprVisitor
609
609
610
610
611
611
/* ======================================================================================================================
612
- * V8Platform implementation
612
+ * V8Engine implementation
613
613
*====================================================================================================================*/
614
614
615
- V8Platform::V8Platform ()
615
+ V8Engine::V8Engine ()
616
616
{
617
617
#define REGISTER (CLASS ) phys_opt_.register_operator<m::wasm::CLASS>();
618
618
M_WASM_OPERATOR_LIST (REGISTER)
@@ -621,7 +621,7 @@ V8Platform::V8Platform()
621
621
initialize ();
622
622
}
623
623
624
- V8Platform ::~V8Platform ()
624
+ V8Engine ::~V8Engine ()
625
625
{
626
626
inspector_.reset ();
627
627
if (isolate_) {
@@ -631,7 +631,7 @@ V8Platform::~V8Platform()
631
631
}
632
632
}
633
633
634
- void V8Platform ::initialize ()
634
+ void V8Engine ::initialize ()
635
635
{
636
636
M_insist (not allocator_);
637
637
M_insist (not isolate_);
@@ -669,7 +669,7 @@ void V8Platform::initialize()
669
669
isolate_ = v8::Isolate::New (create_params);
670
670
}
671
671
672
- void V8Platform ::compile (const Operator &plan) const
672
+ void V8Engine ::compile (const Operator &plan) const
673
673
{
674
674
#if 1
675
675
/* ----- Add print function. --------------------------------------------------------------------------------------*/
@@ -727,7 +727,7 @@ void V8Platform::compile(const Operator &plan) const
727
727
#endif
728
728
}
729
729
730
- void V8Platform ::execute (const Operator &plan)
730
+ void V8Engine ::execute (const Operator &plan)
731
731
{
732
732
Module::Init ();
733
733
CodeGenContext::Init (); // fresh context
@@ -819,16 +819,16 @@ void V8Platform::execute(const Operator &plan)
819
819
}
820
820
821
821
__attribute__ ((constructor(101 )))
822
- static void create_V8Platform ()
822
+ static void create_V8Engine ()
823
823
{
824
- V8Platform ::PLATFORM_ = v8::platform::NewDefaultPlatform ().release ();
825
- v8::V8::InitializePlatform (V8Platform ::PLATFORM_);
824
+ V8Engine ::PLATFORM_ = v8::platform::NewDefaultPlatform ().release ();
825
+ v8::V8::InitializePlatform (V8Engine ::PLATFORM_);
826
826
v8::V8::SetFlagsFromString (" --no-freeze-flags-after-init" ); // allow changing flags after initialization
827
827
v8::V8::Initialize ();
828
828
}
829
829
830
830
__attribute__ ((destructor(101 )))
831
- static void destroy_V8Platform ()
831
+ static void destroy_V8Engine ()
832
832
{
833
833
v8::V8::Dispose ();
834
834
v8::V8::DisposePlatform ();
@@ -838,7 +838,7 @@ __attribute__((constructor(202)))
838
838
static void register_WasmV8 ()
839
839
{
840
840
Catalog &C = Catalog::Get ();
841
- C.register_wasm_backend <V8Platform >(" WasmV8" , " WebAssembly backend using Google's V8 engine" );
841
+ C.register_wasm_backend <V8Engine >(" WasmV8" , " WebAssembly backend using Google's V8 engine" );
842
842
843
843
/* ----- Command-line arguments -----------------------------------------------------------------------------------*/
844
844
C.arg_parser ().add <int >(
@@ -908,7 +908,7 @@ v8::Local<v8::WasmModuleObject> m::wasm::detail::instantiate(v8::Isolate &isolat
908
908
909
909
v8::Local<v8::Object> m::wasm::detail::create_env (v8::Isolate &isolate, const Operator &plan)
910
910
{
911
- auto &context = WasmPlatform ::Get_Wasm_Context_By_ID (Module::ID ());
911
+ auto &context = WasmEngine ::Get_Wasm_Context_By_ID (Module::ID ());
912
912
auto Ctx = isolate.GetCurrentContext ();
913
913
auto env = v8::Object::New (&isolate);
914
914
@@ -977,7 +977,7 @@ v8::Local<v8::String> m::wasm::detail::to_json(v8::Isolate &isolate, v8::Local<v
977
977
}
978
978
979
979
std::string m::wasm::detail::create_js_debug_script (v8::Isolate &isolate, v8::Local<v8::Object> env,
980
- const WasmPlatform ::WasmContext &wasm_context)
980
+ const WasmEngine ::WasmContext &wasm_context)
981
981
{
982
982
std::ostringstream oss;
983
983
@@ -1038,7 +1038,7 @@ debugger;";
1038
1038
void m::wasm::detail::run_inspector (V8InspectorClientImpl &inspector, v8::Isolate &isolate, v8::Local<v8::Object> env)
1039
1039
{
1040
1040
auto Ctx = isolate.GetCurrentContext ();
1041
- auto &wasm_context = WasmPlatform ::Get_Wasm_Context_By_ID (Module::ID ());
1041
+ auto &wasm_context = WasmEngine ::Get_Wasm_Context_By_ID (Module::ID ());
1042
1042
1043
1043
inspector.register_context (Ctx);
1044
1044
inspector.start ([&]() {
0 commit comments