mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
LibJS: Move builtin prototypes to the global object
This moves us towards being able to run JavaScript in different global objects without allocating a separate GC heap.
This commit is contained in:
@@ -33,7 +33,7 @@ namespace JS {
|
||||
Error* Error::create(GlobalObject& global_object, const FlyString& name, const String& message)
|
||||
{
|
||||
auto& interpreter = global_object.interpreter();
|
||||
return interpreter.heap().allocate<Error>(name, message, *interpreter.error_prototype());
|
||||
return interpreter.heap().allocate<Error>(name, message, *global_object.error_prototype());
|
||||
}
|
||||
|
||||
Error::Error(const FlyString& name, const String& message, Object& prototype)
|
||||
@@ -51,8 +51,7 @@ Error::~Error()
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName) \
|
||||
ClassName* ClassName::create(GlobalObject& global_object, const String& message) \
|
||||
{ \
|
||||
auto& interpreter = global_object.interpreter(); \
|
||||
return interpreter.heap().allocate<ClassName>(message, *interpreter.snake_name##_prototype()); \
|
||||
return global_object.heap().allocate<ClassName>(message, *global_object.snake_name##_prototype()); \
|
||||
} \
|
||||
ClassName::ClassName(const String& message, Object& prototype) \
|
||||
: Error(#ClassName, message, prototype) \
|
||||
|
||||
Reference in New Issue
Block a user