• rossberg@chromium.org's avatar
    Provide private symbols through internal APIs · cec8383c
    rossberg@chromium.org authored
    Adds a notion of private symbols, mainly intended for internal use, especially, self-hosting of built-in types that would otherwise require new C++ classes.
    
    On the JS side (i.e., in built-ins), private properties can be created and accessed through a set of macros:
    
      NEW_PRIVATE(print_name)
      HAS_PRIVATE(obj, sym)
      GET_PRIVATE(obj, sym)
      SET_PRIVATE(obj, sym, val)
      DELETE_PRIVATE(obj, sym)
    
    In the V8 API, they are accessible via a new class Private, and respective HasPrivate/Get/Private/SetPrivate/DeletePrivate methods on calss Object.
    
    These APIs are designed and restricted such that their implementation can later be replaced by whatever ES7+ will officially provide.
    
    R=yangguo@chromium.org
    BUG=
    
    Review URL: https://codereview.chromium.org/48923002
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17683 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    cec8383c
private.js 9.08 KB