| Index: src/wasm/managed.h
|
| diff --git a/src/wasm/managed.h b/src/wasm/managed.h
|
| index 785d5d32c0ac314349d8f0b5a1ad2ed318a78d06..5e2a9c82d561b858223af982533cbfc46e58539c 100644
|
| --- a/src/wasm/managed.h
|
| +++ b/src/wasm/managed.h
|
| @@ -22,12 +22,15 @@ class Managed : public Foreign {
|
| return reinterpret_cast<CppType*>(foreign_address());
|
| }
|
|
|
| + static Managed<CppType>* cast(Object* obj) {
|
| + SLOW_DCHECK(obj->IsForeign());
|
| + return reinterpret_cast<Managed<CppType>*>(obj);
|
| + }
|
| +
|
| static Handle<Managed<CppType>> New(Isolate* isolate, CppType* ptr,
|
| bool delete_on_gc = true) {
|
| - Handle<Foreign> foreign =
|
| - isolate->factory()->NewForeign(reinterpret_cast<Address>(ptr));
|
| - Handle<Managed<CppType>> handle(
|
| - reinterpret_cast<Managed<CppType>*>(*foreign), isolate);
|
| + Handle<Managed<CppType>> handle = Handle<Managed<CppType>>::cast(
|
| + isolate->factory()->NewForeign(reinterpret_cast<Address>(ptr)));
|
| if (delete_on_gc) {
|
| RegisterWeakCallbackForDelete(isolate, handle);
|
| }
|
|
|