Chromium Code Reviews| Index: src/factory.cc |
| diff --git a/src/factory.cc b/src/factory.cc |
| index b80aaf37a34e09b665b5030c54880cf261f43d00..985694f240078f0b4da7069381dc549b2885da55 100644 |
| --- a/src/factory.cc |
| +++ b/src/factory.cc |
| @@ -915,6 +915,19 @@ 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); |
|
adamk
2017/03/15 21:36:44
There are other fields, don't we need to initializ
gsathya
2017/03/16 00:59:24
Those are set to undefined by default which is val
adamk
2017/03/16 21:41:23
Ah, ok. Can you add comments to both places refere
|
| + return promise; |
| +} |
| Handle<Context> Factory::NewNativeContext() { |
| Handle<FixedArray> array = |