skip to Main Content

Where are the basic operators (+, >, <, etc.) defined in the source code? I think the Chrome Engine is called V8? But I don’t feel like downloading, compiling and debugging it to find out.

I looked in some the .h/.cc files, gave up and came here.

3

Answers


  1. Where did you check the source code of V8 engine?
    I can see many operators defined and used in the source.
    Please check the following link.
    https://chromium.googlesource.com/v8/v8/+/refs/heads/main/src/builtins/builtins-number.cc
    Regards

    Login or Signup to reply.
  2. (V8 developer here.)

    There isn’t just one "definition" of an operator.

    There are token definitions in the tokenizer.
    There are AST node definitions in the parser.
    There are bytecode handler implementations in the interpreter, which are reusing code that’s also used to generate stand-alone builtin stubs, and there’s the corresponding code in the bytecode generator.
    And then each of the compilers has its own handling of them with varying levels of optimization; especially in case of the optimizing compiler there’s also a bunch of further processing of the operators in its various stages.

    If you’re trying to understand which operators are available, as one commenter is speculating, it’s probably easier to look at the JavaScript specification or MDN.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search