Lines Matching refs:function

26 // Maximum size in bytes of generate code for a function to allow OSR.
33 V(SmallFunction, "small function")
101 void TraceInOptimizationQueue(JSFunction function) {
103 PrintF("[not marking function %s for optimization: already queued]\n",
104 function.DebugNameCStr().get());
108 void TraceHeuristicOptimizationDisallowed(JSFunction function) {
111 "[not marking function %s for optimization: marked with "
113 function.DebugNameCStr().get());
117 void TraceRecompile(Isolate* isolate, JSFunction function,
122 function.ShortPrint(scope.file());
132 void TraceManualRecompile(JSFunction function, CodeKind code_kind,
136 function.ShortPrint();
142 void TieringManager::Optimize(JSFunction function, CodeKind code_kind,
145 TraceRecompile(isolate_, function, d);
146 function.MarkForOptimization(isolate_, d.code_kind, d.concurrency_mode);
153 JSFunction function = frame->function();
155 OSROptimizedCodeCache cache = function.native_context().osr_code_cache();
158 for (BytecodeOffset osr_offset : cache.OsrOffsetsFor(function.shared())) {
188 int TieringManager::InterruptBudgetFor(Isolate* isolate, JSFunction function) {
189 if (function.has_feedback_vector()) {
190 return TiersUpToMaglev(function.GetActiveTier())
195 DCHECK(!function.has_feedback_vector());
196 DCHECK(function.shared().is_compiled());
197 return function.shared().GetBytecodeArray(isolate).length() *
210 bool SmallEnoughForOSR(Isolate* isolate, JSFunction function) {
211 return function.shared().GetBytecodeArray(isolate).length() <=
213 function.feedback_vector().profiler_ticks() *
217 void TrySetOsrUrgency(Isolate* isolate, JSFunction function, int osr_urgency) {
218 SharedFunctionInfo shared = function.shared();
230 "[OSR - setting osr urgency. function: %s, old urgency: %d, new "
232 function.DebugNameCStr().get(), bytecode.osr_urgency(), osr_urgency);
239 void TryIncrementOsrUrgency(Isolate* isolate, JSFunction function) {
240 int old_urgency = function.shared().GetBytecodeArray(isolate).osr_urgency();
242 TrySetOsrUrgency(isolate, function, new_urgency);
245 void TryRequestOsrAtNextOpportunity(Isolate* isolate, JSFunction function) {
246 TrySetOsrUrgency(isolate, function, BytecodeArray::kMaxOsrUrgency);
249 void TryRequestOsrForCachedOsrCode(Isolate* isolate, JSFunction function,
252 int old_urgency = function.shared().GetBytecodeArray(isolate).osr_urgency();
255 TrySetOsrUrgency(isolate, function, new_urgency);
265 void TieringManager::RequestOsrAtNextOpportunity(JSFunction function) {
267 TryRequestOsrAtNextOpportunity(isolate_, function);
270 void TieringManager::MaybeOptimizeFrame(JSFunction function,
273 const TieringState tiering_state = function.feedback_vector().tiering_state();
275 function.feedback_vector().osr_tiering_state();
278 // Note: This effectively disables OSR for the function while it is being
280 TraceInOptimizationQueue(function);
286 function)) {
287 TraceHeuristicOptimizationDisallowed(function);
292 if (V8_UNLIKELY(function.shared().optimization_disabled())) return;
295 TryRequestOsrAtNextOpportunity(isolate_, function);
303 TryRequestOsrForCachedOsrCode(isolate_, function,
309 if (is_marked_for_any_optimization || function.HasAvailableOptimizedCode()) {
312 if (SmallEnoughForOSR(isolate_, function)) {
313 TryIncrementOsrUrgency(isolate_, function);
322 !function.HasAvailableOptimizedCode());
323 OptimizationDecision d = ShouldOptimize(function, code_kind, frame);
324 if (d.should_optimize()) Optimize(function, code_kind, d);
327 OptimizationDecision TieringManager::ShouldOptimize(JSFunction function,
330 DCHECK_EQ(code_kind, function.GetActiveTier().value());
333 !function.shared(isolate_).maglev_compilation_failed()) {
340 BytecodeArray bytecode = function.shared().GetBytecodeArray(isolate_);
341 const int ticks = function.feedback_vector().profiler_ticks();
349 // If no IC was patched since the last tick and this function is very
354 function.DebugNameCStr().get(), ticks, ticks_for_optimization);
358 PrintF(" too large for small function optimization: %d/%d]\n",
377 void TieringManager::OnInterruptTick(Handle<JSFunction> function) {
379 function->shared().is_compiled_scope(isolate_));
381 // Remember whether the function had a vector at this point. This is relevant
385 const bool had_feedback_vector = function->has_feedback_vector();
390 function->SetInterruptBudget(isolate_);
392 JSFunction::CreateAndAttachFeedbackVector(isolate_, function,
398 function->feedback_vector().set_invocation_count(1, kRelaxedStore);
401 DCHECK(function->has_feedback_vector());
402 DCHECK(function->shared().is_compiled());
403 DCHECK(function->shared().HasBytecodeArray());
413 if (CanCompileWithBaseline(isolate_, function->shared()) &&
414 !function->ActiveTierIsBaseline()) {
416 isolate_->baseline_batch_compiler()->EnqueueFunction(function);
419 function->shared().is_compiled_scope(isolate_));
420 Compiler::CompileBaseline(isolate_, function, Compiler::CLEAR_EXCEPTION,
436 JSFunction function_obj = *function;