52
52
#include " vm/BindingKind.h" // BindingKind
53
53
#include " vm/EnvironmentObject.h"
54
54
#include " vm/GeneratorAndAsyncKind.h" // GeneratorKind, FunctionAsyncKind
55
+ #include " vm/JSAtomUtils.h" // AtomToPrintableString
55
56
#include " vm/JSContext.h" // JSContext
56
57
#include " vm/JSFunction.h" // JSFunction, GetFunctionPrototype, NewFunctionWithProto
57
58
#include " vm/JSObject.h" // JSObject, TenuredObject
@@ -2945,9 +2946,17 @@ bool CompilationStencil::delazifySelfHostedFunction(
2945
2946
// JitCode for reuse across the runtime. If the cache already contains an
2946
2947
// entry for this function, update the JitScript. If not, compile it now and
2947
2948
// store it in the cache.
2949
+ UniqueChars nameStr;
2950
+ if (JS_SHOULD_LOG (selfHosted, Debug)) {
2951
+ nameStr = AtomToPrintableString (cx, name);
2952
+ }
2948
2953
auto & jitCache = cx->runtime ()->selfHostJitCache .ref ();
2949
2954
auto v = jitCache.readonlyThreadsafeLookup (jitCacheKey);
2950
2955
if (v && v->value ()->method ()) {
2956
+ JS_LOG (selfHosted, Debug,
2957
+ " self_hosted_cache: reusing JIT code for script '%s'" ,
2958
+ nameStr.get ());
2959
+
2951
2960
if (!cx->zone ()->ensureJitZoneExists (cx)) {
2952
2961
return false ;
2953
2962
}
@@ -2973,6 +2982,10 @@ bool CompilationStencil::delazifySelfHostedFunction(
2973
2982
} else if (jit::IsBaselineJitEnabled (cx) && script->canBaselineCompile () &&
2974
2983
!script->hasBaselineScript () &&
2975
2984
jit::CanBaselineInterpretScript (script)) {
2985
+ JS_LOG (selfHosted, Debug,
2986
+ " self_hosted_cache: new JIT code entry for script '%s'" ,
2987
+ nameStr.get ());
2988
+
2976
2989
if (!cx->zone ()->ensureJitZoneExists (cx)) {
2977
2990
return false ;
2978
2991
}
@@ -2999,6 +3012,11 @@ bool CompilationStencil::delazifySelfHostedFunction(
2999
3012
if (!jitCache.put (jitCacheKey, baselineScript)) {
3000
3013
return false ;
3001
3014
}
3015
+ } else {
3016
+ JS_LOG (selfHosted, Debug,
3017
+ " self_hosted_cache: script '%s' is not eligible for Baseline "
3018
+ " compilation" ,
3019
+ nameStr.get ());
3002
3020
}
3003
3021
}
3004
3022
0 commit comments