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

Unified Diff: src/builtins/builtins-promise.cc

Issue 2589113002: [api] add API for Promise status and result. (Closed)
Patch Set: addressed comments 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/api.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-promise.cc
diff --git a/src/builtins/builtins-promise.cc b/src/builtins/builtins-promise.cc
index baa6253aecdd2f3d62f2ab69599a813cb06b8fda..46f6043bd3c85350d81ea25da6940d0219a4b0ef 100644
--- a/src/builtins/builtins-promise.cc
+++ b/src/builtins/builtins-promise.cc
@@ -230,7 +230,7 @@ Node* PromiseBuiltinsAssembler::InternalPerformPromiseThen(Node* context,
{
Label fulfilled_check(this);
Node* const status = LoadObjectField(promise, JSPromise::kStatusOffset);
- GotoUnless(SmiEqual(status, SmiConstant(kPromisePending)),
+ GotoUnless(SmiEqual(status, SmiConstant(v8::Promise::kPending)),
&fulfilled_check);
Node* const existing_deferred =
@@ -304,12 +304,13 @@ Node* PromiseBuiltinsAssembler::InternalPerformPromiseThen(Node* context,
{
Label reject(this);
Node* const result = LoadObjectField(promise, JSPromise::kResultOffset);
- GotoUnless(WordEqual(status, SmiConstant(kPromiseFulfilled)), &reject);
+ GotoUnless(WordEqual(status, SmiConstant(v8::Promise::kFulfilled)),
+ &reject);
// TODO(gsathya): Move this to TF.
CallRuntime(Runtime::kEnqueuePromiseReactionJob, context, promise, result,
var_on_resolve.value(), deferred,
- SmiConstant(kPromiseFulfilled));
+ SmiConstant(v8::Promise::kFulfilled));
Goto(&out);
Bind(&reject);
@@ -326,7 +327,7 @@ Node* PromiseBuiltinsAssembler::InternalPerformPromiseThen(Node* context,
{
CallRuntime(Runtime::kEnqueuePromiseReactionJob, context, promise,
result, var_on_reject.value(), deferred,
- SmiConstant(kPromiseRejected));
+ SmiConstant(v8::Promise::kRejected));
Goto(&out);
}
@@ -415,7 +416,7 @@ void PromiseBuiltinsAssembler::InternalResolvePromise(Node* context,
LoadObjectField(result, JSPromise::kResultOffset);
Label if_isnotpending(this);
- GotoUnless(SmiEqual(SmiConstant(kPromisePending), thenable_status),
+ GotoUnless(SmiEqual(SmiConstant(v8::Promise::kPending), thenable_status),
&if_isnotpending);
// TODO(gsathya): Use a marker here instead of the actual then
@@ -430,13 +431,13 @@ void PromiseBuiltinsAssembler::InternalResolvePromise(Node* context,
Bind(&if_isnotpending);
{
Label if_fulfilled(this), if_rejected(this);
- Branch(SmiEqual(SmiConstant(kPromiseFulfilled), thenable_status),
+ Branch(SmiEqual(SmiConstant(v8::Promise::kFulfilled), thenable_status),
&if_fulfilled, &if_rejected);
Bind(&if_fulfilled);
{
CallRuntime(Runtime::kPromiseFulfill, context, promise,
- SmiConstant(kPromiseFulfilled), thenable_value);
+ SmiConstant(v8::Promise::kFulfilled), thenable_value);
PromiseSetHasHandler(promise);
Goto(out);
}
@@ -507,7 +508,7 @@ void PromiseBuiltinsAssembler::InternalResolvePromise(Node* context,
Bind(&fulfill);
{
CallRuntime(Runtime::kPromiseFulfill, context, promise,
- SmiConstant(kPromiseFulfilled), result);
+ SmiConstant(v8::Promise::kFulfilled), result);
Goto(out);
}
« no previous file with comments | « src/api.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698