V8::Isolate定义在哪里?

Where is the V8::Isolate definition?

本文关键字:在哪里 Isolate V8 定义      更新时间:2023-10-16

这些都是关于JavaScript V8引擎的。V8::Isolate类在哪里定义?在代码(api.cc)中:

i::Isolate* isolate = new i::Isolate(false);

隔离是从v8::internal::isolate类创建的。下面是对v8::isolate对象的强制转换。

Isolate* Isolate::New(const Isolate::CreateParams& params) {
  i::Isolate* isolate = new i::Isolate(false);
  Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
  ...
}

有人知道这个类是在哪里定义的吗?

有两个Isolate类。v8::Isolate类是公共接口的一部分,在include/v8.h中声明。v8::internal::Isolate类是实际的隔离,在src/isolate.h中声明。