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

Unified Diff: src/api.cc

Issue 2405213002: V8 support for cached accessors. (Closed)
Patch Set: Centralized lookup in LookupIterator::TryLookupCacheProperty. Also rebase. Created 4 years, 2 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/crankshaft/hydrogen.cc » ('j') | src/ic/ic.cc » ('J')
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 d847d24bd2ee3273237fa6568612b6f0a891cdc1..8c874c5c3c94491ee6d98c9c9e5235cad007975b 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1085,6 +1085,11 @@ void Template::Set(v8::Local<Name> name, v8::Local<Data> value,
static_cast<i::PropertyAttributes>(attribute));
}
+void Template::SetPrivate(v8::Local<Private> name, v8::Local<Data> value,
+ v8::PropertyAttribute attribute) {
+ Set(Utils::ToLocal(Utils::OpenHandle(reinterpret_cast<Name*>(*name))), value,
+ attribute);
+}
void Template::SetAccessorProperty(
v8::Local<v8::Name> name,
@@ -1148,11 +1153,11 @@ void FunctionTemplate::Inherit(v8::Local<FunctionTemplate> value) {
info->set_parent_template(*Utils::OpenHandle(*value));
}
-
static Local<FunctionTemplate> FunctionTemplateNew(
i::Isolate* isolate, FunctionCallback callback,
experimental::FastAccessorBuilder* fast_handler, v8::Local<Value> data,
- v8::Local<Signature> signature, int length, bool do_not_cache) {
+ v8::Local<Signature> signature, int length, bool do_not_cache,
+ v8::Local<Private> cache_property = v8::Local<Private>()) {
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE);
i::Handle<i::FunctionTemplateInfo> obj =
@@ -1176,6 +1181,9 @@ static Local<FunctionTemplate> FunctionTemplateNew(
obj->set_accept_any_receiver(true);
if (!signature.IsEmpty())
obj->set_signature(*Utils::OpenHandle(*signature));
+ obj->set_cache_property(cache_property.IsEmpty()
+ ? isolate->heap()->the_hole_value()
+ : *Utils::OpenHandle(*cache_property));
return Utils::ToLocal(obj);
}
@@ -1220,6 +1228,16 @@ Local<FunctionTemplate> FunctionTemplate::NewWithFastHandler(
length, false);
}
+Local<FunctionTemplate> FunctionTemplate::NewWithCache(
+ Isolate* isolate, FunctionCallback callback, Local<Private> cache_property,
+ Local<Value> data, Local<Signature> signature, int length) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ DCHECK(!i_isolate->serializer_enabled());
+ LOG_API(i_isolate, FunctionTemplate, NewWithFastHandler);
+ ENTER_V8(i_isolate);
+ return FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
+ length, false, cache_property);
+}
Local<Signature> Signature::New(Isolate* isolate,
Local<FunctionTemplate> receiver) {
« no previous file with comments | « include/v8.h ('k') | src/crankshaft/hydrogen.cc » ('j') | src/ic/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698