Creating a macro assembler test on v8 for powerpc platform

Tags: v8, v8-testing


v8 project includes a number of tests to test functions. It is called cctest.

As part of the v8 project all platforms have some independent tests to make sure functions are working properly on those platforms. The platform ppc provides a number of tests. If you are interested in testing the assembler functions of ppc you will find assembler tests in test/cctest/ However, you probably won't find tests for macro assembler. It is possible to hack around the assembler test source file and implement macro assembler tests I guess. However, I have seen the x64 example where macro assembler tests are done separately and I like the idea.


I have been able to realize the idea. I want to provide examples how to do it. To add macro assembler tests on ppc you follow following steps,

  1. Add the new test source file location on test/cctest/cctest.gyp for ppc
  2. Add a new new source file test/cctest/

Adding the test source file on cctest.gyp

This is a single line addition on the file. We find the block which lists the source files for cctest. And our test source file there. This is how it looks like,

diff --git a/test/cctest/cctest.gyp b/test/cctest/cctest.gyp
index a251d6a..07c30f1 100644
--- a/test/cctest/cctest.gyp
+++ b/test/cctest/cctest.gyp
@@ -266,6 +266,7 @@
     'cctest_sources_ppc': [  ### gcmole(arch:ppc) ###
+      '',

Next time you build v8 it will include this source file. Therefore, tests written by you get included. Afterwards, you can run them using tools/

The macro assembler test source file

Here is the source file content for test/cctest/

The test source files tests following function (in src/ppc/

void MacroAssembler::Add(Register dst, Register src, intptr_t value,
                     Register scratch);

We pass r0 as scratch register.

Running the Test

For example, we do a debug build,

$ gmake ppc64.debug V=1 -j 32

Then run the test,

$ tools/ --arch-and-mode=ppc64.debug cctest/test-macro-assembler-ppc/ADD_TEST_EXAMPLE
>>> Running tests for ppc64.debug
No connection to distribution server; running tests locally.
[00:00|% 100|+   3|-   0]: Done

No Comments

Add a Comment