1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:02:06 +00:00

LibJS: Use correct this value when callee is a with binding

If we're inside of a `with` statement scope, we have to take care to
extract the correct `this` value for use in calls when calling a method
on the binding object via an Identifier instead of a MemberExpression.

This makes Vue.js work way better in the bytecode VM. :^)

Also, 1 new pass on test262.
This commit is contained in:
Andreas Kling 2023-08-01 14:33:58 +02:00
parent e61fdd1dc6
commit e91bdedc93
4 changed files with 186 additions and 104 deletions

View file

@ -10,110 +10,111 @@
#include <AK/Span.h>
#include <LibJS/Forward.h>
#define ENUMERATE_BYTECODE_OPS(O) \
O(Add) \
O(Append) \
O(AsyncIteratorClose) \
O(Await) \
O(BitwiseAnd) \
O(BitwiseNot) \
O(BitwiseOr) \
O(BitwiseXor) \
O(BlockDeclarationInstantiation) \
O(Call) \
O(CallWithArgumentArray) \
O(ConcatString) \
O(ContinuePendingUnwind) \
O(CopyObjectExcludingProperties) \
O(CreateLexicalEnvironment) \
O(CreateVariable) \
O(Decrement) \
O(DeleteById) \
O(DeleteByIdWithThis) \
O(DeleteByValue) \
O(DeleteByValueWithThis) \
O(DeleteVariable) \
O(Div) \
O(EnterUnwindContext) \
O(EnterObjectEnvironment) \
O(Exp) \
O(GetById) \
O(GetByIdWithThis) \
O(GetByValue) \
O(GetByValueWithThis) \
O(GetIterator) \
O(GetMethod) \
O(GetNewTarget) \
O(GetImportMeta) \
O(GetObjectPropertyIterator) \
O(GetPrivateById) \
O(GetVariable) \
O(GetGlobal) \
O(GetLocal) \
O(GreaterThan) \
O(GreaterThanEquals) \
O(HasPrivateId) \
O(ImportCall) \
O(In) \
O(Increment) \
O(InstanceOf) \
O(IteratorClose) \
O(IteratorNext) \
O(IteratorResultDone) \
O(IteratorResultValue) \
O(IteratorToArray) \
O(Jump) \
O(JumpConditional) \
O(JumpNullish) \
O(JumpUndefined) \
O(LeaveLexicalEnvironment) \
O(LeaveUnwindContext) \
O(LeftShift) \
O(LessThan) \
O(LessThanEquals) \
O(Load) \
O(LoadImmediate) \
O(LooselyEquals) \
O(LooselyInequals) \
O(Mod) \
O(Mul) \
O(NewArray) \
O(NewBigInt) \
O(NewClass) \
O(NewFunction) \
O(NewObject) \
O(NewRegExp) \
O(NewString) \
O(NewTypeError) \
O(Not) \
O(PushDeclarativeEnvironment) \
O(PutById) \
O(PutByIdWithThis) \
O(PutByValue) \
O(PutByValueWithThis) \
O(PutPrivateById) \
O(ResolveThisBinding) \
O(ResolveSuperBase) \
O(Return) \
O(RightShift) \
O(ScheduleJump) \
O(SetVariable) \
O(SetLocal) \
O(Store) \
O(StrictlyEquals) \
O(StrictlyInequals) \
O(Sub) \
O(SuperCallWithArgumentArray) \
O(Throw) \
O(ThrowIfNotObject) \
O(ThrowIfNullish) \
O(ToNumeric) \
O(Typeof) \
O(TypeofVariable) \
O(TypeofLocal) \
O(UnaryMinus) \
O(UnaryPlus) \
O(UnsignedRightShift) \
#define ENUMERATE_BYTECODE_OPS(O) \
O(Add) \
O(Append) \
O(AsyncIteratorClose) \
O(Await) \
O(BitwiseAnd) \
O(BitwiseNot) \
O(BitwiseOr) \
O(BitwiseXor) \
O(BlockDeclarationInstantiation) \
O(Call) \
O(CallWithArgumentArray) \
O(ConcatString) \
O(ContinuePendingUnwind) \
O(CopyObjectExcludingProperties) \
O(CreateLexicalEnvironment) \
O(CreateVariable) \
O(Decrement) \
O(DeleteById) \
O(DeleteByIdWithThis) \
O(DeleteByValue) \
O(DeleteByValueWithThis) \
O(DeleteVariable) \
O(Div) \
O(EnterUnwindContext) \
O(EnterObjectEnvironment) \
O(Exp) \
O(GetById) \
O(GetByIdWithThis) \
O(GetByValue) \
O(GetByValueWithThis) \
O(GetCalleeAndThisFromEnvironment) \
O(GetIterator) \
O(GetMethod) \
O(GetNewTarget) \
O(GetImportMeta) \
O(GetObjectPropertyIterator) \
O(GetPrivateById) \
O(GetVariable) \
O(GetGlobal) \
O(GetLocal) \
O(GreaterThan) \
O(GreaterThanEquals) \
O(HasPrivateId) \
O(ImportCall) \
O(In) \
O(Increment) \
O(InstanceOf) \
O(IteratorClose) \
O(IteratorNext) \
O(IteratorResultDone) \
O(IteratorResultValue) \
O(IteratorToArray) \
O(Jump) \
O(JumpConditional) \
O(JumpNullish) \
O(JumpUndefined) \
O(LeaveLexicalEnvironment) \
O(LeaveUnwindContext) \
O(LeftShift) \
O(LessThan) \
O(LessThanEquals) \
O(Load) \
O(LoadImmediate) \
O(LooselyEquals) \
O(LooselyInequals) \
O(Mod) \
O(Mul) \
O(NewArray) \
O(NewBigInt) \
O(NewClass) \
O(NewFunction) \
O(NewObject) \
O(NewRegExp) \
O(NewString) \
O(NewTypeError) \
O(Not) \
O(PushDeclarativeEnvironment) \
O(PutById) \
O(PutByIdWithThis) \
O(PutByValue) \
O(PutByValueWithThis) \
O(PutPrivateById) \
O(ResolveThisBinding) \
O(ResolveSuperBase) \
O(Return) \
O(RightShift) \
O(ScheduleJump) \
O(SetVariable) \
O(SetLocal) \
O(Store) \
O(StrictlyEquals) \
O(StrictlyInequals) \
O(Sub) \
O(SuperCallWithArgumentArray) \
O(Throw) \
O(ThrowIfNotObject) \
O(ThrowIfNullish) \
O(ToNumeric) \
O(Typeof) \
O(TypeofVariable) \
O(TypeofLocal) \
O(UnaryMinus) \
O(UnaryPlus) \
O(UnsignedRightShift) \
O(Yield)
namespace JS::Bytecode {