Changes between Version 3 and Version 4 of DOMInJavaScript


Ignore:
Timestamp:
Sep 26, 2012 11:30:03 PM (12 years ago)
Author:
abarth@webkit.org
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DOMInJavaScript

    v3 v4  
    1111== C++ ==
    1212
    13 After moving the DOM pointers into the JavaScript VM, we'll still need to provide a fast path for C++ code to access the pointers.  Today, C++ simply reads a pointer from a fixed offset in the Node object. In this proposal, C++ code will need to take a slightly more indirect route:
     13After moving the DOM pointers into the JavaScript VM, we'll still need to provide a fast path for C++ code to access the pointers. Today, C++ simply reads a pointer from a fixed offset in the Node object. In this proposal, C++ code will need to take a slightly more indirect route:
     14
     15{{{
     16Node* Node::nextSibling()
     17{
     18    m_wrapper->fastGetProperty(kNextSiblingIndex)->impl();
     19}
     20
     21void Note::setNextSibling(Node* node)
     22{
     23    m_wrapper->fastSetProperty(kNextSiblingIndex, node->m_wrapper);
     24}
     25}}}
     26
     27In order to get or set the nextSibling property, the C++ code needs to consult its JavaScript wrapper. (Note: This implies that we'll need to eagerly creata JavaScript wrappers for DOM nodes.) In this approach, the JavaScript wrapper stores the four DOM pointers at fixed offsets in memory, letting the C++ code read or write the property directly rather than having to do a hash table lookup.