mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 17:48:37 +00:00
LibJS: Get this
from execution context for non-arrow functions
Allows to skip function environment allocation for non-arrow functions if the only reason it is needed is to hold `this` binding. The parser is changed to do following: - If a function is an arrow function and uses `this` then all functions in a scope chain are marked to allocate function environment for `this` binding. - If a function uses `new.target` then all functions in a scope chain are marked to allocate function environment. `ordinary_call_bind_this()` is changed to put `this` value in execution context when function environment allocation is skipped. 35% improvement in Octane/typescript.js 50% improvement in Octane/deltablue.js 19% improvement in Octane/raytrace.js
This commit is contained in:
parent
7ae990d2e5
commit
ebb3d8025c
Notes:
sideshowbarker
2024-07-16 16:23:32 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: ebb3d8025c
Pull-request: https://github.com/SerenityOS/serenity/pull/24405
Reviewed-by: https://github.com/awesomekling
13 changed files with 95 additions and 59 deletions
|
@ -211,7 +211,7 @@ public:
|
|||
// Needs to mess with m_state, and we're not going to expose a non-const getter for that :^)
|
||||
friend ThrowCompletionOr<ECMAScriptFunctionObject*> FunctionConstructor::create_dynamic_function(VM&, FunctionObject&, FunctionObject*, FunctionKind, MarkedVector<Value> const&);
|
||||
|
||||
static Parser parse_function_body_from_string(ByteString const& body_string, u16 parse_options, Vector<FunctionParameter> const& parameters, FunctionKind kind, bool& contains_direct_call_to_eval, bool& uses_this);
|
||||
static Parser parse_function_body_from_string(ByteString const& body_string, u16 parse_options, Vector<FunctionParameter> const& parameters, FunctionKind kind, bool& contains_direct_call_to_eval, bool& uses_this_from_environment);
|
||||
|
||||
private:
|
||||
friend class ScopePusher;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue