Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
gjs
gjs
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 100
    • Issues 100
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 17
    • Merge Requests 17
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gjsgjs
  • Merge Requests
  • !173

Merged
Created Jun 23, 2018 by Philip Chimento@ptomato🚮Maintainer

Refactor ObjectInstance, part 3 of 3

  • Overview 9
  • Commits 6
  • Pipelines 2
  • Changes 11

After a lot of preparation we finally have separate classes for the private data of ObjectInstance and ObjectPrototype. This should fix one of the regressions (#165 (closed)) from the previous two parts although probably not the other one (#171 (closed)), and clears the way towards rebasing the SpiderMonkey 60 branch (#161 (closed)).

We have a bit of an unorthodox way of doing polymorphism, see the commit messages for explanation.

I've also tacked on a couple of commits to reduce the space taken by both of these structs. Before the change, ObjectInstance was 128 bytes per object (plus another 32 if the object was in toggle ref mode, and toggled up), and ObjectPrototype was 288 bytes per GObject class (128 for the ObjectInstance struct, plus 160 for the prototype and field caches, allocated as GType qdata.) Now, ObjectInstance is 88 bytes (still plus 32 if toggled up), and ObjectPrototype is 192 bytes.

Possible improvements for the future could be:

  • Refactor closure.cpp to use only one GjsContext dispose notify for all closures, which would allow shrinking GjsMaybeOwned and therefore ObjectInstance by 24 bytes (I tried this but it wasn't obvious whether it would work);
  • Instead of using PersistentRooted in GjsMaybeOwned, trace all rooted GjsMaybeOwned structs from the global object, which would allow shrinking GjsMaybeOwned and therefore ObjectInstance by 8 bytes, and get rid of the 32 extra bytes when the object is toggled up.
Assignee
Assign to
Reviewer
Request review from
GNOME 3.30.0
Milestone
GNOME 3.30.0 (Past due)
Assign milestone
Time tracking
Source branch: refactor-object-instance-part3