mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibJS: Shrink ExecutionContext by replacing ScriptOrModule with Cell*
Replace the 16-byte Variant<Empty, GC::Ref<Script>, GC::Ref<Module>> with a simple 8-byte GC::Ptr<Cell> that points to either a Script or Module (or is null for Empty). A helper function script_or_module_from_cell() converts back to the full ScriptOrModule variant when needed (e.g. in VM::get_active_script_or_module).
This commit is contained in:
committed by
Andreas Kling
parent
c8ad07dece
commit
d3495c62a7
Notes:
github-actions[bot]
2026-03-11 12:35:02 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/d3495c62a72 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8360 Reviewed-by: https://github.com/shannonbooth
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
// This is used by LibWeb to disassociate event handler attribute callback functions from the nearest script on the call stack.
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler Step 3.11
|
||||
void set_script_or_module(ScriptOrModule script_or_module) { m_script_or_module = move(script_or_module); }
|
||||
void set_script_or_module(GC::Ptr<Cell> script_or_module) { m_script_or_module = script_or_module; }
|
||||
|
||||
Variant<PropertyKey, PrivateName, Empty> const& class_field_initializer_name() const { return shared_data().m_class_field_initializer_name; }
|
||||
|
||||
@@ -151,7 +151,7 @@ private:
|
||||
// Internal Slots of ECMAScript Function Objects, https://tc39.es/ecma262/#table-internal-slots-of-ecmascript-function-objects
|
||||
GC::Ptr<Environment> m_environment; // [[Environment]]
|
||||
GC::Ptr<PrivateEnvironment> m_private_environment; // [[PrivateEnvironment]]
|
||||
ScriptOrModule m_script_or_module; // [[ScriptOrModule]]
|
||||
GC::Ptr<Cell> m_script_or_module; // [[ScriptOrModule]]
|
||||
GC::Ptr<Object> m_home_object; // [[HomeObject]]
|
||||
struct ClassData {
|
||||
Vector<ClassFieldDefinition> fields; // [[Fields]]
|
||||
|
||||
Reference in New Issue
Block a user