mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibJS: Remove derivable fields from ExecutionContext
Remove four fields that are trivially derivable from other fields already present in the ExecutionContext: - global_object (from realm) - global_declarative_environment (from realm) - identifier_table (from executable) - property_key_table (from executable) This shrinks ExecutionContext from 192 to 160 bytes (-17%). The asmint's GetGlobal/SetGlobal handlers now load through the realm pointer, taking advantage of the cached declarative environment pointer added in the previous commit.
This commit is contained in:
committed by
Andreas Kling
parent
e70f580e5c
commit
96d02d5249
Notes:
github-actions[bot]
2026-03-11 12:35:42 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/96d02d5249d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8360 Reviewed-by: https://github.com/shannonbooth
@@ -17,6 +17,7 @@
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
#include <LibJS/Runtime/IndexedProperties.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibJS/Runtime/Shape.h>
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
|
||||
@@ -85,13 +86,17 @@ int main()
|
||||
// ExecutionContext layout
|
||||
outln("\n# ExecutionContext layout");
|
||||
EMIT_OFFSET(EXECUTION_CONTEXT_EXECUTABLE, ExecutionContext, executable);
|
||||
EMIT_OFFSET(EXECUTION_CONTEXT_GLOBAL_OBJECT, ExecutionContext, global_object);
|
||||
EMIT_OFFSET(EXECUTION_CONTEXT_GLOBAL_DECLARATIVE_ENVIRONMENT, ExecutionContext, global_declarative_environment);
|
||||
EMIT_OFFSET(EXECUTION_CONTEXT_REALM, ExecutionContext, realm);
|
||||
EMIT_OFFSET(EXECUTION_CONTEXT_LEXICAL_ENVIRONMENT, ExecutionContext, lexical_environment);
|
||||
EMIT_OFFSET(EXECUTION_CONTEXT_CALLER_FRAME, ExecutionContext, caller_frame);
|
||||
EMIT_OFFSET(EXECUTION_CONTEXT_PROGRAM_COUNTER, ExecutionContext, program_counter);
|
||||
EMIT_SIZEOF(SIZEOF_EXECUTION_CONTEXT, ExecutionContext);
|
||||
|
||||
// Realm layout
|
||||
outln("\n# Realm layout");
|
||||
EMIT_OFFSET(REALM_GLOBAL_OBJECT, Realm, m_global_object);
|
||||
EMIT_OFFSET(REALM_GLOBAL_DECLARATIVE_ENVIRONMENT, Realm, m_global_declarative_environment);
|
||||
|
||||
// Interpreter layout
|
||||
outln("\n# Interpreter layout");
|
||||
EMIT_OFFSET(INTERPRETER_RUNNING_EXECUTION_CONTEXT, Interpreter, m_running_execution_context);
|
||||
|
||||
Reference in New Issue
Block a user