mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
Spreadsheet: Use the LibJS bytecode VM
This commit is contained in:
parent
acd366eddd
commit
fcc72a787b
6 changed files with 38 additions and 35 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibFileSystemAccessClient/Client.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibJS/Runtime/GlobalEnvironment.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace Spreadsheet {
|
||||
|
@ -21,19 +22,20 @@ namespace Spreadsheet {
|
|||
Workbook::Workbook(Vector<NonnullRefPtr<Sheet>>&& sheets, GUI::Window& parent_window)
|
||||
: m_sheets(move(sheets))
|
||||
, m_vm(JS::VM::create().release_value_but_fixme_should_propagate_errors())
|
||||
, m_interpreter(JS::Interpreter::create<JS::GlobalObject>(m_vm))
|
||||
, m_interpreter_scope(*m_interpreter)
|
||||
, m_root_execution_context(JS::create_simple_execution_context<JS::GlobalObject>(m_vm))
|
||||
, m_main_execution_context(m_vm->heap())
|
||||
, m_parent_window(parent_window)
|
||||
{
|
||||
m_workbook_object = m_vm->heap().allocate<WorkbookObject>(m_interpreter->realm(), m_interpreter->realm(), *this).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
m_interpreter->realm().global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
|
||||
auto& realm = *m_root_execution_context->realm;
|
||||
auto& vm = realm.vm();
|
||||
m_workbook_object = vm.heap().allocate<WorkbookObject>(realm, realm, *this).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
realm.global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
|
||||
|
||||
m_main_execution_context.this_value = &m_interpreter->realm().global_object();
|
||||
m_main_execution_context.this_value = &realm.global_object();
|
||||
m_main_execution_context.function_name = "(global execution context)"sv;
|
||||
m_main_execution_context.lexical_environment = &m_interpreter->realm().global_environment();
|
||||
m_main_execution_context.variable_environment = &m_interpreter->realm().global_environment();
|
||||
m_main_execution_context.realm = &m_interpreter->realm();
|
||||
m_main_execution_context.lexical_environment = &realm.global_environment();
|
||||
m_main_execution_context.variable_environment = &realm.global_environment();
|
||||
m_main_execution_context.realm = &realm;
|
||||
m_main_execution_context.is_strict_mode = true;
|
||||
m_vm->push_execution_context(m_main_execution_context);
|
||||
m_vm->enable_default_host_import_module_dynamically_hook();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue