1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 19:05:07 +00:00
serenity/Userland/Libraries/LibJS/Runtime/EnvironmentCoordinate.h
Andreas Kling d7e5a2058d LibJS: Cache access to bindings in the global environment
This patch adds a special EnvironmentCoordinate::global_marker value
that signifies that a binding lookup ended up searching the global
environment. It doesn't matter if we find it there or not, the global
marker is always returned. This allows us to bypass other environments
on subsequent access, going directly to the global environment.
2022-11-11 12:22:01 +00:00

21 lines
333 B
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <LibJS/Forward.h>
namespace JS {
struct EnvironmentCoordinate {
size_t hops { 0 };
size_t index { 0 };
static constexpr size_t global_marker = 0xffffffff;
};
}