diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-04 18:02:33 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-06 08:54:33 +0100 |
commit | 6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch) | |
tree | 372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Libraries/LibJS/Bytecode | |
parent | f74251606d74b504a1379ebb893fdb5529054ea5 (diff) | |
download | serenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip |
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/BasicBlock.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/BasicBlock.h | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/CodeGenerationError.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Executable.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Generator.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Generator.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Instruction.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Interpreter.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.cpp | 206 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Op.h | 106 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/StringTable.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/StringTable.h | 8 |
14 files changed, 183 insertions, 183 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index fb272f21a3..ccb2530c3d 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -82,7 +82,7 @@ Bytecode::CodeGenerationErrorOr<void> ScopeNode::generate_bytecode(Bytecode::Gen // b. If env.HasLexicalDeclaration(name) is true, throw a SyntaxError exception. if (generator.has_binding(identifier)) { // FIXME: Throw an actual SyntaxError instance. - generator.emit<Bytecode::Op::NewString>(generator.intern_string(String::formatted("SyntaxError: toplevel variable already declared: {}", name))); + generator.emit<Bytecode::Op::NewString>(generator.intern_string(DeprecatedString::formatted("SyntaxError: toplevel variable already declared: {}", name))); generator.emit<Bytecode::Op::Throw>(); return {}; } @@ -98,7 +98,7 @@ Bytecode::CodeGenerationErrorOr<void> ScopeNode::generate_bytecode(Bytecode::Gen // a. If env.HasLexicalDeclaration(name) is true, throw a SyntaxError exception. if (generator.has_binding(identifier)) { // FIXME: Throw an actual SyntaxError instance. - generator.emit<Bytecode::Op::NewString>(generator.intern_string(String::formatted("SyntaxError: toplevel variable already declared: {}", name))); + generator.emit<Bytecode::Op::NewString>(generator.intern_string(DeprecatedString::formatted("SyntaxError: toplevel variable already declared: {}", name))); generator.emit<Bytecode::Op::Throw>(); } return {}; diff --git a/Userland/Libraries/LibJS/Bytecode/BasicBlock.cpp b/Userland/Libraries/LibJS/Bytecode/BasicBlock.cpp index 153cad384f..81e84da4b1 100644 --- a/Userland/Libraries/LibJS/Bytecode/BasicBlock.cpp +++ b/Userland/Libraries/LibJS/Bytecode/BasicBlock.cpp @@ -4,19 +4,19 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <AK/String.h> +#include <AK/DeprecatedString.h> #include <LibJS/Bytecode/BasicBlock.h> #include <LibJS/Bytecode/Op.h> #include <sys/mman.h> namespace JS::Bytecode { -NonnullOwnPtr<BasicBlock> BasicBlock::create(String name, size_t size) +NonnullOwnPtr<BasicBlock> BasicBlock::create(DeprecatedString name, size_t size) { return adopt_own(*new BasicBlock(move(name), max(size, static_cast<size_t>(4 * KiB)))); } -BasicBlock::BasicBlock(String name, size_t size) +BasicBlock::BasicBlock(DeprecatedString name, size_t size) : m_name(move(name)) { // FIXME: This is not the smartest solution ever. Find something cleverer! diff --git a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h index 04541cd108..0bfbef846e 100644 --- a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h +++ b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h @@ -7,8 +7,8 @@ #pragma once #include <AK/Badge.h> +#include <AK/DeprecatedString.h> #include <AK/NonnullOwnPtrVector.h> -#include <AK/String.h> #include <LibJS/Forward.h> namespace JS::Bytecode { @@ -23,7 +23,7 @@ class BasicBlock { AK_MAKE_NONCOPYABLE(BasicBlock); public: - static NonnullOwnPtr<BasicBlock> create(String name, size_t size = 4 * KiB); + static NonnullOwnPtr<BasicBlock> create(DeprecatedString name, size_t size = 4 * KiB); ~BasicBlock(); void seal(); @@ -40,16 +40,16 @@ public: bool is_terminated() const { return m_terminator != nullptr; } Instruction const* terminator() const { return m_terminator; } - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } private: - BasicBlock(String name, size_t size); + BasicBlock(DeprecatedString name, size_t size); u8* m_buffer { nullptr }; Instruction const* m_terminator { nullptr }; size_t m_buffer_capacity { 0 }; size_t m_buffer_size { 0 }; - String m_name; + DeprecatedString m_name; }; } diff --git a/Userland/Libraries/LibJS/Bytecode/CodeGenerationError.h b/Userland/Libraries/LibJS/Bytecode/CodeGenerationError.h index e0404b1b26..5839d03194 100644 --- a/Userland/Libraries/LibJS/Bytecode/CodeGenerationError.h +++ b/Userland/Libraries/LibJS/Bytecode/CodeGenerationError.h @@ -16,7 +16,7 @@ struct CodeGenerationError { ASTNode const* failing_node { nullptr }; StringView reason_literal; - String to_string(); + DeprecatedString to_string(); }; template<typename T> diff --git a/Userland/Libraries/LibJS/Bytecode/Executable.h b/Userland/Libraries/LibJS/Bytecode/Executable.h index 4abe68ab05..8d454047b1 100644 --- a/Userland/Libraries/LibJS/Bytecode/Executable.h +++ b/Userland/Libraries/LibJS/Bytecode/Executable.h @@ -22,7 +22,7 @@ struct Executable { size_t number_of_registers { 0 }; bool is_strict_mode { false }; - String const& get_string(StringTableIndex index) const { return string_table->get(index); } + DeprecatedString const& get_string(StringTableIndex index) const { return string_table->get(index); } FlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); } void dump() const; diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.cpp b/Userland/Libraries/LibJS/Bytecode/Generator.cpp index 9504bef2ca..5aa330ed96 100644 --- a/Userland/Libraries/LibJS/Bytecode/Generator.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Generator.cpp @@ -316,9 +316,9 @@ Label Generator::perform_needed_unwinds_for_labelled_continue_and_return_target_ VERIFY_NOT_REACHED(); } -String CodeGenerationError::to_string() +DeprecatedString CodeGenerationError::to_string() { - return String::formatted("CodeGenerationError in {}: {}", failing_node ? failing_node->class_name() : "<unknown node>", reason_literal); + return DeprecatedString::formatted("CodeGenerationError in {}: {}", failing_node ? failing_node->class_name() : "<unknown node>", reason_literal); } } diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.h b/Userland/Libraries/LibJS/Bytecode/Generator.h index 926eb691c0..32237181da 100644 --- a/Userland/Libraries/LibJS/Bytecode/Generator.h +++ b/Userland/Libraries/LibJS/Bytecode/Generator.h @@ -99,10 +99,10 @@ public: [[nodiscard]] BasicBlock& current_block() { return *m_current_basic_block; } - BasicBlock& make_block(String name = {}) + BasicBlock& make_block(DeprecatedString name = {}) { if (name.is_empty()) - name = String::number(m_next_block++); + name = DeprecatedString::number(m_next_block++); m_root_basic_blocks.append(BasicBlock::create(name)); return m_root_basic_blocks.last(); } @@ -112,7 +112,7 @@ public: return m_current_basic_block->is_terminated(); } - StringTableIndex intern_string(String string) + StringTableIndex intern_string(DeprecatedString string) { return m_string_table->insert(move(string)); } diff --git a/Userland/Libraries/LibJS/Bytecode/Instruction.h b/Userland/Libraries/LibJS/Bytecode/Instruction.h index 86dc1c79e0..5ab3d82df1 100644 --- a/Userland/Libraries/LibJS/Bytecode/Instruction.h +++ b/Userland/Libraries/LibJS/Bytecode/Instruction.h @@ -106,7 +106,7 @@ public: bool is_terminator() const; Type type() const { return m_type; } size_t length() const; - String to_string(Bytecode::Executable const&) const; + DeprecatedString to_string(Bytecode::Executable const&) const; ThrowCompletionOr<void> execute(Bytecode::Interpreter&) const; void replace_references(BasicBlock const&, BasicBlock const&); void replace_references(Register, Register); diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index b5756e173b..69f7fdc3cc 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -136,7 +136,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e if constexpr (JS_BYTECODE_DEBUG) { for (size_t i = 0; i < registers().size(); ++i) { - String value_string; + DeprecatedString value_string; if (registers()[i].is_empty()) value_string = "(empty)"; else diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.h b/Userland/Libraries/LibJS/Bytecode/Interpreter.h index 04ac116607..6c18485b79 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.h @@ -68,9 +68,9 @@ public: Executable const& current_executable() { return *m_current_executable; } BasicBlock const& current_block() const { return *m_current_block; } size_t pc() const { return m_pc ? m_pc->offset() : 0; } - String debug_position() + DeprecatedString debug_position() { - return String::formatted("{}:{:2}:{:4x}", m_current_executable->name, m_current_block->name(), pc()); + return DeprecatedString::formatted("{}:{:2}:{:4x}", m_current_executable->name, m_current_block->name(), pc()); } enum class OptimizationLevel { diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index a34ee3ffb5..3498246368 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -29,7 +29,7 @@ namespace JS::Bytecode { -String Instruction::to_string(Bytecode::Executable const& executable) const +DeprecatedString Instruction::to_string(Bytecode::Executable const& executable) const { #define __BYTECODE_OP(op) \ case Instruction::Type::op: \ @@ -60,14 +60,14 @@ static ThrowCompletionOr<void> put_by_property_key(Object* object, Value value, case PropertyKind::Getter: { auto& function = value.as_function(); if (function.name().is_empty() && is<ECMAScriptFunctionObject>(function)) - static_cast<ECMAScriptFunctionObject*>(&function)->set_name(String::formatted("get {}", name)); + static_cast<ECMAScriptFunctionObject*>(&function)->set_name(DeprecatedString::formatted("get {}", name)); object->define_direct_accessor(name, &function, nullptr, Attribute::Configurable | Attribute::Enumerable); break; } case PropertyKind::Setter: { auto& function = value.as_function(); if (function.name().is_empty() && is<ECMAScriptFunctionObject>(function)) - static_cast<ECMAScriptFunctionObject*>(&function)->set_name(String::formatted("set {}", name)); + static_cast<ECMAScriptFunctionObject*>(&function)->set_name(DeprecatedString::formatted("set {}", name)); object->define_direct_accessor(name, nullptr, &function, Attribute::Configurable | Attribute::Enumerable); break; } @@ -136,9 +136,9 @@ static ThrowCompletionOr<Value> typed_equals(VM&, Value src1, Value src2) interpreter.accumulator() = TRY(op_snake_case(vm, lhs, rhs)); \ return {}; \ } \ - String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \ + DeprecatedString OpTitleCase::to_string_impl(Bytecode::Executable const&) const \ { \ - return String::formatted(#OpTitleCase " {}", m_lhs_reg); \ + return DeprecatedString::formatted(#OpTitleCase " {}", m_lhs_reg); \ } JS_ENUMERATE_COMMON_BINARY_OPS(JS_DEFINE_COMMON_BINARY_OP) @@ -160,7 +160,7 @@ static ThrowCompletionOr<Value> typeof_(VM& vm, Value value) interpreter.accumulator() = TRY(op_snake_case(vm, interpreter.accumulator())); \ return {}; \ } \ - String OpTitleCase::to_string_impl(Bytecode::Executable const&) const \ + DeprecatedString OpTitleCase::to_string_impl(Bytecode::Executable const&) const \ { \ return #OpTitleCase; \ } @@ -430,7 +430,7 @@ ThrowCompletionOr<void> CreateVariable::execute_impl(Bytecode::Interpreter& inte // Note: This is papering over an issue where "FunctionDeclarationInstantiation" creates these bindings for us. // Instead of crashing in there, we'll just raise an exception here. if (TRY(vm.lexical_environment()->has_binding(name))) - return vm.throw_completion<InternalError>(String::formatted("Lexical environment already has binding '{}'", name)); + return vm.throw_completion<InternalError>(DeprecatedString::formatted("Lexical environment already has binding '{}'", name)); if (m_is_immutable) vm.lexical_environment()->create_immutable_binding(vm, name, vm.in_strict_mode()); @@ -1017,27 +1017,27 @@ ThrowCompletionOr<void> TypeofVariable::execute_impl(Bytecode::Interpreter& inte return {}; } -String Load::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Load::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("Load {}", m_src); + return DeprecatedString::formatted("Load {}", m_src); } -String LoadImmediate::to_string_impl(Bytecode::Executable const&) const +DeprecatedString LoadImmediate::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("LoadImmediate {}", m_value); + return DeprecatedString::formatted("LoadImmediate {}", m_value); } -String Store::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Store::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("Store {}", m_dst); + return DeprecatedString::formatted("Store {}", m_dst); } -String NewBigInt::to_string_impl(Bytecode::Executable const&) const +DeprecatedString NewBigInt::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("NewBigInt \"{}\"", m_bigint.to_base(10)); + return DeprecatedString::formatted("NewBigInt \"{}\"", m_bigint.to_base(10)); } -String NewArray::to_string_impl(Bytecode::Executable const&) const +DeprecatedString NewArray::to_string_impl(Bytecode::Executable const&) const { StringBuilder builder; builder.append("NewArray"sv); @@ -1047,34 +1047,34 @@ String NewArray::to_string_impl(Bytecode::Executable const&) const return builder.to_string(); } -String Append::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Append::to_string_impl(Bytecode::Executable const&) const { if (m_is_spread) - return String::formatted("Append lhs: **{}", m_lhs); - return String::formatted("Append lhs: {}", m_lhs); + return DeprecatedString::formatted("Append lhs: **{}", m_lhs); + return DeprecatedString::formatted("Append lhs: {}", m_lhs); } -String IteratorToArray::to_string_impl(Bytecode::Executable const&) const +DeprecatedString IteratorToArray::to_string_impl(Bytecode::Executable const&) const { return "IteratorToArray"; } -String NewString::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString NewString::to_string_impl(Bytecode::Executable const& executable) const { - return String::formatted("NewString {} (\"{}\")", m_string, executable.string_table->get(m_string)); + return DeprecatedString::formatted("NewString {} (\"{}\")", m_string, executable.string_table->get(m_string)); } -String NewObject::to_string_impl(Bytecode::Executable const&) const +DeprecatedString NewObject::to_string_impl(Bytecode::Executable const&) const { return "NewObject"; } -String NewRegExp::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString NewRegExp::to_string_impl(Bytecode::Executable const& executable) const { - return String::formatted("NewRegExp source:{} (\"{}\") flags:{} (\"{}\")", m_source_index, executable.get_string(m_source_index), m_flags_index, executable.get_string(m_flags_index)); + return DeprecatedString::formatted("NewRegExp source:{} (\"{}\") flags:{} (\"{}\")", m_source_index, executable.get_string(m_source_index), m_flags_index, executable.get_string(m_flags_index)); } -String CopyObjectExcludingProperties::to_string_impl(Bytecode::Executable const&) const +DeprecatedString CopyObjectExcludingProperties::to_string_impl(Bytecode::Executable const&) const { StringBuilder builder; builder.appendff("CopyObjectExcludingProperties from:{}", m_from_object); @@ -1086,50 +1086,50 @@ String CopyObjectExcludingProperties::to_string_impl(Bytecode::Executable const& return builder.to_string(); } -String ConcatString::to_string_impl(Bytecode::Executable const&) const +DeprecatedString ConcatString::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("ConcatString {}", m_lhs); + return DeprecatedString::formatted("ConcatString {}", m_lhs); } -String GetVariable::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString GetVariable::to_string_impl(Bytecode::Executable const& executable) const { - return String::formatted("GetVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier)); + return DeprecatedString::formatted("GetVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier)); } -String DeleteVariable::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString DeleteVariable::to_string_impl(Bytecode::Executable const& executable) const { - return String::formatted("DeleteVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier)); + return DeprecatedString::formatted("DeleteVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier)); } -String CreateEnvironment::to_string_impl(Bytecode::Executable const&) const +DeprecatedString CreateEnvironment::to_string_impl(Bytecode::Executable const&) const { auto mode_string = m_mode == EnvironmentMode::Lexical ? "Lexical" : "Variable"; - return String::formatted("CreateEnvironment mode:{}", mode_string); + return DeprecatedString::formatted("CreateEnvironment mode:{}", mode_string); } -String CreateVariable::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString CreateVariable::to_string_impl(Bytecode::Executable const& executable) const { auto mode_string = m_mode == EnvironmentMode::Lexical ? "Lexical" : "Variable"; - return String::formatted("CreateVariable env:{} immutable:{} global:{} {} ({})", mode_string, m_is_immutable, m_is_global, m_identifier, executable.identifier_table->get(m_identifier)); + return DeprecatedString::formatted("CreateVariable env:{} immutable:{} global:{} {} ({})", mode_string, m_is_immutable, m_is_global, m_identifier, executable.identifier_table->get(m_identifier)); } -String EnterObjectEnvironment::to_string_impl(Executable const&) const +DeprecatedString EnterObjectEnvironment::to_string_impl(Executable const&) const { - return String::formatted("EnterObjectEnvironment"); + return DeprecatedString::formatted("EnterObjectEnvironment"); } -String SetVariable::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString SetVariable::to_string_impl(Bytecode::Executable const& executable) const { auto initialization_mode_name = m_initialization_mode == InitializationMode ::Initialize ? "Initialize" : m_initialization_mode == InitializationMode::Set ? "Set" : "InitializeOrSet"; auto mode_string = m_mode == EnvironmentMode::Lexical ? "Lexical" : "Variable"; - return String::formatted("SetVariable env:{} init:{} {} ({})", mode_string, initialization_mode_name, m_identifier, executable.identifier_table->get(m_identifier)); + return DeprecatedString::formatted("SetVariable env:{} init:{} {} ({})", mode_string, initialization_mode_name, m_identifier, executable.identifier_table->get(m_identifier)); } -String PutById::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString PutById::to_string_impl(Bytecode::Executable const& executable) const { auto kind = m_kind == PropertyKind::Getter ? "getter" @@ -1137,128 +1137,128 @@ String PutById::to_string_impl(Bytecode::Executable const& executable) const ? "setter" : "property"; - return String::formatted("PutById kind:{} base:{}, property:{} ({})", kind, m_base, m_property, executable.identifier_table->get(m_property)); + return DeprecatedString::formatted("PutById kind:{} base:{}, property:{} ({})", kind, m_base, m_property, executable.identifier_table->get(m_property)); } -String GetById::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString GetById::to_string_impl(Bytecode::Executable const& executable) const { - return String::formatted("GetById {} ({})", m_property, executable.identifier_table->get(m_property)); + return DeprecatedString::formatted("GetById {} ({})", m_property, executable.identifier_table->get(m_property)); } -String DeleteById::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString DeleteById::to_string_impl(Bytecode::Executable const& executable) const { - return String::formatted("DeleteById {} ({})", m_property, executable.identifier_table->get(m_property)); + return DeprecatedString::formatted("DeleteById {} ({})", m_property, executable.identifier_table->get(m_property)); } -String Jump::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Jump::to_string_impl(Bytecode::Executable const&) const { if (m_true_target.has_value()) - return String::formatted("Jump {}", *m_true_target); - return String::formatted("Jump <empty>"); + return DeprecatedString::formatted("Jump {}", *m_true_target); + return DeprecatedString::formatted("Jump <empty>"); } -String JumpConditional::to_string_impl(Bytecode::Executable const&) const +DeprecatedString JumpConditional::to_string_impl(Bytecode::Executable const&) const { - auto true_string = m_true_target.has_value() ? String::formatted("{}", *m_true_target) : "<empty>"; - auto false_string = m_false_target.has_value() ? String::formatted("{}", *m_false_target) : "<empty>"; - return String::formatted("JumpConditional true:{} false:{}", true_string, false_string); + auto true_string = m_true_target.has_value() ? DeprecatedString::formatted("{}", *m_true_target) : "<empty>"; + auto false_string = m_false_target.has_value() ? DeprecatedString::formatted("{}", *m_false_target) : "<empty>"; + return DeprecatedString::formatted("JumpConditional true:{} false:{}", true_string, false_string); } -String JumpNullish::to_string_impl(Bytecode::Executable const&) const +DeprecatedString JumpNullish::to_string_impl(Bytecode::Executable const&) const { - auto true_string = m_true_target.has_value() ? String::formatted("{}", *m_true_target) : "<empty>"; - auto false_string = m_false_target.has_value() ? String::formatted("{}", *m_false_target) : "<empty>"; - return String::formatted("JumpNullish null:{} nonnull:{}", true_string, false_string); + auto true_string = m_true_target.has_value() ? DeprecatedString::formatted("{}", *m_true_target) : "<empty>"; + auto false_string = m_false_target.has_value() ? DeprecatedString::formatted("{}", *m_false_target) : "<empty>"; + return DeprecatedString::formatted("JumpNullish null:{} nonnull:{}", true_string, false_string); } -String JumpUndefined::to_string_impl(Bytecode::Executable const&) const +DeprecatedString JumpUndefined::to_string_impl(Bytecode::Executable const&) const { - auto true_string = m_true_target.has_value() ? String::formatted("{}", *m_true_target) : "<empty>"; - auto false_string = m_false_target.has_value() ? String::formatted("{}", *m_false_target) : "<empty>"; - return String::formatted("JumpUndefined undefined:{} not undefined:{}", true_string, false_string); + auto true_string = m_true_target.has_value() ? DeprecatedString::formatted("{}", *m_true_target) : "<empty>"; + auto false_string = m_false_target.has_value() ? DeprecatedString::formatted("{}", *m_false_target) : "<empty>"; + return DeprecatedString::formatted("JumpUndefined undefined:{} not undefined:{}", true_string, false_string); } -String Call::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString Call::to_string_impl(Bytecode::Executable const& executable) const { if (m_expression_string.has_value()) - return String::formatted("Call callee:{}, this:{}, arguments:[...acc] ({})", m_callee, m_this_value, executable.get_string(m_expression_string.value())); + return DeprecatedString::formatted("Call callee:{}, this:{}, arguments:[...acc] ({})", m_callee, m_this_value, executable.get_string(m_expression_string.value())); - return String::formatted("Call callee:{}, this:{}, arguments:[...acc]", m_callee, m_this_value); + return DeprecatedString::formatted("Call callee:{}, this:{}, arguments:[...acc]", m_callee, m_this_value); } -String SuperCall::to_string_impl(Bytecode::Executable const&) const +DeprecatedString SuperCall::to_string_impl(Bytecode::Executable const&) const { return "SuperCall arguments:[...acc]"sv; } -String NewFunction::to_string_impl(Bytecode::Executable const&) const +DeprecatedString NewFunction::to_string_impl(Bytecode::Executable const&) const { return "NewFunction"; } -String NewClass::to_string_impl(Bytecode::Executable const&) const +DeprecatedString NewClass::to_string_impl(Bytecode::Executable const&) const { auto name = m_class_expression.name(); - return String::formatted("NewClass '{}'", name.is_null() ? ""sv : name); + return DeprecatedString::formatted("NewClass '{}'", name.is_null() ? ""sv : name); } -String Return::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Return::to_string_impl(Bytecode::Executable const&) const { return "Return"; } -String Increment::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Increment::to_string_impl(Bytecode::Executable const&) const { return "Increment"; } -String Decrement::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Decrement::to_string_impl(Bytecode::Executable const&) const { return "Decrement"; } -String Throw::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Throw::to_string_impl(Bytecode::Executable const&) const { return "Throw"; } -String EnterUnwindContext::to_string_impl(Bytecode::Executable const&) const +DeprecatedString EnterUnwindContext::to_string_impl(Bytecode::Executable const&) const { - auto handler_string = m_handler_target.has_value() ? String::formatted("{}", *m_handler_target) : "<empty>"; - auto finalizer_string = m_finalizer_target.has_value() ? String::formatted("{}", *m_finalizer_target) : "<empty>"; - return String::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point); + auto handler_string = m_handler_target.has_value() ? DeprecatedString::formatted("{}", *m_handler_target) : "<empty>"; + auto finalizer_string = m_finalizer_target.has_value() ? DeprecatedString::formatted("{}", *m_finalizer_target) : "<empty>"; + return DeprecatedString::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point); } -String FinishUnwind::to_string_impl(Bytecode::Executable const&) const +DeprecatedString FinishUnwind::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("FinishUnwind next:{}", m_next_target); + return DeprecatedString::formatted("FinishUnwind next:{}", m_next_target); } -String LeaveEnvironment::to_string_impl(Bytecode::Executable const&) const +DeprecatedString LeaveEnvironment::to_string_impl(Bytecode::Executable const&) const { auto mode_string = m_mode == EnvironmentMode::Lexical ? "Lexical" : "Variable"; - return String::formatted("LeaveEnvironment env:{}", mode_string); + return DeprecatedString::formatted("LeaveEnvironment env:{}", mode_string); } -String LeaveUnwindContext::to_string_impl(Bytecode::Executable const&) const +DeprecatedString LeaveUnwindContext::to_string_impl(Bytecode::Executable const&) const { return "LeaveUnwindContext"; } -String ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const +DeprecatedString ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("ContinuePendingUnwind resume:{}", m_resume_target); + return DeprecatedString::formatted("ContinuePendingUnwind resume:{}", m_resume_target); } -String PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable const& executable) const { StringBuilder builder; builder.append("PushDeclarativeEnvironment"sv); if (!m_variables.is_empty()) { builder.append(" {"sv); - Vector<String> names; + Vector<DeprecatedString> names; for (auto& it : m_variables) names.append(executable.get_string(it.key)); builder.append('}'); @@ -1267,19 +1267,19 @@ String PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable const& ex return builder.to_string(); } -String Yield::to_string_impl(Bytecode::Executable const&) const +DeprecatedString Yield::to_string_impl(Bytecode::Executable const&) const { if (m_continuation_label.has_value()) - return String::formatted("Yield continuation:@{}", m_continuation_label->block().name()); - return String::formatted("Yield return"); + return DeprecatedString::formatted("Yield continuation:@{}", m_continuation_label->block().name()); + return DeprecatedString::formatted("Yield return"); } -String GetByValue::to_string_impl(Bytecode::Executable const&) const +DeprecatedString GetByValue::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("GetByValue base:{}", m_base); + return DeprecatedString::formatted("GetByValue base:{}", m_base); } -String PutByValue::to_string_impl(Bytecode::Executable const&) const +DeprecatedString PutByValue::to_string_impl(Bytecode::Executable const&) const { auto kind = m_kind == PropertyKind::Getter ? "getter" @@ -1287,52 +1287,52 @@ String PutByValue::to_string_impl(Bytecode::Executable const&) const ? "setter" : "property"; - return String::formatted("PutByValue kind:{} base:{}, property:{}", kind, m_base, m_property); + return DeprecatedString::formatted("PutByValue kind:{} base:{}, property:{}", kind, m_base, m_property); } -String DeleteByValue::to_string_impl(Bytecode::Executable const&) const +DeprecatedString DeleteByValue::to_string_impl(Bytecode::Executable const&) const { - return String::formatted("DeleteByValue base:{}", m_base); + return DeprecatedString::formatted("DeleteByValue base:{}", m_base); } -String GetIterator::to_string_impl(Executable const&) const +DeprecatedString GetIterator::to_string_impl(Executable const&) const { return "GetIterator"; } -String GetObjectPropertyIterator::to_string_impl(Bytecode::Executable const&) const +DeprecatedString GetObjectPropertyIterator::to_string_impl(Bytecode::Executable const&) const { return "GetObjectPropertyIterator"; } -String IteratorNext::to_string_impl(Executable const&) const +DeprecatedString IteratorNext::to_string_impl(Executable const&) const { return "IteratorNext"; } -String IteratorResultDone::to_string_impl(Executable const&) const +DeprecatedString IteratorResultDone::to_string_impl(Executable const&) const { return "IteratorResultDone"; } -String IteratorResultValue::to_string_impl(Executable const&) const +DeprecatedString IteratorResultValue::to_string_impl(Executable const&) const { return "IteratorResultValue"; } -String ResolveThisBinding::to_string_impl(Bytecode::Executable const&) const +DeprecatedString ResolveThisBinding::to_string_impl(Bytecode::Executable const&) const { return "ResolveThisBinding"sv; } -String GetNewTarget::to_string_impl(Bytecode::Executable const&) const +DeprecatedString GetNewTarget::to_string_impl(Bytecode::Executable const&) const { return "GetNewTarget"sv; } -String TypeofVariable::to_string_impl(Bytecode::Executable const& executable) const +DeprecatedString TypeofVariable::to_string_impl(Bytecode::Executable const& executable) const { - return String::formatted("TypeofVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier)); + return DeprecatedString::formatted("TypeofVariable {} ({})", m_identifier, executable.identifier_table->get(m_identifier)); } } diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index f7c419a79f..bdb6d974a3 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -32,7 +32,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register from, Register to) { @@ -53,7 +53,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -70,7 +70,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -114,7 +114,7 @@ private: } \ \ ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \ - String to_string_impl(Bytecode::Executable const&) const; \ + DeprecatedString to_string_impl(Bytecode::Executable const&) const; \ void replace_references_impl(BasicBlock const&, BasicBlock const&) \ { \ } \ @@ -147,7 +147,7 @@ JS_ENUMERATE_COMMON_BINARY_OPS(JS_DECLARE_COMMON_BINARY_OP) } \ \ ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; \ - String to_string_impl(Bytecode::Executable const&) const; \ + DeprecatedString to_string_impl(Bytecode::Executable const&) const; \ void replace_references_impl(BasicBlock const&, BasicBlock const&) \ { \ } \ @@ -168,7 +168,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -184,7 +184,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -199,7 +199,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -221,7 +221,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register from, Register to); @@ -242,7 +242,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -268,7 +268,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } // Note: The underlying element range shall never be changed item, by item // shifting it may be done in the future @@ -308,7 +308,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } // Note: This should never do anything, the lhs should always be an array, that is currently being constructed @@ -327,7 +327,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -341,7 +341,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } // Note: lhs should always be a string in construction, so this should never do anything void replace_references_impl(Register from, Register) { VERIFY(from != m_lhs); } @@ -364,7 +364,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -380,7 +380,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -397,7 +397,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -424,7 +424,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -445,7 +445,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -466,7 +466,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -485,7 +485,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -512,7 +512,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register from, Register to) { @@ -535,7 +535,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -552,7 +552,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register from, Register to) { @@ -575,7 +575,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register from, Register to) { @@ -598,7 +598,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register from, Register to) { @@ -635,7 +635,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&); void replace_references_impl(Register, Register) { } @@ -655,7 +655,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; }; class JumpNullish final : public Jump { @@ -666,7 +666,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; }; class JumpUndefined final : public Jump { @@ -677,7 +677,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; }; // NOTE: This instruction is variable-width depending on the number of arguments! @@ -698,7 +698,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register); @@ -721,7 +721,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -738,7 +738,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -755,7 +755,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -773,7 +773,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -786,7 +786,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -799,7 +799,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -814,7 +814,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -832,7 +832,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&); void replace_references_impl(Register, Register) { } @@ -855,7 +855,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -871,7 +871,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -887,7 +887,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&); void replace_references_impl(Register, Register) { } @@ -908,7 +908,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&); void replace_references_impl(Register, Register) { } @@ -934,7 +934,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&); void replace_references_impl(Register, Register) { } @@ -953,7 +953,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } @@ -969,7 +969,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -982,7 +982,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -995,7 +995,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -1008,7 +1008,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -1021,7 +1021,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -1034,7 +1034,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -1047,7 +1047,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } }; @@ -1061,7 +1061,7 @@ public: } ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const; - String to_string_impl(Bytecode::Executable const&) const; + DeprecatedString to_string_impl(Bytecode::Executable const&) const; void replace_references_impl(BasicBlock const&, BasicBlock const&) { } void replace_references_impl(Register, Register) { } diff --git a/Userland/Libraries/LibJS/Bytecode/StringTable.cpp b/Userland/Libraries/LibJS/Bytecode/StringTable.cpp index e69e9c1413..a369a6c53a 100644 --- a/Userland/Libraries/LibJS/Bytecode/StringTable.cpp +++ b/Userland/Libraries/LibJS/Bytecode/StringTable.cpp @@ -8,7 +8,7 @@ namespace JS::Bytecode { -StringTableIndex StringTable::insert(String string) +StringTableIndex StringTable::insert(DeprecatedString string) { for (size_t i = 0; i < m_strings.size(); i++) { if (m_strings[i] == string) @@ -18,7 +18,7 @@ StringTableIndex StringTable::insert(String string) return m_strings.size() - 1; } -String const& StringTable::get(StringTableIndex index) const +DeprecatedString const& StringTable::get(StringTableIndex index) const { return m_strings[index.value()]; } diff --git a/Userland/Libraries/LibJS/Bytecode/StringTable.h b/Userland/Libraries/LibJS/Bytecode/StringTable.h index 2f86e6f9c0..cf6981e9ac 100644 --- a/Userland/Libraries/LibJS/Bytecode/StringTable.h +++ b/Userland/Libraries/LibJS/Bytecode/StringTable.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/DistinctNumeric.h> -#include <AK/String.h> #include <AK/Vector.h> namespace JS::Bytecode { @@ -21,13 +21,13 @@ class StringTable { public: StringTable() = default; - StringTableIndex insert(String); - String const& get(StringTableIndex) const; + StringTableIndex insert(DeprecatedString); + DeprecatedString const& get(StringTableIndex) const; void dump() const; bool is_empty() const { return m_strings.is_empty(); } private: - Vector<String> m_strings; + Vector<DeprecatedString> m_strings; }; } |