[sparkplug] Fix external code space after BaselineData removal

Fixed: v8:12192
Change-Id: Ifcb006bd1746e7bcf3b16c0e31e8cda9c920483c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3147590
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76722}
This commit is contained in:
Leszek Swirski 2021-09-08 10:49:37 +02:00 committed by V8 LUCI CQ
parent 017c12b3c5
commit ec987bd148
3 changed files with 38 additions and 15 deletions

View File

@ -430,9 +430,8 @@ void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) {
__ Unreachable();
}
static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
Register scratch) {
DCHECK(!AreAliased(code, scratch));
static void AssertCodeIsBaselineAllowClobber(MacroAssembler* masm,
Register code, Register scratch) {
// Verify that the code kind is baseline code via the CodeKind.
__ Ldr(scratch, FieldMemOperand(code, Code::kFlagsOffset));
__ DecodeField<Code::KindField>(scratch);
@ -440,6 +439,12 @@ static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
__ Assert(eq, AbortReason::kExpectedBaselineData);
}
static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
Register scratch) {
DCHECK(!AreAliased(code, scratch));
return AssertCodeIsBaselineAllowClobber(masm, code, scratch);
}
// TODO(v8:11429): Add a path for "not_compiled" and unify the two uses under
// the more general dispatch.
static void GetSharedFunctionInfoBytecodeOrBaseline(MacroAssembler* masm,
@ -452,7 +457,12 @@ static void GetSharedFunctionInfoBytecodeOrBaseline(MacroAssembler* masm,
if (FLAG_debug_code) {
Label not_baseline;
__ B(ne, &not_baseline);
AssertCodeIsBaseline(masm, sfi_data, scratch1);
if (V8_EXTERNAL_CODE_SPACE_BOOL) {
__ LoadCodeDataContainerCodeNonBuiltin(scratch1, sfi_data);
AssertCodeIsBaselineAllowClobber(masm, scratch1, scratch1);
} else {
AssertCodeIsBaseline(masm, sfi_data, scratch1);
}
__ B(eq, is_baseline);
__ Bind(&not_baseline);
} else {

View File

@ -682,9 +682,8 @@ void Builtins::Generate_RunMicrotasksTrampoline(MacroAssembler* masm) {
__ Jump(BUILTIN_CODE(masm->isolate(), RunMicrotasks), RelocInfo::CODE_TARGET);
}
static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
Register scratch) {
DCHECK(!AreAliased(code, scratch));
static void AssertCodeIsBaselineAllowClobber(MacroAssembler* masm,
Register code, Register scratch) {
// Verify that the code kind is baseline code via the CodeKind.
__ movl(scratch, FieldOperand(code, Code::kFlagsOffset));
__ DecodeField<Code::KindField>(scratch);
@ -692,6 +691,12 @@ static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
__ Assert(equal, AbortReason::kExpectedBaselineData);
}
static void AssertCodeIsBaseline(MacroAssembler* masm, Register code,
Register scratch) {
DCHECK(!AreAliased(code, scratch));
return AssertCodeIsBaselineAllowClobber(masm, code, scratch);
}
static void GetSharedFunctionInfoBytecodeOrBaseline(MacroAssembler* masm,
Register sfi_data,
Register scratch1,
@ -704,7 +709,12 @@ static void GetSharedFunctionInfoBytecodeOrBaseline(MacroAssembler* masm,
if (FLAG_debug_code) {
Label not_baseline;
__ j(not_equal, &not_baseline);
AssertCodeIsBaseline(masm, sfi_data, scratch1);
if (V8_EXTERNAL_CODE_SPACE_BOOL) {
__ LoadCodeDataContainerCodeNonBuiltin(scratch1, sfi_data);
AssertCodeIsBaselineAllowClobber(masm, scratch1, scratch1);
} else {
AssertCodeIsBaseline(masm, sfi_data, scratch1);
}
__ j(equal, is_baseline);
__ bind(&not_baseline);
} else {

View File

@ -2927,13 +2927,16 @@ TNode<BytecodeArray> CodeStubAssembler::LoadSharedFunctionInfoBytecodeArray(
GotoIfNot(HasInstanceType(var_result.value(), CODET_TYPE),
&check_for_interpreter_data);
CSA_ASSERT(this,
Word32Equal(DecodeWord32<Code::KindField>(LoadObjectField<Int32T>(
var_result.value(), Code::kFlagsOffset)),
Int32Constant(static_cast<int>(CodeKind::BASELINE))));
TNode<HeapObject> baseline_data = LoadObjectField<HeapObject>(
var_result.value(), Code::kDeoptimizationDataOrInterpreterDataOffset);
var_result = baseline_data;
{
TNode<Code> code = FromCodeT(CAST(var_result.value()));
CSA_ASSERT(
this, Word32Equal(DecodeWord32<Code::KindField>(LoadObjectField<Int32T>(
code, Code::kFlagsOffset)),
Int32Constant(static_cast<int>(CodeKind::BASELINE))));
TNode<HeapObject> baseline_data = LoadObjectField<HeapObject>(
code, Code::kDeoptimizationDataOrInterpreterDataOffset);
var_result = baseline_data;
}
Goto(&check_for_interpreter_data);
BIND(&check_for_interpreter_data);