0

Help me where I can find documentation for the TO_NUMBER function and what does the %(percentage sign) mean when placed before MathExpRT (which also can't find any docs about it)

https://github.com/v8/v8/blob/b0e4dce6091a8777bda80d962df76525dc6c5ea9/src/js/math.js#L62-L64

Mark Spencer
  • 81
  • 1
  • 6

2 Answers2

0

% in this context is a V8-specific syntax to denote a C++ method call, see here and here (it's not a JavaScript % which is a modulo operator).

MathExpRT as far as I understand from the other answers, is a name of a C++ method (in V8 runtime) to be called from within the JS file you linked.

Community
  • 1
  • 1
jakub.g
  • 38,512
  • 12
  • 92
  • 130
0

TO_NUMBER is a V8-internal macro defined here:

https://github.com/v8/v8/blob/ac886b0c1c173d6ceff762952e1d6cf78e8bd172/src/js/macros.py#L96

Not that this will help you much: it simply calls into an intrinsic, which is implemented as generated code, and has many different implementations depending on compiler (V8 has four), hardware platform (V8 supports about 10), and available type information. One generic code generator can be seen here:

https://github.com/v8/v8/blob/5acc31d86329794407f2764a369c2f638305b376/src/code-stub-assembler.cc#L3259

If you just want to know the semantics, you better look at the ECMAScript 262 standard.

Andreas Rossberg
  • 34,518
  • 3
  • 61
  • 72