1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:28:13 +00:00
serenity/Userland/Libraries/LibJS
Luke Wilde 631bbcd00a LibJS: Refactor interpreter to use Script and Source Text Modules
This also refactors interpreter creation to follow
InitializeHostDefinedRealm, but I couldn't fit it in the title :^)

This allows us to follow the spec much more closely rather than being
completely ad-hoc with just the parse node instead of having all the
surrounding data such as the realm of the parse node.

The interpreter creation refactor creates the global execution context
once and doesn't take it off the stack. This allows LibWeb to take the
global execution context and manually handle it, following the HTML
spec. The HTML spec calls this the "realm execution context" of the
environment settings object.

It also allows us to specify the globalThis type, as it can be
different from the global object type. For example, on the web, Window
global objects use a WindowProxy global this value to enforce the same
origin policy on operations like [[GetOwnProperty]].

Finally, it allows us to directly call Program::execute in perform_eval
and perform_shadow_realm_eval as this moves
global_declaration_instantiation into Interpreter::run
(ScriptEvaluation) as per the spec.

Note that this doesn't evalulate Source Text Modules yet or refactor
the bytecode interpreter, that's work for future us :^)

This patch was originally build by Luke for the environment settings
object change but was also needed for modules. So I (davidot) have
modified it with the new completion changes and setup for that.

Co-authored-by: davidot <davidot@serenityos.org>
2022-01-22 01:21:18 +00:00
..
Bytecode LibJS: Pass source text to ECMAScriptFunctionObject::create() 2022-01-19 20:33:08 +00:00
Heap LibJS: Add Handle specialisation for Value 2022-01-05 11:21:38 +01:00
Runtime LibJS: Refactor interpreter to use Script and Source Text Modules 2022-01-22 01:21:18 +00:00
Tests LibJS: Change test conditions to pass in all time zones 2022-01-21 19:14:38 +00:00
AST.cpp LibJS: Refactor interpreter to use Script and Source Text Modules 2022-01-22 01:21:18 +00:00
AST.h LibJS: Move binding_class_declaration_evaluation out of ClassDeclaration 2022-01-22 01:21:18 +00:00
CMakeLists.txt LibJS: Rename GeneratorObjectPrototype to GeneratorPrototype 2022-01-16 14:50:22 +01:00
Console.cpp LibJS: Implement console.time/timeLog/timeEnd() methods 2021-12-27 21:44:07 +01:00
Console.h LibJS: Implement console.time/timeLog/timeEnd() methods 2021-12-27 21:44:07 +01:00
Forward.h LibJS: Rename GeneratorObjectPrototype to GeneratorPrototype 2022-01-16 14:50:22 +01:00
Interpreter.cpp LibJS: Refactor interpreter to use Script and Source Text Modules 2022-01-22 01:21:18 +00:00
Interpreter.h LibJS: Refactor interpreter to use Script and Source Text Modules 2022-01-22 01:21:18 +00:00
Lexer.cpp LibJS: Set Token's m_offset to the value's start index 2022-01-19 20:33:08 +00:00
Lexer.h LibJS: Detect invalid unicode and stop lexing at that point 2021-12-29 16:57:23 +01:00
MarkupGenerator.cpp LibJS+js: Pretty-print Date objects using the ToDateString AO 2022-01-15 20:13:48 +01:00
MarkupGenerator.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Module.cpp LibJS: Add a barebones Module class 2021-09-14 21:41:51 +02:00
Module.h LibJS: Add a barebones Module class 2021-09-14 21:41:51 +02:00
Parser.cpp LibJS: Capture source text of FunctionNode and ClassExpression 2022-01-19 20:33:08 +00:00
Parser.h LibJS: Capture source text of FunctionNode and ClassExpression 2022-01-19 20:33:08 +00:00
Script.cpp LibJS+LibWeb: Move script parse time logging from JS::Script to LibWeb 2021-09-14 21:41:51 +02:00
Script.h LibJS+LibWeb: Let JS::Script::parse() return a list of errors (on error) 2021-09-14 21:41:51 +02:00
SourceRange.h LibJS: Add missing headers 2021-10-06 23:52:40 +01:00
SourceTextModule.cpp LibJS: Add a barebones SourceTextModule class 2021-09-14 21:41:51 +02:00
SourceTextModule.h LibJS: Refactor interpreter to use Script and Source Text Modules 2022-01-22 01:21:18 +00:00
SyntaxHighlighter.cpp LibJS: Remove unused header includes 2021-08-01 08:10:16 +02:00
SyntaxHighlighter.h LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30
Token.cpp LibJS: Disallow '\8' and '\9' in strict mode due to being octal escapes 2021-11-30 17:05:32 +00:00
Token.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00