1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibJS: Don't create lexical environment for native (C++) function calls

This was creating a ton of pointless busywork for the garbage collector
and can be avoided simply by tolerating that the current call frame has
a null scope object for the duration of a NativeFunction activation.
This commit is contained in:
Andreas Kling 2021-06-09 20:52:35 +02:00
parent d0bed24ca1
commit d69cd3f5bf
2 changed files with 16 additions and 9 deletions

View file

@ -5,7 +5,6 @@
*/
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/LexicalEnvironment.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/Value.h>
@ -50,7 +49,7 @@ Value NativeFunction::construct(Function&)
LexicalEnvironment* NativeFunction::create_environment()
{
return heap().allocate<LexicalEnvironment>(global_object(), LexicalEnvironment::EnvironmentRecordType::Function);
return nullptr;
}
bool NativeFunction::is_strict_mode() const