1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 13:27:34 +00:00

LibJS: Drop "Record" suffix from all the *Environment record classes

"Records" in the spec are basically C++ classes, so let's drop this
mouthful of a suffix.
This commit is contained in:
Andreas Kling 2021-07-01 12:24:46 +02:00
parent 56d25d7210
commit 44221756ab
40 changed files with 366 additions and 366 deletions

View file

@ -14,7 +14,7 @@
#include <LibJS/Bytecode/Op.h>
#include <LibJS/Bytecode/Register.h>
#include <LibJS/Bytecode/StringTable.h>
#include <LibJS/Runtime/EnvironmentRecord.h>
#include <LibJS/Runtime/Environment.h>
namespace JS {
@ -63,7 +63,7 @@ void ScopeNode::generate_bytecode(Bytecode::Generator& generator) const
}
if (!scope_variables_with_declaration_kind.is_empty()) {
generator.emit<Bytecode::Op::PushDeclarativeEnvironmentRecord>(move(scope_variables_with_declaration_kind));
generator.emit<Bytecode::Op::PushDeclarativeEnvironment>(move(scope_variables_with_declaration_kind));
}
for (auto& child : children()) {
@ -1214,7 +1214,7 @@ void TryStatement::generate_bytecode(Bytecode::Generator& generator) const
if (!m_finalizer)
generator.emit<Bytecode::Op::LeaveUnwindContext>();
if (!m_handler->parameter().is_empty()) {
// FIXME: We need a separate DeclarativeEnvironmentRecord here
// FIXME: We need a separate DeclarativeEnvironment here
generator.emit<Bytecode::Op::SetVariable>(generator.intern_string(m_handler->parameter()));
}
m_handler->body().generate_bytecode(generator);

View file

@ -9,69 +9,69 @@
#include <AK/Forward.h>
#include <LibJS/Forward.h>
#define ENUMERATE_BYTECODE_OPS(O) \
O(Load) \
O(LoadImmediate) \
O(Store) \
O(Add) \
O(Sub) \
O(Mul) \
O(Div) \
O(Mod) \
O(Exp) \
O(GreaterThan) \
O(GreaterThanEquals) \
O(LessThan) \
O(LessThanEquals) \
O(AbstractInequals) \
O(AbstractEquals) \
O(TypedInequals) \
O(TypedEquals) \
O(NewBigInt) \
O(NewArray) \
O(IteratorToArray) \
O(NewString) \
O(NewObject) \
O(NewRegExp) \
O(CopyObjectExcludingProperties) \
O(GetVariable) \
O(SetVariable) \
O(PutById) \
O(GetById) \
O(PutByValue) \
O(GetByValue) \
O(Jump) \
O(JumpConditional) \
O(JumpNullish) \
O(JumpUndefined) \
O(Call) \
O(NewFunction) \
O(Return) \
O(BitwiseAnd) \
O(BitwiseOr) \
O(BitwiseXor) \
O(BitwiseNot) \
O(Not) \
O(UnaryPlus) \
O(UnaryMinus) \
O(Typeof) \
O(LeftShift) \
O(RightShift) \
O(UnsignedRightShift) \
O(In) \
O(InstanceOf) \
O(ConcatString) \
O(Increment) \
O(Decrement) \
O(Throw) \
O(PushDeclarativeEnvironmentRecord) \
O(EnterUnwindContext) \
O(LeaveUnwindContext) \
O(ContinuePendingUnwind) \
O(Yield) \
O(GetIterator) \
O(IteratorNext) \
O(IteratorResultDone) \
#define ENUMERATE_BYTECODE_OPS(O) \
O(Load) \
O(LoadImmediate) \
O(Store) \
O(Add) \
O(Sub) \
O(Mul) \
O(Div) \
O(Mod) \
O(Exp) \
O(GreaterThan) \
O(GreaterThanEquals) \
O(LessThan) \
O(LessThanEquals) \
O(AbstractInequals) \
O(AbstractEquals) \
O(TypedInequals) \
O(TypedEquals) \
O(NewBigInt) \
O(NewArray) \
O(IteratorToArray) \
O(NewString) \
O(NewObject) \
O(NewRegExp) \
O(CopyObjectExcludingProperties) \
O(GetVariable) \
O(SetVariable) \
O(PutById) \
O(GetById) \
O(PutByValue) \
O(GetByValue) \
O(Jump) \
O(JumpConditional) \
O(JumpNullish) \
O(JumpUndefined) \
O(Call) \
O(NewFunction) \
O(Return) \
O(BitwiseAnd) \
O(BitwiseOr) \
O(BitwiseXor) \
O(BitwiseNot) \
O(Not) \
O(UnaryPlus) \
O(UnaryMinus) \
O(Typeof) \
O(LeftShift) \
O(RightShift) \
O(UnsignedRightShift) \
O(In) \
O(InstanceOf) \
O(ConcatString) \
O(Increment) \
O(Decrement) \
O(Throw) \
O(PushDeclarativeEnvironment) \
O(EnterUnwindContext) \
O(LeaveUnwindContext) \
O(ContinuePendingUnwind) \
O(Yield) \
O(GetIterator) \
O(IteratorNext) \
O(IteratorResultDone) \
O(IteratorResultValue)
namespace JS::Bytecode {

View file

@ -10,7 +10,7 @@
#include <LibJS/Bytecode/Instruction.h>
#include <LibJS/Bytecode/Interpreter.h>
#include <LibJS/Bytecode/Op.h>
#include <LibJS/Runtime/GlobalEnvironmentRecord.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/GlobalObject.h>
namespace JS::Bytecode {
@ -49,8 +49,8 @@ Value Interpreter::run(Executable const& executable, BasicBlock const* entry_poi
execution_context.this_value = &global_object();
static FlyString global_execution_context_name = "(*BC* global execution context)";
execution_context.function_name = global_execution_context_name;
execution_context.lexical_environment = &global_object().environment_record();
execution_context.variable_environment = &global_object().environment_record();
execution_context.lexical_environment = &global_object().environment();
execution_context.variable_environment = &global_object().environment();
VERIFY(!vm().exception());
// FIXME: How do we know if we're in strict mode? Maybe the Bytecode::Block should know this?
// execution_context.is_strict_mode = ???;

View file

@ -12,8 +12,8 @@
#include <LibJS/Bytecode/Op.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/BigInt.h>
#include <LibJS/Runtime/DeclarativeEnvironmentRecord.h>
#include <LibJS/Runtime/EnvironmentRecord.h>
#include <LibJS/Runtime/DeclarativeEnvironment.h>
#include <LibJS/Runtime/Environment.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/IteratorOperations.h>
#include <LibJS/Runtime/OrdinaryFunctionObject.h>
@ -381,14 +381,14 @@ void ContinuePendingUnwind::replace_references_impl(BasicBlock const& from, Basi
m_resume_target = Label { to };
}
void PushDeclarativeEnvironmentRecord::execute_impl(Bytecode::Interpreter& interpreter) const
void PushDeclarativeEnvironment::execute_impl(Bytecode::Interpreter& interpreter) const
{
HashMap<FlyString, Variable> resolved_variables;
for (auto& it : m_variables)
resolved_variables.set(interpreter.current_executable().get_string(it.key), it.value);
auto* environment_record = interpreter.vm().heap().allocate<DeclarativeEnvironmentRecord>(interpreter.global_object(), move(resolved_variables), interpreter.vm().lexical_environment());
interpreter.vm().running_execution_context().lexical_environment = environment_record;
interpreter.vm().running_execution_context().variable_environment = environment_record;
auto* environment = interpreter.vm().heap().allocate<DeclarativeEnvironment>(interpreter.global_object(), move(resolved_variables), interpreter.vm().lexical_environment());
interpreter.vm().running_execution_context().lexical_environment = environment;
interpreter.vm().running_execution_context().variable_environment = environment;
}
void Yield::execute_impl(Bytecode::Interpreter& interpreter) const
@ -635,10 +635,10 @@ String ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const
return String::formatted("ContinuePendingUnwind resume:{}", m_resume_target);
}
String PushDeclarativeEnvironmentRecord::to_string_impl(const Bytecode::Executable& executable) const
String PushDeclarativeEnvironment::to_string_impl(const Bytecode::Executable& executable) const
{
StringBuilder builder;
builder.append("PushDeclarativeEnvironmentRecord");
builder.append("PushDeclarativeEnvironment");
if (!m_variables.is_empty()) {
builder.append(" {");
Vector<String> names;

View file

@ -14,7 +14,7 @@
#include <LibJS/Bytecode/Register.h>
#include <LibJS/Bytecode/StringTable.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/EnvironmentRecord.h>
#include <LibJS/Runtime/Environment.h>
#include <LibJS/Runtime/Value.h>
namespace JS::Bytecode::Op {
@ -635,10 +635,10 @@ private:
Optional<Label> m_continuation_label;
};
class PushDeclarativeEnvironmentRecord final : public Instruction {
class PushDeclarativeEnvironment final : public Instruction {
public:
explicit PushDeclarativeEnvironmentRecord(HashMap<u32, Variable> variables)
: Instruction(Type::PushDeclarativeEnvironmentRecord)
explicit PushDeclarativeEnvironment(HashMap<u32, Variable> variables)
: Instruction(Type::PushDeclarativeEnvironment)
, m_variables(move(variables))
{
}