summaryrefslogtreecommitdiff
path: root/deps/v8/src/promise-utils.h
blob: 6ed6fcde5f2188c4668fc7330cb70613d5719c3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_PROMISE_UTILS_H_
#define V8_PROMISE_UTILS_H_

#include "src/objects.h"

namespace v8 {
namespace internal {

// Helper methods for Promise builtins.
class PromiseUtils : public AllStatic {
 public:
  // These get and set the slots on the PromiseResolvingContext, which
  // is used by the resolve/reject promise callbacks.
  static JSObject* GetPromise(Handle<Context> context);
  static Object* GetDebugEvent(Handle<Context> context);
  static bool HasAlreadyVisited(Handle<Context> context);
  static void SetAlreadyVisited(Handle<Context> context);

  static void CreateResolvingFunctions(Isolate* isolate,
                                       Handle<JSObject> promise,
                                       Handle<Object> debug_event,
                                       Handle<JSFunction>* resolve,
                                       Handle<JSFunction>* reject);
};
}  // namespace internal
}  // namespace v8

#endif  // V8_PROMISE_UTILS_H_