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); |