Commit f4d5e8a3 authored by Milad Fa's avatar Milad Fa Committed by Commit Bot

PPC/s390: [turboprop] Fix IET to check optimization marker before optimized code

Port 808a5d76

Original Commit Message:

    InterpreterEntryTrampoline checks
    1. If there is any optimization marker, and process the marker by
    calling the correct runtime function
    2. If there is any optimized code, it installs optimized code and starts
    executing optimized code.

    Earlier it was OK to do these two checks in any order, since it wasn't
    possible that we have both a marker and optimized code. Turboprop code
    calls out to IET to process the optimization marker / install next tier
    optimized code. So we have to check for optimization marker before we
    check for optimized code.

R=mythria@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: I37f470809e244f675862e109ae609170a2b019f0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2513792Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#70925}
parent f9bbde86
......@@ -930,12 +930,11 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
// Marker should be one of LogFirstExecution / CompileOptimized /
// CompileOptimizedConcurrent. InOptimizationQueue and None shouldn't reach
// here.
if (FLAG_debug_code) {
__ cmpi(optimization_marker,
Operand(OptimizationMarker::kInOptimizationQueue));
__ Assert(eq, AbortReason::kExpectedOptimizationSentinel);
__ stop();
}
}
......@@ -1081,9 +1080,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Check if the optimized code slot is not empty or has a optimization marker.
Label has_optimized_code_or_marker;
__ cmpi(optimization_state,
Operand(FeedbackVector::kHasNoOptimizedCodeOrMarkerValue));
__ bne(&has_optimized_code_or_marker);
__ TestBitMask(optimization_state,
FeedbackVector::kHasOptimizedCodeOrCompileOptimizedMarkerMask,
r0);
__ bne(&has_optimized_code_or_marker, cr0);
Label not_optimized;
__ bind(&not_optimized);
......@@ -1247,8 +1247,9 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Check if optimized code is available
__ TestBitMask(optimization_state,
FeedbackVector::OptimizationTierBits::kMask, r0);
__ bne(&maybe_has_optimized_code, cr0);
FeedbackVector::kHasCompileOptimizedOrLogFirstExecutionMarker,
r0);
__ beq(&maybe_has_optimized_code, cr0);
Register optimization_marker = optimization_state;
__ DecodeField<FeedbackVector::OptimizationMarkerBits>(optimization_marker);
......
......@@ -987,12 +987,11 @@ static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
OptimizationMarker::kCompileOptimizedConcurrent,
Runtime::kCompileOptimized_Concurrent);
// Otherwise, the marker is InOptimizationQueue, so fall through hoping
// that an interrupt will eventually update the slot with optimized code.
// Marker should be one of LogFirstExecution / CompileOptimized /
// CompileOptimizedConcurrent. InOptimizationQueue and None shouldn't reach
// here.
if (FLAG_debug_code) {
__ CmpP(optimization_marker,
Operand(OptimizationMarker::kInOptimizationQueue));
__ Assert(eq, AbortReason::kExpectedOptimizationSentinel);
__ stop();
}
}
......@@ -1138,8 +1137,9 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Check if the optimized code slot is not empty or has a optimization marker.
Label has_optimized_code_or_marker;
__ CmpP(optimization_state,
Operand(FeedbackVector::kHasNoOptimizedCodeOrMarkerValue));
__ TestBitMask(optimization_state,
FeedbackVector::kHasOptimizedCodeOrCompileOptimizedMarkerMask,
r0);
__ bne(&has_optimized_code_or_marker);
Label not_optimized;
......@@ -1301,8 +1301,9 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Check if optimized code is available
__ TestBitMask(optimization_state,
FeedbackVector::OptimizationTierBits::kMask, r0);
__ bne(&maybe_has_optimized_code);
FeedbackVector::kHasCompileOptimizedOrLogFirstExecutionMarker,
r0);
__ beq(&maybe_has_optimized_code);
Register optimization_marker = optimization_state;
__ DecodeField<FeedbackVector::OptimizationMarkerBits>(optimization_marker);
......
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