1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +00:00

LibJS: Use the same StringPrototype globally

To make sure that everyone has the same instance of StringPrototype,
hang a global prototype off of the Interpreter that can be fetched
when constructing new StringObjects.
This commit is contained in:
Andreas Kling 2020-03-15 15:11:13 +01:00
parent 9b4358e150
commit 8dc6416bba
3 changed files with 8 additions and 1 deletions

View file

@ -88,6 +88,8 @@ public:
return m_this_stack.last();
}
Object* string_prototype() { return m_string_prototype; }
private:
Heap m_heap;
@ -95,6 +97,7 @@ private:
Vector<Value> m_this_stack;
Object* m_global_object { nullptr };
Object* m_string_prototype { nullptr };
};
}