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

Unified Diff: src/runtime/runtime-debug.cc

Issue 2554013002: Revert of Create JSPromise (Closed)
Patch Set: 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/runtime/runtime.h ('k') | src/runtime/runtime-promise.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index ba520eb43b60c532d8d3e6d7e3cd9c272e38fbca..501666f0a974cc9c8c2020814949c68bf3af6cfc 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -136,6 +136,14 @@
return it->isolate()->factory()->undefined_value();
}
+
+static Handle<Object> DebugGetProperty(Handle<Object> object,
+ Handle<Name> name) {
+ LookupIterator it(object, name);
+ return DebugGetProperty(&it);
+}
+
+
template <class IteratorType>
static MaybeHandle<JSArray> GetIteratorInternalProperties(
Isolate* isolate, Handle<IteratorType> object) {
@@ -240,8 +248,24 @@
result->set(5, generator->receiver());
return factory->NewJSArrayWithElements(result);
} else if (object->IsJSPromise()) {
- Handle<JSPromise> promise = Handle<JSPromise>::cast(object);
- const char* status = JSPromise::Status(promise->status());
+ Handle<JSObject> promise = Handle<JSObject>::cast(object);
+
+ Handle<Object> status_obj =
+ DebugGetProperty(promise, isolate->factory()->promise_state_symbol());
+ CHECK(status_obj->IsSmi());
+ const char* status = "rejected";
+ int status_val = Handle<Smi>::cast(status_obj)->value();
+ switch (status_val) {
+ case kPromiseFulfilled:
+ status = "resolved";
+ break;
+ case kPromisePending:
+ status = "pending";
+ break;
+ default:
+ DCHECK_EQ(kPromiseRejected, status_val);
+ }
+
Handle<FixedArray> result = factory->NewFixedArray(2 * 2);
Handle<String> promise_status =
factory->NewStringFromAsciiChecked("[[PromiseStatus]]");
@@ -249,7 +273,8 @@
Handle<String> status_str = factory->NewStringFromAsciiChecked(status);
result->set(1, *status_str);
- Handle<Object> value_obj(promise->result(), isolate);
+ Handle<Object> value_obj =
+ DebugGetProperty(promise, isolate->factory()->promise_result_symbol());
Handle<String> promise_value =
factory->NewStringFromAsciiChecked("[[PromiseValue]]");
result->set(2, *promise_value);
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-promise.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698