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

Unified Diff: src/api.cc

Issue 942003003: Add v8::Object::GetRealNamedPropertyAttributes() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months 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 | « include/v8.h ('k') | test/cctest/test-api.cc » ('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 6e19af4ed5c19c7a0fadb34d2f82451f8ad64efb..cc3a2882f95ba54a8f4b500fcd9a484bb65948cb 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3757,6 +3757,14 @@ static Local<Value> GetPropertyByLookup(i::LookupIterator* it) {
}
+static Maybe<PropertyAttribute> GetPropertyAttributesByLookup(
+ i::LookupIterator* it) {
+ Maybe<PropertyAttributes> attr = i::JSReceiver::GetPropertyAttributes(it);
+ if (!it->IsFound()) return Maybe<PropertyAttribute>();
+ return Maybe<PropertyAttribute>(static_cast<PropertyAttribute>(attr.value));
+}
+
+
Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
Handle<String> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
@@ -3775,6 +3783,24 @@ Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
}
+Maybe<PropertyAttribute>
+v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate,
+ "v8::Object::GetRealNamedPropertyAttributesInPrototypeChain()",
+ return Maybe<PropertyAttribute>());
+ ENTER_V8(isolate);
+ i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
+ i::PrototypeIterator iter(isolate, self_obj);
+ if (iter.IsAtEnd()) return Maybe<PropertyAttribute>();
+ i::Handle<i::Object> proto = i::PrototypeIterator::GetCurrent(iter);
+ i::LookupIterator it(self_obj, key_obj, i::Handle<i::JSReceiver>::cast(proto),
+ i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
+ return GetPropertyAttributesByLookup(&it);
+}
+
+
Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()",
@@ -3788,6 +3814,20 @@ Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
}
+Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes(
+ Handle<String> key) {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::GetRealNamedPropertyAttributes()",
+ return Maybe<PropertyAttribute>());
+ ENTER_V8(isolate);
+ i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
+ i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
+ i::LookupIterator it(self_obj, key_obj,
+ i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
+ return GetPropertyAttributesByLookup(&it);
+}
+
+
// Turns on access checks by copying the map and setting the check flag.
// Because the object gets a new map, existing inline cache caching
// the old map of this object will fail.
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698