Commit aa08c41a authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

Rename OptimizationMarker values and related runtime functions

.. in preparation for integrating addtl tiers into a single tiering
system.

1. Explicitly spell out whether the request is concurrent or not.
2. Explicitly request the target compiler.

Bug: v8:7700
Change-Id: I9d6e9f6a5d5f0f7218fe136ff50cea2ad7987f67
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3460739
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79092}
parent ef55d88c
......@@ -936,12 +936,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
// -----------------------------------
DCHECK(!AreAliased(feedback_vector, r1, r3, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -1122,12 +1122,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
ASM_CODE_COMMENT(masm);
DCHECK(!AreAliased(feedback_vector, x1, x3, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -61,12 +61,12 @@ void LazyBuiltinsAssembler::MaybeTailCallOptimizedCodeSlot(
// all these marker values there.
TNode<Uint32T> marker =
DecodeWord32<FeedbackVector::OptimizationMarkerBits>(optimization_state);
TailCallRuntimeIfMarkerEquals(marker, OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent,
function);
TailCallRuntimeIfMarkerEquals(
marker, OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent, function);
marker, OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent, function);
TailCallRuntimeIfMarkerEquals(marker,
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent, function);
Unreachable();
BIND(&may_have_optimized_code);
......
......@@ -894,12 +894,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm,
ASM_CODE_COMMENT(masm);
DCHECK(!AreAliased(edx, edi, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -912,12 +912,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
// -----------------------------------
DCHECK(!AreAliased(feedback_vector, a1, a3, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -912,12 +912,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
ASM_CODE_COMMENT(masm);
DCHECK(!AreAliased(feedback_vector, a1, a3, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized /
// CompileOptimizedConcurrent. InOptimizationQueue and None shouldn't reach
......
......@@ -922,12 +922,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
// -----------------------------------
DCHECK(!AreAliased(feedback_vector, a1, a3, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -924,12 +924,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
// -----------------------------------
DCHECK(!AreAliased(feedback_vector, r4, r6, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -973,12 +973,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
// TODO(v8:8394): The logging of first execution will break if
// feedback vectors are not allocated. We need to find a different way of
// logging these events if required.
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -1211,12 +1211,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
// -----------------------------------
DCHECK(!AreAliased(feedback_vector, r3, r5, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -952,12 +952,13 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
ASM_CODE_COMMENT(masm);
DCHECK(!AreAliased(feedback_vector, rdx, rdi, optimization_marker));
TailCallRuntimeIfMarkerEquals(
masm, optimization_marker,
OptimizationMarker::kCompileTurbofan_NotConcurrent,
Runtime::kCompileTurbofan_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimized,
Runtime::kCompileOptimized_NotConcurrent);
TailCallRuntimeIfMarkerEquals(masm, optimization_marker,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
OptimizationMarker::kCompileTurbofan_Concurrent,
Runtime::kCompileTurbofan_Concurrent);
// Marker should be one of CompileOptimized / CompileOptimizedConcurrent.
// InOptimizationQueue and None shouldn't reach here.
......
......@@ -1653,9 +1653,9 @@ enum class OptimizationMarker : int32_t {
// some processing needs to be done.
kNone = 0b00,
kInOptimizationQueue = 0b01,
kCompileOptimized = 0b10,
kCompileOptimizedConcurrent = 0b11,
kLastOptimizationMarker = kCompileOptimizedConcurrent,
kCompileTurbofan_NotConcurrent = 0b10,
kCompileTurbofan_Concurrent = 0b11,
kLastOptimizationMarker = kCompileTurbofan_Concurrent,
};
// For kNone or kInOptimizationQueue we don't need any special processing.
// To check both cases using a single mask, we expect the kNone to be 0 and
......@@ -1671,20 +1671,15 @@ inline bool IsInOptimizationQueueMarker(OptimizationMarker marker) {
return marker == OptimizationMarker::kInOptimizationQueue;
}
inline bool IsCompileOptimizedMarker(OptimizationMarker marker) {
return marker == OptimizationMarker::kCompileOptimized ||
marker == OptimizationMarker::kCompileOptimizedConcurrent;
}
inline std::ostream& operator<<(std::ostream& os,
const OptimizationMarker& marker) {
switch (marker) {
case OptimizationMarker::kNone:
return os << "OptimizationMarker::kNone";
case OptimizationMarker::kCompileOptimized:
return os << "OptimizationMarker::kCompileOptimized";
case OptimizationMarker::kCompileOptimizedConcurrent:
return os << "OptimizationMarker::kCompileOptimizedConcurrent";
case OptimizationMarker::kCompileTurbofan_NotConcurrent:
return os << "OptimizationMarker::kCompileTurbofan_NotConcurrent";
case OptimizationMarker::kCompileTurbofan_Concurrent:
return os << "OptimizationMarker::kCompileTurbofan_Concurrent";
case OptimizationMarker::kInOptimizationQueue:
return os << "OptimizationMarker::kInOptimizationQueue";
}
......
......@@ -57,14 +57,15 @@ bool JSFunction::ChecksOptimizationMarker() {
}
bool JSFunction::IsMarkedForOptimization() {
return has_feedback_vector() && feedback_vector().optimization_marker() ==
OptimizationMarker::kCompileOptimized;
return has_feedback_vector() &&
feedback_vector().optimization_marker() ==
OptimizationMarker::kCompileTurbofan_NotConcurrent;
}
bool JSFunction::IsMarkedForConcurrentOptimization() {
return has_feedback_vector() &&
feedback_vector().optimization_marker() ==
OptimizationMarker::kCompileOptimizedConcurrent;
OptimizationMarker::kCompileTurbofan_Concurrent;
}
void JSFunction::SetInterruptBudget() {
......@@ -110,9 +111,10 @@ void JSFunction::MarkForOptimization(ConcurrencyMode mode) {
}
}
SetOptimizationMarker(mode == ConcurrencyMode::kConcurrent
? OptimizationMarker::kCompileOptimizedConcurrent
: OptimizationMarker::kCompileOptimized);
SetOptimizationMarker(
mode == ConcurrencyMode::kConcurrent
? OptimizationMarker::kCompileTurbofan_Concurrent
: OptimizationMarker::kCompileTurbofan_NotConcurrent);
}
bool JSFunction::IsInOptimizationQueue() {
......
......@@ -29,8 +29,8 @@ namespace internal {
namespace {
Object CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
ConcurrencyMode mode) {
Object CompileTurbofan(Isolate* isolate, Handle<JSFunction> function,
ConcurrencyMode mode) {
StackLimitCheck check(isolate);
// Concurrent optimization runs on another thread, thus no additional gap.
const int stack_gap = mode == ConcurrencyMode::kConcurrent
......@@ -92,18 +92,18 @@ RUNTIME_FUNCTION(Runtime_InstallBaselineCode) {
return baseline_code;
}
RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) {
RUNTIME_FUNCTION(Runtime_CompileTurbofan_Concurrent) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
return CompileOptimized(isolate, function, ConcurrencyMode::kConcurrent);
return CompileTurbofan(isolate, function, ConcurrencyMode::kConcurrent);
}
RUNTIME_FUNCTION(Runtime_CompileOptimized_NotConcurrent) {
RUNTIME_FUNCTION(Runtime_CompileTurbofan_NotConcurrent) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
return CompileOptimized(isolate, function, ConcurrencyMode::kNotConcurrent);
return CompileTurbofan(isolate, function, ConcurrencyMode::kNotConcurrent);
}
RUNTIME_FUNCTION(Runtime_HealOptimizedCodeSlot) {
......@@ -342,7 +342,8 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
function->PrintName(scope.file());
PrintF(scope.file(), " for non-concurrent optimization]\n");
}
function->SetOptimizationMarker(OptimizationMarker::kCompileOptimized);
function->SetOptimizationMarker(
OptimizationMarker::kCompileTurbofan_NotConcurrent);
}
return *result;
}
......
......@@ -107,8 +107,8 @@ namespace internal {
F(CompileForOnStackReplacement, 0, 1) \
F(CompileLazy, 1, 1) \
F(CompileBaseline, 1, 1) \
F(CompileOptimized_Concurrent, 1, 1) \
F(CompileOptimized_NotConcurrent, 1, 1) \
F(CompileTurbofan_Concurrent, 1, 1) \
F(CompileTurbofan_NotConcurrent, 1, 1) \
F(InstallBaselineCode, 1, 1) \
F(HealOptimizedCodeSlot, 1, 1) \
F(InstantiateAsmJs, 4, 1) \
......
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