Skip to content

Instantly share code, notes, and snippets.

@abstractmachines
Last active September 16, 2022 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abstractmachines/bac44e334be54768ce7c4429692c9807 to your computer and use it in GitHub Desktop.
Save abstractmachines/bac44e334be54768ce7c4429692c9807 to your computer and use it in GitHub Desktop.
Chromium/V8 runbook

Chromium/V8 runbook

XCode:

  • Note that you'll need XCode, not just the XCode Mac CLI tools, to build/compile Chromium/V8 on Mac.

  • Ensure that you see this:

     $ xcode-select --print-path
     /Applications/Xcode.app/Contents/Developer
    

    and this:

    ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
    ... DriverKit, sdk dirs, sdk executables, etc ...
    

    and of course:

    g++ --help
    ... gives us a little manpage like:
    OVERVIEW: clang LLVM compiler
    linkerz loaderz oh my!
    

Contributing:

  1. Set up repo, build from source
  • Building from source
  • Check out source code
  • Check out source code using depot_tools
    • ensure depot_tools in beginning of PATH
    • in an empty dir, fetch v8
    • Update dependencies: gclient sync
    • git new-branch fix-bug-1234
  1. Developer & Commit Workflows (from "Life of a Chromium Developer" by Google)

    • Start work: git pull --rebase && client gsync

    • Code, compile with Ninja and GN tools/dev/gm.py x64.release

    • Compile and test: tools/dev/gm.py x64.release.check ... this takes quite awhile

    • # In the src/ directory:
      $ gn gen out/Default
      
      # Set build arguments (such as debug vs release):
      $ gn args out/Default
      
      # Do a build of the ‘chrome’ target:
      $ autoninja -C out/Default chrome
      # ‘autoninja’ is preferred over ‘ninja’
      # Builds to src/out/ directory, e.g. src/out/Default/chrome
      # For clean build, delete out/ directory (rarely needed)
      
    • Make new branch git checkout -t -b my_new_feature origin/main

    • Iterate on patches:

    • git cl upload

    • git cl try

    • todo git cl land - how is land different than try

  2. Request review.

For fetching all branches, add the following into your remote configuration in .git/config:

fetch = +refs/branch-heads/*:refs/remotes/branch-heads/*
fetch = +refs/tags/*:refs/tags/*
@abstractmachines
Copy link
Author

abstractmachines commented Aug 28, 2022

Running V8 "locally:" Compile the shell sample and run it as a shell!
Per https://stackoverflow.com/questions/1802478/running-v8-javascript-engine-standalone

$> svn co http://v8.googlecode.com/svn/trunk v8-trunk
...
$> cd v8-trunk
$> scons
$> g++ ./samples/shell.cc -o v8-shell -I include libv8.a 
Now, we have a standalone binary called v8-shell.

Running the console:

$> ./v8-shell 
V8 version 2.0.2
> var x = 10;
> x
10
> function foo(x) { return x * x; }
> foo
function foo(x) { return x * x; }
> quit()
Executing Javascript from the command line:

$> ./v8-shell -e 'print("10*10 = " + 10*10)'
10*10 = 100

@abstractmachines
Copy link
Author

@abstractmachines
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment