mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 10:20:22 +00:00
The GetGlobal bytecode optimization bypasses the normal environment record lookup for global variable access. When a global property is an accessor (getter), the receiver passed to the getter must be the global object, not undefined. The spec's Get(O, P) abstract operation is defined as O.[[Get]](P, O), meaning the object itself is always the receiver. The global environment's GetBindingValue delegates to its object record's GetBindingValue, which calls Get(bindingObject, N), so the receiver should be the binding object (the global object). Both the cached path (calling the getter directly from get_direct) and the non-cached path (calling internal_get) were passing js_undefined() as the receiver. This caused strict-mode getters on global properties to receive undefined as their this-value instead of globalThis. Notably, the corresponding SetGlobal paths already correctly passed &binding_object for setter calls. |
||
|---|---|---|
| .. | ||
| ASTCodegen.cpp | ||
| BasicBlock.cpp | ||
| BasicBlock.h | ||
| BuiltinAbstractOperationsEnabled.h | ||
| Builtins.cpp | ||
| Builtins.h | ||
| Bytecode.def | ||
| CodeGenerationError.cpp | ||
| CodeGenerationError.h | ||
| Executable.cpp | ||
| Executable.h | ||
| FormatOperand.h | ||
| Generator.cpp | ||
| Generator.h | ||
| IdentifierTable.cpp | ||
| IdentifierTable.h | ||
| Instruction.cpp | ||
| Instruction.h | ||
| Interpreter.cpp | ||
| Interpreter.h | ||
| Label.cpp | ||
| Label.h | ||
| Operand.h | ||
| PropertyAccess.h | ||
| PropertyKeyTable.cpp | ||
| PropertyKeyTable.h | ||
| PutKind.h | ||
| RegexTable.cpp | ||
| RegexTable.h | ||
| Register.h | ||
| ScopedOperand.cpp | ||
| ScopedOperand.h | ||
| StringTable.cpp | ||
| StringTable.h | ||