CommonImplementations.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2021-2023, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Bytecode/IdentifierTable.h>
  8. #include <LibJS/Bytecode/Op.h>
  9. #include <LibJS/Runtime/Completion.h>
  10. namespace JS::Bytecode {
  11. ThrowCompletionOr<NonnullGCPtr<Object>> base_object_for_get(Bytecode::Interpreter&, Value base_value);
  12. ThrowCompletionOr<Value> get_by_id(Bytecode::Interpreter&, IdentifierTableIndex, Value base_value, Value this_value, u32 cache_index);
  13. ThrowCompletionOr<Value> get_by_value(Bytecode::Interpreter&, Value base_value, Value property_key_value);
  14. ThrowCompletionOr<Value> get_global(Bytecode::Interpreter&, IdentifierTableIndex, u32 cache_index);
  15. ThrowCompletionOr<void> put_by_property_key(VM&, Value base, Value this_value, Value value, PropertyKey name, Op::PropertyKind kind);
  16. ThrowCompletionOr<Value> perform_call(Interpreter&, Value this_value, Op::CallType, Value callee, MarkedVector<Value> argument_values);
  17. ThrowCompletionOr<void> throw_if_needed_for_call(Interpreter&, Value callee, Op::CallType, Optional<StringTableIndex> const& expression_string);
  18. ThrowCompletionOr<Value> typeof_variable(VM&, DeprecatedFlyString const&);
  19. ThrowCompletionOr<void> set_variable(VM&, DeprecatedFlyString const&, Value, Op::EnvironmentMode, Op::SetVariable::InitializationMode);
  20. Value new_function(VM&, FunctionExpression const&, Optional<IdentifierTableIndex> const& lhs_name, Optional<Register> const& home_object);
  21. ThrowCompletionOr<void> put_by_value(VM&, Value base, Value property_key_value, Value value, Op::PropertyKind);
  22. ThrowCompletionOr<Value> get_variable(Bytecode::Interpreter&, DeprecatedFlyString const& name, u32 cache_index);
  23. struct CalleeAndThis {
  24. Value callee;
  25. Value this_value;
  26. };
  27. ThrowCompletionOr<CalleeAndThis> get_callee_and_this_from_environment(Bytecode::Interpreter&, DeprecatedFlyString const& name, u32 cache_index);
  28. Value new_regexp(VM&, ParsedRegex const&, DeprecatedString const& pattern, DeprecatedString const& flags);
  29. MarkedVector<Value> argument_list_evaluation(Bytecode::Interpreter&);
  30. ThrowCompletionOr<void> create_variable(VM&, DeprecatedFlyString const& name, Op::EnvironmentMode, bool is_global, bool is_immutable, bool is_strict);
  31. ThrowCompletionOr<ECMAScriptFunctionObject*> new_class(VM&, ClassExpression const&, Optional<IdentifierTableIndex> const& lhs_name);
  32. ThrowCompletionOr<NonnullGCPtr<Object>> super_call_with_argument_array(VM&, Value argument_array, bool is_synthetic);
  33. Object* iterator_to_object(VM&, IteratorRecord);
  34. IteratorRecord object_to_iterator(VM&, Object&);
  35. ThrowCompletionOr<NonnullGCPtr<Array>> iterator_to_array(VM&, Value iterator);
  36. ThrowCompletionOr<void> append(VM& vm, Value lhs, Value rhs, bool is_spread);
  37. ThrowCompletionOr<Value> delete_by_id(Bytecode::Interpreter&, Value base, IdentifierTableIndex identifier);
  38. ThrowCompletionOr<Value> delete_by_value(Bytecode::Interpreter&, Value base, Value property_key_value);
  39. ThrowCompletionOr<Value> delete_by_value_with_this(Bytecode::Interpreter&, Value base, Value property_key_value, Value this_value);
  40. ThrowCompletionOr<Object*> get_object_property_iterator(VM&, Value);
  41. }