From 892e585e9aa5725193f006d1782312a23387d1b1 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Sun, 21 Nov 2021 03:33:17 +0330 Subject: [PATCH] Spreadsheet: Don't recreate the global environment on every evaluation The worksheet's realm does not change, and is not shared, so we can safely leave the global environment be. This fixes lexical scoping in the spreadsheet's runtime file. --- Userland/Applications/Spreadsheet/Spreadsheet.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index eeeee7670b..188a4d8e59 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -166,9 +166,6 @@ Sheet::ValueAndException Sheet::evaluate(StringView source, Cell* on_behalf_of) if (parser.has_errors() || interpreter().exception()) return { JS::js_undefined(), interpreter().exception() }; - // FIXME: This creates a GlobalEnvironment for every evaluate call which we might be able to circumvent with multiple realms. - interpreter().realm().set_global_object(global_object(), &global_object()); - interpreter().run(global_object(), program); if (interpreter().exception()) { auto exc = interpreter().exception();