Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 7b0196a99c533286ba9ba9240c6bff57d35087ab..df119795418b345ec375ba15e71dad5d32d5d9c1 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -916,6 +916,21 @@ Handle<Symbol> Factory::NewPrivateSymbol() { |
return symbol; |
} |
+Handle<JSPromise> Factory::NewJSPromise() { |
+ Handle<JSFunction> constructor( |
+ isolate()->native_context()->promise_function(), isolate()); |
+ DCHECK(constructor->has_initial_map()); |
+ Handle<Map> map(constructor->initial_map(), isolate()); |
+ |
+ DCHECK(!map->is_prototype_map()); |
+ Handle<JSObject> promise_obj = NewJSObjectFromMap(map); |
+ Handle<JSPromise> promise = Handle<JSPromise>::cast(promise_obj); |
+ promise->set_status(v8::Promise::kPending); |
+ promise->set_flags(0); |
+ |
+ isolate()->RunPromiseHook(PromiseHookType::kInit, promise, undefined_value()); |
+ return promise; |
+} |
Handle<Context> Factory::NewNativeContext() { |
Handle<FixedArray> array = |