Sunday, June 27, 2010

How to start hacking V8 JavaScript engine, IntelliJ IDEA Project Configuration

This blog post will describe how to start hacking V8 JavaScript engine with IntelliJ IDEA and C/C++ plugin.

First, one needs to checkout the sources from Subversion. You can do it using IntelliJ IDEA via action located in Version Control | Checkout from Version Control | Subversion. In appeared "Checkout from Subversion" dialog one should add "New repository location" e.g. "". Choosing repository and pressing "Checkout" will show us "Destination directory dialog", specify target directory and press default buttons in next dialogs.

After checkout IDEA suggests you to open the project for the directory you chose. After accepting this on and pressing default buttons several times one gets IntelliJ IDEA project with V8 sources.

For V8 project additional macros should be defined (e.g. V8_TARGET_ARCH_IA32, ENABLE_DEBUGGER_SUPPORT, etc), it should be done in Settings | C++ project settings (see screenshot below), just separate the macros list with semicolon.

V8 is cross platform project, it contains several implementations of v8::internal::OS, with the same methods. To avoid getting many "duplicated" symbols warnings with C++ plugin one needs to deselect reporting of "Duplicated definitions" warnings in second part of C++ project settings, reference image added below.

If one starts C++ project first time then system wide settings (like where gcc / MS Visual C directory is, system wide defines, etc) should be configured in Settings| C++ IDE settings, see screenshot below for the reference.

In next blog post we will develop some patch for V8, stay tuned :)

Sunday, March 7, 2010

Hacking V8 JavaScript engine

As many of you know, V8 is JavaScript engine for Chrome.
As every V8 embedder knows, V8 engine can not have several instances in process, or, more specifically, there could be no more than one JavaScript execution thread in the process in every moment of the time. With wider use of JavaScript as serverside language, the V8 limitation (fine for process per tab browser scenario) seems to be unfortunate, given amount of work put to V8 to have JavaScript code executed blazingly fast.
Using latest CppTools plugin version and some spare time I was managed to patch V8 to have ability to run several V8 instances in process. I will use this codebase for demonstrating configuration / usage of the c++ plugin for mentioned pretty large task.

Thursday, February 18, 2010

New version of CppTools plugin is available!

CppTools plugin v0.7.1 for IntelliJ IDEA 6/7/8/9 is available.
Change notes:
* IDEA 9 (Maia) / Community Edition support.
* Override / implement methods action for IDEA 7/8/9.
* Quick navigate info (aka Control + mouse hover) for IDEA 7/8/9.
* Report problem with instantiation of abstract classes.
* Quick fixes: static_cast / dynamic_cast when type cast error detected.
* Bugfixes.
Install it from IDEA's plugin manager