0
Files
src/gin
Scott Violet 787d18548d gin: Updates v8-platform based on v8 changes
This change (and the v8 one) are motivated to improve the performance
of Date.now, which shows up in a MotionMark story.

The v8 change:
https://chromium-review.googlesource.com/c/v8/v8/+/4246257

Adds two time functions (the goal is to eventually remove the
existing one):
  virtual int64_t CurrentClockTimeMilliseconds();
  virtual double CurrentClockTimeMillisecondsHighResolution();

Both return millisecond accuracy, with the former returning an
integer value to make it clear precision is milliseconds.

The expensive part of Date.now() is the jitter code, which for
millisecond precision is only necessary when within kResolutionMillis
of a millisecond boundary. This patch updates the code to only
call to jitter when it actually matters.

This patch also converts TimeClamper to use integer values, and it
moves it into its own class to make it easy to test.

Bug: 1414615

Change-Id: Icff8637d45bfc39d544016f1236ed1cd16b4a0fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4242478
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1107174}
2023-02-18 15:29:32 +00:00
..

Gin - Lightweight bindings for V8

This directory contains Gin, a set of utilities to make working with V8 easier.

Here are some of the key bits:

  • converter.h: Templatized JS ↔ C++ conversion routines for many common C++ types. You can define your own by specializing Converter.

  • function_template.h: Create JavaScript functions that dispatch to any C++ function, member function pointer, or base::RepeatingCallback.

  • object_template_builder.h: A handy utility for creation of v8::ObjectTemplate.

  • wrappable.h: Base class for C++ classes that want to be owned by the V8 GC. Wrappable objects are automatically deleted when GC discovers that nothing in the V8 heap refers to them. This is also an easy way to expose C++ objects to JavaScript.

  • runner.h: Create script contexts and run code in them.

  • module_runner_delegate.h: A delegate for runner that implements a subset of the AMD module specification. Also see modules/ with some example modules.