mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
LibJS+LibWeb: Wrap raw JS::Cell*/& fields in GCPtr/NonnullGCPtr
This commit is contained in:
parent
1df3652e27
commit
7c0c1c8f49
214 changed files with 825 additions and 827 deletions
|
@ -51,12 +51,12 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
|||
ExecutionContext execution_context(vm().heap());
|
||||
if (vm().execution_context_stack().is_empty() || !vm().running_execution_context().lexical_environment) {
|
||||
// The "normal" interpreter pushes an execution context without environment so in that case we also want to push one.
|
||||
execution_context.this_value = &m_realm.global_object();
|
||||
execution_context.this_value = &m_realm->global_object();
|
||||
static DeprecatedFlyString global_execution_context_name = "(*BC* global execution context)";
|
||||
execution_context.function_name = global_execution_context_name;
|
||||
execution_context.lexical_environment = &m_realm.global_environment();
|
||||
execution_context.variable_environment = &m_realm.global_environment();
|
||||
execution_context.realm = &m_realm;
|
||||
execution_context.lexical_environment = &m_realm->global_environment();
|
||||
execution_context.variable_environment = &m_realm->global_environment();
|
||||
execution_context.realm = m_realm;
|
||||
execution_context.is_strict_mode = executable.is_strict_mode;
|
||||
vm().push_execution_context(execution_context);
|
||||
pushed_execution_context = true;
|
||||
|
@ -67,7 +67,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
|||
if (in_frame)
|
||||
m_register_windows.append(in_frame);
|
||||
else
|
||||
m_register_windows.append(make<RegisterWindow>(MarkedVector<Value>(vm().heap()), MarkedVector<Environment*>(vm().heap()), MarkedVector<Environment*>(vm().heap()), Vector<UnwindInfo> {}));
|
||||
m_register_windows.append(make<RegisterWindow>(MarkedVector<Value>(vm().heap()), MarkedVector<GCPtr<Environment>>(vm().heap()), MarkedVector<GCPtr<Environment>>(vm().heap()), Vector<UnwindInfo> {}));
|
||||
|
||||
registers().resize(executable.number_of_registers);
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace JS::Bytecode {
|
|||
|
||||
struct RegisterWindow {
|
||||
MarkedVector<Value> registers;
|
||||
MarkedVector<Environment*> saved_lexical_environments;
|
||||
MarkedVector<Environment*> saved_variable_environments;
|
||||
MarkedVector<GCPtr<Environment>> saved_lexical_environments;
|
||||
MarkedVector<GCPtr<Environment>> saved_variable_environments;
|
||||
Vector<UnwindInfo> unwind_contexts;
|
||||
};
|
||||
|
||||
|
@ -109,7 +109,7 @@ private:
|
|||
static AK::Array<OwnPtr<PassManager>, static_cast<UnderlyingType<Interpreter::OptimizationLevel>>(Interpreter::OptimizationLevel::__Count)> s_optimization_pipelines;
|
||||
|
||||
VM& m_vm;
|
||||
Realm& m_realm;
|
||||
NonnullGCPtr<Realm> m_realm;
|
||||
Vector<Variant<NonnullOwnPtr<RegisterWindow>, RegisterWindow*>> m_register_windows;
|
||||
Optional<BasicBlock const*> m_pending_jump;
|
||||
BasicBlock const* m_scheduled_jump { nullptr };
|
||||
|
|
|
@ -413,8 +413,8 @@ ThrowCompletionOr<void> DeleteVariable::execute_impl(Bytecode::Interpreter& inte
|
|||
|
||||
ThrowCompletionOr<void> CreateEnvironment::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
auto make_and_swap_envs = [&](auto*& old_environment) {
|
||||
Environment* environment = new_declarative_environment(*old_environment).ptr();
|
||||
auto make_and_swap_envs = [&](auto& old_environment) {
|
||||
GCPtr<Environment> environment = new_declarative_environment(*old_environment).ptr();
|
||||
swap(old_environment, environment);
|
||||
return environment;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue