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

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

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/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 501666f0a974cc9c8c2020814949c68bf3af6cfc..ba520eb43b60c532d8d3e6d7e3cd9c272e38fbca 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -136,14 +136,6 @@ static Handle<Object> DebugGetProperty(LookupIterator* it,
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) {
@@ -248,24 +240,8 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
result->set(5, generator->receiver());
return factory->NewJSArrayWithElements(result);
} else if (object->IsJSPromise()) {
- 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<JSPromise> promise = Handle<JSPromise>::cast(object);
+ const char* status = JSPromise::Status(promise->status());
Handle<FixedArray> result = factory->NewFixedArray(2 * 2);
Handle<String> promise_status =
factory->NewStringFromAsciiChecked("[[PromiseStatus]]");
@@ -273,8 +249,7 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
Handle<String> status_str = factory->NewStringFromAsciiChecked(status);
result->set(1, *status_str);
- Handle<Object> value_obj =
- DebugGetProperty(promise, isolate->factory()->promise_result_symbol());
+ Handle<Object> value_obj(promise->result(), isolate);
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