)]}'
{
  "commit": "d2c6967f1d2d05cb39fbd0919c4909dbc0be8eb8",
  "tree": "048ff594176b8761fe32eba144fc296cd7b4d097",
  "parents": [
    "79d8df021cbee7bff6c4114e76763535e28d92ac"
  ],
  "author": {
    "name": "Karl Wiberg",
    "email": "kwiberg@webrtc.org",
    "time": "Tue Sep 29 11:55:13 2020"
  },
  "committer": {
    "name": "Commit Bot",
    "email": "commit-bot@chromium.org",
    "time": "Wed Sep 30 06:59:44 2020"
  },
  "message": "Optimize RoboCaller::AddReceiver() for code size\n\nEssentially, instead of having the inlined UntypedFunction::Create(f)\nreturn an UntypedFunction which is then passed as an argument to\nnon-inlined RoboCallerReceivers::AddReceiverImpl(), we let\nUntypedFunction::PrepareArgs(f) return a few different kinds of\ntrivial structs (depending on what sort of type f has) which are\npassed as arguments to non-inlined RoboCallerReceivers::AddReceiver()\n(which then converts them to UntypedFunction by calling\nUntypedFunction::Create()). These structs are smaller than\nUntypedFunction and optimized for argument passing, so many fewer\ninstructions are needed.\n\nExample code:\n\n  struct Foo {\n    void Receive(int, float, int, float);\n    void TestAddLambdaReceiver();\n    webrtc::RoboCaller\u003cint, float, int, float\u003e rc;\n  };\n\n  void Foo::TestAddLambdaReceiver() {\n    rc.AddReceiver([this](int a, float b, int c, float d){\n        Receive(a, b, c, d);});\n  }\n\nOn arm32, we get before this CL:\n\n  Foo::TestAddLambdaReceiver():\n        push    {r11, lr}\n        mov     r11, sp\n        sub     sp, sp, #24\n        ldr     r1, .LCPI0_0\n        mov     r2, #0\n        stm     sp, {r0, r2}\n        add     r1, pc, r1\n        str     r2, [sp, #20]\n        str     r1, [sp, #16]\n        mov     r1, sp\n        bl      RoboCallerReceivers::AddReceiverImpl\n        mov     sp, r11\n        pop     {r11, pc}\n  .LCPI0_0:\n        .long   CallInlineStorage\u003cFoo::TestAddLambdaReceiver()::$_0\u003e\n  CallInlineStorage\u003cFoo::TestAddLambdaReceiver()::$_0\u003e:\n        ldr     r0, [r0]\n        b       Foo::Receive(int, float, int, float)\n\nAfter this CL:\n\n  Foo::TestAddLambdaReceiver():\n        ldr     r3, .LCPI0_0\n        mov     r2, r0\n        add     r3, pc, r3\n        b       RoboCallerReceivers::AddReceiver\u003c1u\u003e\n  .LCPI0_0:\n        .long   CallInlineStorage\u003cFoo::TestAddLambdaReceiver()::$_0\u003e\n  CallInlineStorage\u003cFoo::TestAddLambdaReceiver()::$_0\u003e:\n        ldr     r0, [r0]\n        b       Foo::Receive(int, float, int, float)\n\n(Symbol names abbreviated so that they\u0027ll fit on one line.)\n\nSo a reduction from 64 to 28 bytes. The improvements on arm64 and\nx86_64 are similar.\n\nBug: webrtc:11943\nChange-Id: I93fbba083be0235051c3279d3e3f6852a4a9fdad\nReviewed-on: https://webrtc-review.googlesource.com/c/src/+/185960\nCommit-Queue: Karl Wiberg \u003ckwiberg@webrtc.org\u003e\nReviewed-by: Mirko Bonadei \u003cmbonadei@webrtc.org\u003e\nCr-Commit-Position: refs/heads/master@{#32244}\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a09c06ed75e704679c8acc0dcf4909244e01968d",
      "old_mode": 33188,
      "old_path": "rtc_base/BUILD.gn",
      "new_id": "489a5c6056df2d925126f411528f871c25259faa",
      "new_mode": 33188,
      "new_path": "rtc_base/BUILD.gn"
    },
    {
      "type": "modify",
      "old_id": "a97687a76a35785dfb24814fc443b2497edeb061",
      "old_mode": 33188,
      "old_path": "rtc_base/robo_caller.cc",
      "new_id": "a7c35cbfdbc79ef46a8cadbbb7ec6914488ab72b",
      "new_mode": 33188,
      "new_path": "rtc_base/robo_caller.cc"
    },
    {
      "type": "modify",
      "old_id": "573e7b64c8fb82fe5f1a86617ec9888c88566e75",
      "old_mode": 33188,
      "old_path": "rtc_base/robo_caller.h",
      "new_id": "9df6a48a5e54f9621108ec7400e5aabb7a6a480c",
      "new_mode": 33188,
      "new_path": "rtc_base/robo_caller.h"
    },
    {
      "type": "modify",
      "old_id": "9220d3f9e4035c089bdb114ec0eb1d95da07a167",
      "old_mode": 33188,
      "old_path": "rtc_base/untyped_function.h",
      "new_id": "16c5ba0c8eb894b8872cdb30ba7c3d5b0cc59ab4",
      "new_mode": 33188,
      "new_path": "rtc_base/untyped_function.h"
    }
  ]
}
