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

Unified Diff: src/api.cc

Issue 906463002: add support for all can read interceptors (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') | src/ic/ic.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 e7e41987a73c304d7f1489fede06c2c42f5b48cc..2719dd6ef1ba72713789bdba0e510b657224dad7 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1207,21 +1207,17 @@ void ObjectTemplate::SetAccessor(v8::Handle<Name> name,
template <typename Getter, typename Setter, typename Query, typename Deleter,
typename Enumerator>
-static void ObjectTemplateSetNamedPropertyHandler(ObjectTemplate* templ,
- Getter getter, Setter setter,
- Query query, Deleter remover,
- Enumerator enumerator,
- Handle<Value> data,
- bool can_intercept_symbols) {
+static void ObjectTemplateSetNamedPropertyHandler(
+ ObjectTemplate* templ, Getter getter, Setter setter, Query query,
+ Deleter remover, Enumerator enumerator, Handle<Value> data,
+ bool can_intercept_symbols, PropertyHandlerFlags flags) {
i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate();
ENTER_V8(isolate);
i::HandleScope scope(isolate);
auto cons = EnsureConstructor(isolate, templ);
EnsureNotInstantiated(cons, "ObjectTemplateSetNamedPropertyHandler");
- i::Handle<i::Struct> struct_obj =
- isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE);
- i::Handle<i::InterceptorInfo> obj =
- i::Handle<i::InterceptorInfo>::cast(struct_obj);
+ auto obj = i::Handle<i::InterceptorInfo>::cast(
+ isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE));
if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter);
if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter);
@@ -1230,6 +1226,8 @@ static void ObjectTemplateSetNamedPropertyHandler(ObjectTemplate* templ,
if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator);
obj->set_flags(0);
obj->set_can_intercept_symbols(can_intercept_symbols);
+ obj->set_all_can_read(static_cast<int>(flags) &
+ static_cast<int>(PropertyHandlerFlags::kAllCanRead));
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
@@ -1244,15 +1242,16 @@ void ObjectTemplate::SetNamedPropertyHandler(
NamedPropertyQueryCallback query, NamedPropertyDeleterCallback remover,
NamedPropertyEnumeratorCallback enumerator, Handle<Value> data) {
ObjectTemplateSetNamedPropertyHandler(this, getter, setter, query, remover,
- enumerator, data, false);
+ enumerator, data, false,
+ PropertyHandlerFlags::kNone);
}
void ObjectTemplate::SetHandler(
const NamedPropertyHandlerConfiguration& config) {
- ObjectTemplateSetNamedPropertyHandler(this, config.getter, config.setter,
- config.query, config.deleter,
- config.enumerator, config.data, true);
+ ObjectTemplateSetNamedPropertyHandler(
+ this, config.getter, config.setter, config.query, config.deleter,
+ config.enumerator, config.data, true, config.flags);
}
@@ -1302,10 +1301,8 @@ void ObjectTemplate::SetHandler(
i::HandleScope scope(isolate);
auto cons = EnsureConstructor(isolate, this);
EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler");
- i::Handle<i::Struct> struct_obj =
- isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE);
- i::Handle<i::InterceptorInfo> obj =
- i::Handle<i::InterceptorInfo>::cast(struct_obj);
+ auto obj = i::Handle<i::InterceptorInfo>::cast(
+ isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE));
if (config.getter != 0) SET_FIELD_WRAPPED(obj, set_getter, config.getter);
if (config.setter != 0) SET_FIELD_WRAPPED(obj, set_setter, config.setter);
@@ -1315,6 +1312,8 @@ void ObjectTemplate::SetHandler(
SET_FIELD_WRAPPED(obj, set_enumerator, config.enumerator);
}
obj->set_flags(0);
+ obj->set_all_can_read(static_cast<int>(config.flags) &
+ static_cast<int>(PropertyHandlerFlags::kAllCanRead));
v8::Local<v8::Value> data = config.data;
if (data.IsEmpty()) {
« no previous file with comments | « include/v8.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698