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

Unified Diff: src/api.cc

Issue 1753643002: [api] Use shallow copy for the template instantiation cache (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 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 | « no previous file | src/api-natives.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 caa7d002f5fa43b2b4c3649febafbe64db704394..bf57a3aa14376ab17e6c42a8004561e72a2f80e6 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -940,9 +940,16 @@ void Template::Set(v8::Local<Name> name, v8::Local<Data> value,
i::Isolate* isolate = templ->GetIsolate();
ENTER_V8(isolate);
i::HandleScope scope(isolate);
+ auto value_obj = Utils::OpenHandle(*value);
+ if (value_obj->IsObjectTemplateInfo()) {
+ templ->set_serial_number(i::Smi::FromInt(0));
+ if (templ->IsFunctionTemplateInfo()) {
+ i::Handle<i::FunctionTemplateInfo>::cast(templ)->set_do_not_cache(true);
+ }
+ }
// TODO(dcarney): split api to allow values of v8::Value or v8::TemplateInfo.
i::ApiNatives::AddDataProperty(isolate, templ, Utils::OpenHandle(*name),
- Utils::OpenHandle(*value),
+ value_obj,
static_cast<i::PropertyAttributes>(attribute));
}
« no previous file with comments | « no previous file | src/api-natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698