Changes between Version 10 and Version 11 of DOMInJavaScript


Ignore:
Timestamp:
Sep 28, 2012 7:05:49 AM (9 years ago)
Author:
haraken@chromium.org
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DOMInJavaScript

    v10 v11  
    2828
    2929My understanding is that getPropertyAtKnownOffset is similar to JSC::JSObject::getDirectOffset. The key is to create JavaScript wrappers for DOM nodes in such a way that initial offsets are know to correspond to particular properties (e.g., the four basic DOM pointers.)
     30
     31== The relationship between wrappers and DOM objects ==
     32
     33=== Option 1: Wrappers are mandatory
     34
     35This approach creates wrappers for all DOM objects.
     36
     37Pros:
     38* GC is simplified. Since all DOM tree edges are represented in the JS side, GC does not need to transfer information between a JS engine and WebKit.
     39
     40Cons:
     41* We need to create wrappers for DOM objects that are not touched by JS. This would not be a problem for JS-heavy workloads but might become a problem for JS-light workloads. For JS-light workloads, the mandatory-wrapper approach might end up increasing the number of wrappers in a JS heap and regresses performance of GC.
     42
     43=== Option 2: Wrappers are optional
     44
     45This approach creates wrappers for only DOM objects that are touched by JS as is done in the current JSC/V8 + WebKit. As a fast path, in a case where a wrapper object exists, .nextSibling is realized by normal JavaScript property access. As a slow path, in a case where a wrapper object does not exist, .nextSibling is realized by Node::nextSibling() as is done in the current WebKit.
     46
     47Pros:
     48* For JS-light workloads, the optional-wrapper approach would be faster than the mandatory-wrapper approach. The optional-wrapper approach does not need to create wrappers just for representing tree edges.
     49
     50Cons:
     51* GC is not simplified. Since some tree edges are represented in the JS side and other tree edges are represented in the WebKit side, GC still needs to transfer information between a JS engine and WebKit.
     52* We need to reserve space for .firstChild, .nextSibling, etc on both WebKit and JavaScript.