Commit 82fc74c9 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[nci] Check the isolate cache from within compiler.cc

Just like the optimized code cache, the compiler should check the
isolate cache for NCI code objects and return them if they exist.

Drive-by: Skip additional tests to fix the nci_as_highest_tier test
variant. These are related to interactions with deoptimization, which
NCI code doesn't fully support yet.

Bug: v8:8888
Change-Id: I6253811f96993796cfc38fff0da7ffb4f1a5eb24
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2339095
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69251}
parent a61aaed9
......@@ -921,6 +921,12 @@ void InsertCodeIntoCompilationCache(Isolate* isolate,
if (FLAG_trace_turbo_nci) CompilationCacheCode::TraceInsertion(sfi, code);
}
V8_WARN_UNUSED_RESULT MaybeHandle<Code> GetCodeFromCompilationCache(
Isolate* isolate, Handle<SharedFunctionInfo> shared) {
if (!shared->may_have_cached_code()) return {};
return shared->TryGetCachedCode(isolate);
}
bool GetOptimizedCodeNow(OptimizedCompilationJob* job, Isolate* isolate) {
TimerEventScope<TimerEventRecompileSynchronous> timer(isolate);
RuntimeCallTimerScope runtimeTimer(
......@@ -1034,11 +1040,14 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
if (CodeKindIsNativeContextIndependentJSFunction(code_kind)) {
// We don't generate NCI code for OSR.
DCHECK_EQ(osr_offset, BailoutId::None());
// Don't generate NCI code when we've already done so in the past.
// TODO(jgruber,v8:8888): A better heuristic. If code has previously been
// cached but subsequently removed through cache ageing, we should be able
// to compile again.
if (shared->may_have_cached_code()) return {};
Handle<Code> cached_code;
if (GetCodeFromCompilationCache(isolate, shared).ToHandle(&cached_code)) {
if (FLAG_trace_turbo_nci)
CompilationCacheCode::TraceHit(shared, cached_code);
return cached_code;
}
}
VMState<COMPILER> state(isolate);
......
......@@ -658,6 +658,9 @@
'test-heap/OptimizedPretenuring*': [SKIP],
'test-heap-profiler/SamplingHeapProfilerPretenuredInlineAllocations': [SKIP],
'test-log/LogAll': [SKIP],
# NCI code currently does not use the feedback vector's optimized code cache.
'test-compiler/OptimizedCodeSharing1': [SKIP],
}], # variant == nci or variant == nci_as_highest_tier
]
......@@ -139,6 +139,7 @@
['variant == turboprop or variant == nci or variant == nci_as_highest_tier', {
# Deopts differently than TurboFan.
'debug/debug-optimize': [SKIP],
'debug/debug-compile-optimized': [SKIP],
}], # variant == turboprop or variant == nci or variant == nci_as_highest_tier
##############################################################################
......
......@@ -1323,12 +1323,20 @@
################################################################################
['variant == nci or variant == nci_as_highest_tier', {
# Deopts differently than TurboFan.
# Deoptimization support is still incomplete in general, since deopts can
# only happen when explicitly requested by tests. NCI code objects are then
# set as marked_for_deoptimization *and never unset*, which means functions
# with attached NCI code objects will never again count as optimized.
# TODO(jgruber): Fix this once deopts can occur outside tests.
'compiler/is-being-interpreted*': [SKIP],
'compiler/number-comparison-truncations': [SKIP],
'compiler/redundancy-elimination': [SKIP],
'compiler/regress-9945-*': [SKIP],
'regress/regress-1049982-1': [SKIP],
'regress/regress-1049982-2': [SKIP],
'compiler/test-dynamic-map-*': [SKIP],
'es6/collections-constructor-iterator-side-effect': [SKIP],
'es6/collections-constructor-with-modified-protoype': [SKIP],
# Deopts due to different behavior in BytecodeGraphBuilder::GetForInMode. In
# default TF, the ForInHint is kAny, in NCI mode kNone (because we currently
# don't use feedback).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment