Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: src/objects.h

Issue 2536463002: Create JSPromise (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/promise.js ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 5327b7a7fc69301413bae1b8d8c39166a4a4c250..8b31d74d58cfa87b91766327fa4ef5fe584c1aa8 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -8906,6 +8906,41 @@ class JSMessageObject: public JSObject {
kSize> BodyDescriptor;
};
+class JSPromise : public JSObject {
+ public:
+ DECL_INT_ACCESSORS(status)
+ DECL_ACCESSORS(result, Object)
+
+ // There are 3 possible states for these fields --
+ // 1) Undefined -- This is the zero state when there is no callback
+ // or deferred registered.
+ // 2) Object -- There is a single Callable directly attached to the
+ // fulfill_reactions, reject_reactions and the deferred JSObject is
+ // directly attached to the deferred field.
+ // 3) FixedArray -- There is more than one callback and deferred
+ // attached to a FixedArray.
+ DECL_ACCESSORS(deferred, Object)
+ DECL_ACCESSORS(fulfill_reactions, Object)
+ DECL_ACCESSORS(reject_reactions, Object)
+
+ static const char* Status(int status);
+
+ DECLARE_CAST(JSPromise)
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(JSPromise)
+ DECLARE_VERIFIER(JSPromise)
+
+ // Layout description.
+ static const int kStatusOffset = JSObject::kHeaderSize;
+ static const int kResultOffset = kStatusOffset + kPointerSize;
+ static const int kDeferredOffset = kResultOffset + kPointerSize;
+ static const int kFulfillReactionsOffset = kDeferredOffset + kPointerSize;
+ static const int kRejectReactionsOffset =
+ kFulfillReactionsOffset + kPointerSize;
+ static const int kSize = kRejectReactionsOffset + kPointerSize;
+};
+
// Regular expressions
// The regular expression holds a single reference to a FixedArray in
// the kDataOffset field.
« no previous file with comments | « src/js/promise.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698