Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap: include bootstrapped Environment in builtin snapshot #32984

Closed
wants to merge 13 commits into from

Commits on Jul 14, 2020

  1. src: split the main context initialization from Environemnt ctor

    So that it's possible to create an Environment not yet attached
    to any V8 context. We'll use this to deserialize the V8 context
    before attaching an Environment to it.
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    84d26e5 View commit details
    Browse the repository at this point in the history
  2. src: add an ExternalReferenceRegistry class

    Add an ExternalReferenceRegistry class for registering static
    external references.
    
    To register the external JS to C++ references created in a binding
    (e.g. when a FunctionTemplate is created):
    
    - Add the binding name (same as the id used for `internalBinding()`
      and `NODE_MODULE_CONTEXT_AWARE_INTERNAL`) to
      `EXTERNAL_REFERENCE_BINDING_LIST` in `src/node_external_reference.h`.
    - In the file where the binding is implemented, create a registration
      function to register the static C++ references (e.g. the C++
      functions in `v8::FunctionCallback` associated with the function
      templates), like this:
    
      ```c++
      void RegisterExternalReferences(
              ExternalReferenceRegistry* registry) {
        registry->Register(cpp_func_1);
      }
      ```
    - At the end of the file where `NODE_MODULE_CONTEXT_AWARE_INTERNAL` is
      also usually called, register the registration function with
    
      ```
      NODE_MODULE_EXTERNAL_REFERENCE(binding_name,
                                     RegisterExternalReferences);
      ```
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    5eed671 View commit details
    Browse the repository at this point in the history
  3. tools: enable Node.js command line flags in node_mksnapshot

    Pass the flags down to node_mksnapshot so that we can use them
    when generating the snapshot (e.g. to debug or enable V8 flags)
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    ae47366 View commit details
    Browse the repository at this point in the history
  4. src: snapshot Environment upon instantiation

    This includes the initial Environment (without running bootstrap
    scripts) into the builtin snapshot
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    d275cb2 View commit details
    Browse the repository at this point in the history
  5. src: make code cache test work with snapshots

    Keep track of snapshotted modules in JS land, and move
    bootstrap switches into StartExecution() so that
    they are not included into part of the environment-independent
    bootstrap process.
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    aa3fabe View commit details
    Browse the repository at this point in the history
  6. src: snapshot loaders

    This runs `lib/internal/bootstrap/loaders.js` before creating
    the builtin snapshot and deserialize the loaders from the
    snapshot in deserialization mode.
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    7fb9589 View commit details
    Browse the repository at this point in the history
  7. src: reset zero fill toggle at pre-execution

    The connection between the JS land zero fill toggle and the
    C++ one in the NodeArrayBufferAllocator gets lost if the toggle
    is deserialized from the snapshot, because V8 owns the underlying
    memory of this toggle. This resets the connection at pre-execution.
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    ea44464 View commit details
    Browse the repository at this point in the history
  8. bootstrap: build fast APIs in pre-execution

    Fast APIs need to work with ArrayBuffers which we need
    to rebuild connections to after deserializing them
    from the snapshot. For now, postpone their creation
    until pre-execution to simplify the process.
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    c7007ca View commit details
    Browse the repository at this point in the history
  9. lib: initialize instance members in class constructors

    Since V8 snapshot does not currently support instance member
    initialization, initialize them in ordianry class constructors
    for now so that these classes can be included in the snapshot.
    This may be reverted once
    https://bugs.chromium.org/p/v8/issues/detail?id=10704
    is fixed and backported.
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    16f7545 View commit details
    Browse the repository at this point in the history
  10. src: snapshot node

    This runs `lib/internal/bootstrap/node.js` before creating
    the builtin snapshot and deserialize the loaders from the
    snapshot in deserialization mode.
    joyeecheung committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    720abb8 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2020

  1. Configuration menu
    Copy the full SHA
    393f653 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f85cf42 View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2020

  1. Configuration menu
    Copy the full SHA
    8c9260c View commit details
    Browse the repository at this point in the history