summaryrefslogtreecommitdiff
path: root/deps/v8/src/codegen/compilation-cache.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/codegen/compilation-cache.cc')
-rw-r--r--deps/v8/src/codegen/compilation-cache.cc24
1 files changed, 11 insertions, 13 deletions
diff --git a/deps/v8/src/codegen/compilation-cache.cc b/deps/v8/src/codegen/compilation-cache.cc
index 6e9613005e..ef3d83a06e 100644
--- a/deps/v8/src/codegen/compilation-cache.cc
+++ b/deps/v8/src/codegen/compilation-cache.cc
@@ -28,7 +28,7 @@ CompilationCache::CompilationCache(Isolate* isolate)
eval_global_(isolate),
eval_contextual_(isolate),
reg_exp_(isolate, kRegExpGenerations),
- enabled_(true) {
+ enabled_script_and_eval_(true) {
CompilationSubCache* subcaches[kSubCacheCount] = {
&script_, &eval_global_, &eval_contextual_, &reg_exp_};
for (int i = 0; i < kSubCacheCount; ++i) {
@@ -254,7 +254,7 @@ void CompilationCacheRegExp::Put(Handle<String> source, JSRegExp::Flags flags,
}
void CompilationCache::Remove(Handle<SharedFunctionInfo> function_info) {
- if (!IsEnabled()) return;
+ if (!IsEnabledScriptAndEval()) return;
eval_global_.Remove(function_info);
eval_contextual_.Remove(function_info);
@@ -265,7 +265,7 @@ MaybeHandle<SharedFunctionInfo> CompilationCache::LookupScript(
Handle<String> source, MaybeHandle<Object> name, int line_offset,
int column_offset, ScriptOriginOptions resource_options,
Handle<Context> native_context, LanguageMode language_mode) {
- if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
+ if (!IsEnabledScriptAndEval()) return MaybeHandle<SharedFunctionInfo>();
return script_.Lookup(source, name, line_offset, column_offset,
resource_options, native_context, language_mode);
@@ -277,7 +277,7 @@ InfoCellPair CompilationCache::LookupEval(Handle<String> source,
LanguageMode language_mode,
int position) {
InfoCellPair result;
- if (!IsEnabled()) return result;
+ if (!IsEnabledScriptAndEval()) return result;
const char* cache_type;
@@ -303,8 +303,6 @@ InfoCellPair CompilationCache::LookupEval(Handle<String> source,
MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source,
JSRegExp::Flags flags) {
- if (!IsEnabled()) return MaybeHandle<FixedArray>();
-
return reg_exp_.Lookup(source, flags);
}
@@ -312,7 +310,7 @@ void CompilationCache::PutScript(Handle<String> source,
Handle<Context> native_context,
LanguageMode language_mode,
Handle<SharedFunctionInfo> function_info) {
- if (!IsEnabled()) return;
+ if (!IsEnabledScriptAndEval()) return;
LOG(isolate(), CompilationCacheEvent("put", "script", *function_info));
script_.Put(source, native_context, language_mode, function_info);
@@ -324,7 +322,7 @@ void CompilationCache::PutEval(Handle<String> source,
Handle<SharedFunctionInfo> function_info,
Handle<FeedbackCell> feedback_cell,
int position) {
- if (!IsEnabled()) return;
+ if (!IsEnabledScriptAndEval()) return;
const char* cache_type;
HandleScope scope(isolate());
@@ -344,8 +342,6 @@ void CompilationCache::PutEval(Handle<String> source,
void CompilationCache::PutRegExp(Handle<String> source, JSRegExp::Flags flags,
Handle<FixedArray> data) {
- if (!IsEnabled()) return;
-
reg_exp_.Put(source, flags, data);
}
@@ -367,10 +363,12 @@ void CompilationCache::MarkCompactPrologue() {
}
}
-void CompilationCache::Enable() { enabled_ = true; }
+void CompilationCache::EnableScriptAndEval() {
+ enabled_script_and_eval_ = true;
+}
-void CompilationCache::Disable() {
- enabled_ = false;
+void CompilationCache::DisableScriptAndEval() {
+ enabled_script_and_eval_ = false;
Clear();
}