diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-21 23:17:24 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-21 23:49:50 +0200 |
commit | 6c6dbcfc36e4603e40f403964207142664b96e46 (patch) | |
tree | e36afd55a79f2a9c01878368b3b04fce789a846b /Userland/Libraries/LibJS/Bytecode | |
parent | e9b4a0a8309098ea47a35cfac45be7fff5955140 (diff) | |
download | serenity-6c6dbcfc36e4603e40f403964207142664b96e46.zip |
LibJS: Rename Environment Records so they match the spec :^)
This patch makes the following name changes:
- ScopeObject => EnvironmentRecord
- LexicalEnvironment => DeclarativeEnvironmentRecord
- WithScope => ObjectEnvironmentRecord
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Instruction.h | 128 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.h | 8 |
5 files changed, 79 insertions, 79 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 86c6990f53..77f589f66b 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -14,7 +14,7 @@ #include <LibJS/Bytecode/Op.h> #include <LibJS/Bytecode/Register.h> #include <LibJS/Bytecode/StringTable.h> -#include <LibJS/Runtime/ScopeObject.h> +#include <LibJS/Runtime/EnvironmentRecord.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::PushLexicalEnvironment>(move(scope_variables_with_declaration_kind)); + generator.emit<Bytecode::Op::PushDeclarativeEnvironmentRecord>(move(scope_variables_with_declaration_kind)); } for (auto& child : children()) { @@ -1219,7 +1219,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 LexicalEnvironment here + // FIXME: We need a separate DeclarativeEnvironmentRecord here generator.emit<Bytecode::Op::SetVariable>(generator.intern_string(m_handler->parameter())); } m_handler->body().generate_bytecode(generator); diff --git a/Userland/Libraries/LibJS/Bytecode/Instruction.h b/Userland/Libraries/LibJS/Bytecode/Instruction.h index a01ce99238..58139ffd4b 100644 --- a/Userland/Libraries/LibJS/Bytecode/Instruction.h +++ b/Userland/Libraries/LibJS/Bytecode/Instruction.h @@ -9,70 +9,70 @@ #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(PushLexicalEnvironment) \ - O(LoadArgument) \ - 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(PushDeclarativeEnvironmentRecord) \ + O(LoadArgument) \ + O(EnterUnwindContext) \ + O(LeaveUnwindContext) \ + O(ContinuePendingUnwind) \ + O(Yield) \ + O(GetIterator) \ + O(IteratorNext) \ + O(IteratorResultDone) \ O(IteratorResultValue) namespace JS::Bytecode { diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 4d4441cd7d..dfa96f32c1 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -48,7 +48,7 @@ Value Interpreter::run(Executable const& executable, BasicBlock const* entry_poi global_call_frame.this_value = &global_object(); static FlyString global_execution_context_name = "(*BC* global execution context)"; global_call_frame.function_name = global_execution_context_name; - global_call_frame.scope = &global_object(); + global_call_frame.environment_record = &global_object(); VERIFY(!vm().exception()); // FIXME: How do we know if we're in strict mode? Maybe the Bytecode::Block should know this? // global_call_frame.is_strict_mode = ???; diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index d925c54687..7274641c56 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -12,11 +12,11 @@ #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/GlobalObject.h> #include <LibJS/Runtime/IteratorOperations.h> -#include <LibJS/Runtime/LexicalEnvironment.h> #include <LibJS/Runtime/RegExpObject.h> -#include <LibJS/Runtime/ScopeObject.h> #include <LibJS/Runtime/ScriptFunction.h> #include <LibJS/Runtime/Value.h> @@ -381,13 +381,13 @@ void ContinuePendingUnwind::replace_references_impl(BasicBlock const& from, Basi m_resume_target = Label { to }; } -void PushLexicalEnvironment::execute_impl(Bytecode::Interpreter& interpreter) const +void PushDeclarativeEnvironmentRecord::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* block_lexical_environment = interpreter.vm().heap().allocate<LexicalEnvironment>(interpreter.global_object(), move(resolved_variables), interpreter.vm().current_scope()); - interpreter.vm().call_frame().scope = block_lexical_environment; + auto* environment_record = interpreter.vm().heap().allocate<DeclarativeEnvironmentRecord>(interpreter.global_object(), move(resolved_variables), interpreter.vm().current_scope()); + interpreter.vm().call_frame().environment_record = environment_record; } void Yield::execute_impl(Bytecode::Interpreter& interpreter) const @@ -639,10 +639,10 @@ String ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const return String::formatted("ContinuePendingUnwind resume:{}", m_resume_target); } -String PushLexicalEnvironment::to_string_impl(const Bytecode::Executable& executable) const +String PushDeclarativeEnvironmentRecord::to_string_impl(const Bytecode::Executable& executable) const { StringBuilder builder; - builder.append("PushLexicalEnvironment"); + builder.append("PushDeclarativeEnvironmentRecord"); if (!m_variables.is_empty()) { builder.append(" {"); Vector<String> names; diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index 177f2f66ed..055fdab701 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -14,7 +14,7 @@ #include <LibJS/Bytecode/Register.h> #include <LibJS/Bytecode/StringTable.h> #include <LibJS/Heap/Cell.h> -#include <LibJS/Runtime/ScopeObject.h> +#include <LibJS/Runtime/EnvironmentRecord.h> #include <LibJS/Runtime/Value.h> namespace JS::Bytecode::Op { @@ -635,10 +635,10 @@ private: Optional<Label> m_continuation_label; }; -class PushLexicalEnvironment final : public Instruction { +class PushDeclarativeEnvironmentRecord final : public Instruction { public: - explicit PushLexicalEnvironment(HashMap<u32, Variable> variables) - : Instruction(Type::PushLexicalEnvironment) + explicit PushDeclarativeEnvironmentRecord(HashMap<u32, Variable> variables) + : Instruction(Type::PushDeclarativeEnvironmentRecord) , m_variables(move(variables)) { } |