mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibJS: Remove OOM handling from JS intrinsics initialization
This commit is contained in:
parent
0fe9bbad2e
commit
49f1ef52ad
Notes:
github-actions[bot]
2025-02-05 13:06:19 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/49f1ef52add Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3450 Reviewed-by: https://github.com/shannonbooth ✅
3 changed files with 6 additions and 8 deletions
|
@ -143,7 +143,7 @@ static void initialize_constructor(VM& vm, PropertyKey const& property_key, Obje
|
|||
}
|
||||
|
||||
// 9.3.2 CreateIntrinsics ( realmRec ), https://tc39.es/ecma262/#sec-createintrinsics
|
||||
ThrowCompletionOr<GC::Ref<Intrinsics>> Intrinsics::create(Realm& realm)
|
||||
GC::Ref<Intrinsics> Intrinsics::create(Realm& realm)
|
||||
{
|
||||
auto& vm = realm.vm();
|
||||
|
||||
|
@ -165,7 +165,7 @@ ThrowCompletionOr<GC::Ref<Intrinsics>> Intrinsics::create(Realm& realm)
|
|||
// is the specified value of the function's [[Prototype]] internal slot. The
|
||||
// creation of the intrinsics and their properties must be ordered to avoid
|
||||
// any dependencies upon objects that have not yet been created.
|
||||
MUST_OR_THROW_OOM(intrinsics->initialize_intrinsics(realm));
|
||||
intrinsics->initialize_intrinsics(realm);
|
||||
|
||||
// 3. Perform AddRestrictedFunctionProperties(realmRec.[[Intrinsics]].[[%Function.prototype%]], realmRec).
|
||||
add_restricted_function_properties(static_cast<FunctionObject&>(*realm.intrinsics().function_prototype()), realm);
|
||||
|
@ -174,7 +174,7 @@ ThrowCompletionOr<GC::Ref<Intrinsics>> Intrinsics::create(Realm& realm)
|
|||
return *intrinsics;
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> Intrinsics::initialize_intrinsics(Realm& realm)
|
||||
void Intrinsics::initialize_intrinsics(Realm& realm)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
@ -271,8 +271,6 @@ ThrowCompletionOr<void> Intrinsics::initialize_intrinsics(Realm& realm)
|
|||
m_json_parse_function = &json_object()->get_without_side_effects(vm.names.parse).as_function();
|
||||
m_json_stringify_function = &json_object()->get_without_side_effects(vm.names.stringify).as_function();
|
||||
m_object_prototype_to_string_function = &object_prototype()->get_without_side_effects(vm.names.toString).as_function();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -18,7 +18,7 @@ class Intrinsics final : public Cell {
|
|||
GC_DECLARE_ALLOCATOR(Intrinsics);
|
||||
|
||||
public:
|
||||
static ThrowCompletionOr<GC::Ref<Intrinsics>> create(Realm&);
|
||||
static GC::Ref<Intrinsics> create(Realm&);
|
||||
|
||||
GC::Ref<Shape> empty_object_shape() { return *m_empty_object_shape; }
|
||||
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
ThrowCompletionOr<void> initialize_intrinsics(Realm&);
|
||||
void initialize_intrinsics(Realm&);
|
||||
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||
void initialize_##snake_name();
|
||||
|
|
|
@ -25,7 +25,7 @@ ThrowCompletionOr<NonnullOwnPtr<ExecutionContext>> Realm::initialize_host_define
|
|||
auto realm = vm.heap().allocate<Realm>();
|
||||
|
||||
// 2. Perform CreateIntrinsics(realm).
|
||||
MUST(Intrinsics::create(*realm));
|
||||
Intrinsics::create(*realm);
|
||||
|
||||
// FIXME: 3. Set realm.[[AgentSignifier]] to AgentSignifier().
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue