mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
LibJS: Make Script and Module GC-allocated
This ensures that code currently in any active or saved execution stack always stays alive.
This commit is contained in:
parent
cb15132146
commit
00c8f07192
18 changed files with 145 additions and 89 deletions
|
@ -12,12 +12,12 @@ namespace JS {
|
|||
|
||||
// 1.2 Synthetic Module Records, https://tc39.es/proposal-json-modules/#sec-synthetic-module-records
|
||||
class SyntheticModule final : public Module {
|
||||
JS_CELL(SyntheticModule, Module);
|
||||
|
||||
public:
|
||||
using EvaluationFunction = Function<ThrowCompletionOr<void>(SyntheticModule&)>;
|
||||
|
||||
SyntheticModule(Vector<FlyString> export_names, EvaluationFunction evaluation_steps, Realm& realm, StringView filename);
|
||||
|
||||
static NonnullRefPtr<SyntheticModule> create_default_export_synthetic_module(Value default_export, Realm& realm, StringView filename);
|
||||
static NonnullGCPtr<SyntheticModule> create_default_export_synthetic_module(Value default_export, Realm& realm, StringView filename);
|
||||
|
||||
ThrowCompletionOr<void> set_synthetic_module_export(FlyString const& export_name, Value export_value);
|
||||
|
||||
|
@ -27,10 +27,12 @@ public:
|
|||
virtual ThrowCompletionOr<ResolvedBinding> resolve_export(VM& vm, FlyString const& export_name, Vector<ResolvedBinding> resolve_set) override;
|
||||
|
||||
private:
|
||||
SyntheticModule(Vector<FlyString> export_names, EvaluationFunction evaluation_steps, Realm& realm, StringView filename);
|
||||
|
||||
Vector<FlyString> m_export_names; // [[ExportNames]]
|
||||
EvaluationFunction m_evaluation_steps; // [[EvaluationSteps]]
|
||||
};
|
||||
|
||||
ThrowCompletionOr<NonnullRefPtr<Module>> parse_json_module(StringView source_text, Realm& realm, StringView filename);
|
||||
ThrowCompletionOr<NonnullGCPtr<Module>> parse_json_module(StringView source_text, Realm& realm, StringView filename);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue