@@ -17,10 +17,7 @@ BaseObject::BaseObject(Realm* realm, Local<Object> object) |
17 | 17 | : persistent_handle_(realm->isolate(), object), realm_(realm) { |
18 | 18 | CHECK_EQ(false, object.IsEmpty()); |
19 | 19 | CHECK_GE(object->InternalFieldCount(), BaseObject::kInternalFieldCount); |
20 | | - object->SetAlignedPointerInInternalField(BaseObject::kEmbedderType, |
21 | | - &kNodeEmbedderId); |
22 | | - object->SetAlignedPointerInInternalField(BaseObject::kSlot, |
23 | | - static_cast<void*>(this)); |
| 20 | + SetInternalFields(object, static_cast<void*>(this)); |
24 | 21 | realm->AddCleanupHook(DeleteMe, static_cast<void*>(this)); |
25 | 22 | realm->modify_base_object_count(1); |
26 | 23 | } |
@@ -80,16 +77,19 @@ void BaseObject::LazilyInitializedJSTemplateConstructor( |
80 | 77 | const FunctionCallbackInfo<Value>& args) { |
81 | 78 | DCHECK(args.IsConstructCall()); |
82 | 79 | CHECK_GE(args.This()->InternalFieldCount(), BaseObject::kInternalFieldCount); |
83 | | - args.This()->SetAlignedPointerInInternalField(BaseObject::kEmbedderType, |
84 | | - &kNodeEmbedderId); |
85 | | - args.This()->SetAlignedPointerInInternalField(BaseObject::kSlot, nullptr); |
| 80 | + SetInternalFields(args.This(), nullptr); |
86 | 81 | } |
87 | 82 |
|
88 | 83 | Local<FunctionTemplate> BaseObject::MakeLazilyInitializedJSTemplate( |
89 | 84 | Environment* env) { |
| 85 | + return MakeLazilyInitializedJSTemplate(env->isolate_data()); |
| 86 | +} |
| 87 | + |
| 88 | +Local<FunctionTemplate> BaseObject::MakeLazilyInitializedJSTemplate( |
| 89 | + IsolateData* isolate_data) { |
90 | 90 | Local<FunctionTemplate> t = NewFunctionTemplate( |
91 | | - env->isolate(), LazilyInitializedJSTemplateConstructor); |
92 | | - t->Inherit(BaseObject::GetConstructorTemplate(env)); |
| 91 | + isolate_data->isolate(), LazilyInitializedJSTemplateConstructor); |
| 92 | + t->Inherit(BaseObject::GetConstructorTemplate(isolate_data)); |
93 | 93 | t->InstanceTemplate()->SetInternalFieldCount(BaseObject::kInternalFieldCount); |
94 | 94 | return t; |
95 | 95 | } |
|