1. 09 Jul, 2018 2 commits
    • Georges Basile Stavracas Neto's avatar
      object: Add GObject properties to the correct prototype · f6758a3c
      Georges Basile Stavracas Neto authored
      Whenever successfully resolving a property, GJS is mistakenly setting
      the property in the prototype of the prototype, instead of just the
      prototype. When that happens, it ends up breaking any properties of
      subclasses. Suppose the following scenario:
               |                |
        GCharsetConverter   Subclass2
      In this scenario, if 'Subclass1' accesses any possible property from
      GCharsetConverter, GJS resolves that but ends up setting this property
      in the prototype of the prototype.
      If 'Subclass2' then tries to subsequently access that property, the
      resolving process will accidentally call the wrong getter. This leads
      to an immediate crash.
      Fix that by using the correct object prototype when resolving the
      properties. A reproducer was added to the test suite in addition to
      the fix to this problem, as a protective measure.
      Fixes #171
    • Philip Chimento's avatar
      Merge branch 'static' into 'master' · 8ea9cff7
      Philip Chimento authored
      CI: fix for Docker images tag
      See merge request !185
  2. 08 Jul, 2018 3 commits
  3. 06 Jul, 2018 1 commit
  4. 05 Jul, 2018 4 commits
  5. 03 Jul, 2018 7 commits
  6. 01 Jul, 2018 1 commit
  7. 30 Jun, 2018 6 commits
    • Philip Chimento's avatar
      jsapi-util-root: Use a union for mutually exclusive members · 4e7f4a53
      Philip Chimento authored
      In GjsMaybeOwned<T> the JS::Heap<T> and JS::PersistentRooted<T>* members
      are mutually exclusive. The m_rooted flag determines which one we are
      using. Therefore, we can put the two in a union to save space.
      The only thing we have to do is watch out when switching from one mode to
      the other. When switching to rooted, we have to be careful to call the
      destructor of JS::Heap, and when switching to unrooted we have to use
      placement-new to construct a JS::Heap in the location of the union.
      This reduces the size of ObjectInstance to 88 bytes on x86_64 (although
      when the GjsMaybeOwned is in rooted mode, that is, the ObjectInstance is
      in toggle ref mode and a GObject owns a reference to it, there are 32
      "hidden" bytes allocated for the PersistentRooted.)
    • Philip Chimento's avatar
      object: Use smaller data structure for closures · 93cf31db
      Philip Chimento authored
      Some time ago, we switched from GList* to std::set to store the list of
      GClosures associated with an object. std::set was the most time-efficient
      container, but we need to optimize for space here. std::forward_list is
      comparable to GSList.
      This reduces ObjectInstance to 96 bytes and ObjectPrototype to 192 bytes.
    • Philip Chimento's avatar
      object: Split ObjectPrototype from ObjectInstance · 4413e30d
      Philip Chimento authored
      This creates two separate classes, ObjectPrototype and ObjectInstance, so
      that we don't have to have a copy of prototype-only data in each
      ObjectInstance. This should save a lot of memory.
      There is one element common to both classes: a list of GClosures (for
      prototypes, these are vfuncs, and for instances, connected signals.)
      Since we can only create a JSClass with one private type, we use a common
      base class ObjectBase for that type. ObjectBase contains the list of
      closures and a means of distinguishing whether a particular ObjectBase
      pointer holds an ObjectInstance or ObjectPrototype. For this we use an
      ObjectPrototype pointer, which is null in ObjectPrototypes, and in
      ObjectInstances points to the associated prototype. (This scheme is
      similar to what we do in fundamental.cpp.)
      Both ObjectInstance and ObjectPrototype have an associated GObjectInfo
      and GType, but now these are stored only on the prototype.
      Note that we do not use RTTI and dynamic_cast<> because SpiderMonkey
      supports compiling both with and without RTTI. That's the reason for this
      unusual scheme with the ObjectPrototype pointer and the to_prototype() /
      to_instance() methods. dynamic_cast<> would certainly be cleaner and more
      readable, so that might be something to investigate in the future.
      This also allows moving the PropertyCache and FieldCache into
      ObjectPrototype, instead of keeping them as qdata on the GType.
      We now define separate memory counters for ObjectPrototype and
      On x86_64 with Clang, ObjectInstance was previously 128 bytes and is now
      112. ObjectPrototype was effectively 288 bytes (128 for ObjectInstance,
      plus 160 hidden bytes for the PropertyCache and FieldCache stored on the
      GType) and is now 208 bytes.
      Closes: #165
    • Philip Chimento's avatar
      object: Split file into smaller logical units · 44ed1dc0
      Philip Chimento authored
      We now have object.cpp dealing only with ObjectInstance, the JSClass for
      wrapper JS objects. Two new files are created:
      - gobject.cpp, which is the dynamic GObject types for classes and
        interfaces created in JS code.
      - private.cpp, which is the private GI native module, accessible from JS
        as `imports._gi`.
    • Philip Chimento's avatar
      object: Move some methods out of the class body · 70123645
      Philip Chimento authored
      We are going to move this class to a separate header. Methods defined in
      the class body are inlined by default, and these methods are too large
      for that.
    • Philip Chimento's avatar
      object: Move some more stuff into ObjectInstance · cb78e8db
      Philip Chimento authored
      This is useful since we are going to be breaking up this file into some
      smaller logical units. It clarifies what belongs to ObjectInstance.
  8. 24 Jun, 2018 1 commit
  9. 23 Jun, 2018 1 commit
    • Claudio André's avatar
      CI: change images name pattern · 1eeb6572
      Claudio André authored
      It allows to keep SpiderMonkey 52 Docker images active in registry.
      The SpiderMonkey 52 Docker images will be needed for CI of the
      stable and LTS branches.
      See #161. Closes #173.
  10. 21 Jun, 2018 2 commits
  11. 19 Jun, 2018 1 commit
  12. 18 Jun, 2018 3 commits
  13. 13 Jun, 2018 2 commits
  14. 12 Jun, 2018 6 commits