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

Unified Diff: src/api.cc

Issue 1502593002: [API] GetOwnPropertyDescriptor: use C++ implementation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | src/contexts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9078b4d7240fe5bf8059de8dba2bcca23e52a108..eb284cac6443ddada1d166953ea2f5170f0be992 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3659,17 +3659,18 @@ MaybeLocal<Value> v8::Object::GetOwnPropertyDescriptor(Local<Context> context,
Local<String> key) {
PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyDescriptor()",
Value);
- auto obj = Utils::OpenHandle(this);
- auto key_name = Utils::OpenHandle(*key);
- i::Handle<i::Object> args[] = { obj, key_name };
- i::Handle<i::JSFunction> fun = isolate->object_get_own_property_descriptor();
- i::Handle<i::Object> undefined = isolate->factory()->undefined_value();
- i::Handle<i::Object> result;
- has_pending_exception =
- !i::Execution::Call(isolate, fun, undefined, arraysize(args), args)
- .ToHandle(&result);
+ i::Handle<i::JSReceiver> obj = Utils::OpenHandle(this);
+ i::Handle<i::String> key_name = Utils::OpenHandle(*key);
+
+ i::PropertyDescriptor desc;
+ bool found =
+ i::JSReceiver::GetOwnPropertyDescriptor(isolate, obj, key_name, &desc);
+ has_pending_exception = isolate->has_pending_exception();
RETURN_ON_FAILED_EXECUTION(Value);
- RETURN_ESCAPED(Utils::ToLocal(result));
+ if (!found) {
+ return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
+ }
+ RETURN_ESCAPED(Utils::ToLocal(desc.ToObject(isolate)));
}
« no previous file with comments | « no previous file | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698