mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
LibJS+LibWeb: Reduce use of GlobalObject as an intermediary
- Prefer VM::current_realm() over GlobalObject::associated_realm() - Prefer VM::heap() over GlobalObject::heap() - Prefer Cell::vm() over Cell::global_object() - Prefer Wrapper::vm() over Wrapper::global_object() - Inline Realm::global_object() calls used to access intrinsics as they will later perform a direct lookup without going through the global object
This commit is contained in:
parent
e3895e6c80
commit
b345a0acca
58 changed files with 157 additions and 231 deletions
|
@ -260,7 +260,7 @@ inline AK::Result<NonnullRefPtr<JS::SourceTextModule>, ParserError> parse_module
|
|||
|
||||
inline ErrorOr<JsonValue> get_test_results(JS::Interpreter& interpreter)
|
||||
{
|
||||
auto results = MUST(interpreter.global_object().get("__TestResults__"));
|
||||
auto results = MUST(interpreter.realm().global_object().get("__TestResults__"));
|
||||
auto json_string = MUST(JS::JSONObject::stringify_impl(*g_vm, results, JS::js_undefined(), JS::js_undefined()));
|
||||
|
||||
return JsonValue::from_string(json_string);
|
||||
|
@ -383,7 +383,7 @@ inline JSFileResult TestRunner::run_file_test(String const& test_path)
|
|||
executable->name = test_path;
|
||||
if (JS::Bytecode::g_dump_bytecode)
|
||||
executable->dump();
|
||||
JS::Bytecode::Interpreter bytecode_interpreter(interpreter->global_object(), interpreter->realm());
|
||||
JS::Bytecode::Interpreter bytecode_interpreter(interpreter->realm().global_object(), interpreter->realm());
|
||||
(void)bytecode_interpreter.run(*executable);
|
||||
}
|
||||
} else {
|
||||
|
@ -403,7 +403,7 @@ inline JSFileResult TestRunner::run_file_test(String const& test_path)
|
|||
JSFileResult file_result { test_path.substring(m_test_root.length() + 1, test_path.length() - m_test_root.length() - 1) };
|
||||
|
||||
// Collect logged messages
|
||||
auto user_output = MUST(interpreter->global_object().get("__UserOutput__"));
|
||||
auto user_output = MUST(interpreter->realm().global_object().get("__UserOutput__"));
|
||||
|
||||
auto& arr = user_output.as_array();
|
||||
for (auto& entry : arr.indexed_properties()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue