Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/script/v8/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <unordered_map>

#include <v8.h>
#include <v8-external.h>
#include <libplatform/libplatform.h>

using namespace script;
Expand Down Expand Up @@ -254,7 +255,7 @@ class V8ScriptObject : public InternalScriptObject {
auto isolate = args.GetIsolate();
v8::HandleScope handle_scope(isolate);
auto data = args.Data().As<v8::External>();
auto& func = *reinterpret_cast<script::Function*>(data->Value());
auto& func = *reinterpret_cast<script::Function*>(data->Value(v8::kExternalPointerTypeTagDefault));

for (int i = 0; i < args.Length(); i++) {
func.arguments.push_back(getValue(isolate, args[i]));
Expand All @@ -274,7 +275,7 @@ class V8ScriptObject : public InternalScriptObject {
auto isolate = m_engine.get<V8Engine>()->m_isolate;
auto context = m_engine.get<V8Engine>()->context();
for (auto& entry : functions) {
auto tpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second));
auto tpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second, v8::kExternalPointerTypeTagDefault));
auto func = tpl->GetFunction(context).ToLocalChecked();
Check(object->Set(context,
ToLocal(v8::String::NewFromUtf8(isolate, entry.first.c_str())),
Expand All @@ -287,10 +288,10 @@ class V8ScriptObject : public InternalScriptObject {
auto context = m_engine.get<V8Engine>()->context();

for (auto& entry : properties) {
auto getterTpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second.getter));
auto getterTpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second.getter, v8::kExternalPointerTypeTagDefault));
auto getter = getterTpl->GetFunction(context).ToLocalChecked();

auto setterTpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second.setter));
auto setterTpl = v8::FunctionTemplate::New(isolate, callFunc, v8::External::New(isolate, &entry.second.setter, v8::kExternalPointerTypeTagDefault));
auto setter = setterTpl->GetFunction(context).ToLocalChecked();

v8::PropertyDescriptor descriptor(getter, setter);
Expand Down
Loading