Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 73e6f09

Browse files
author
Dart CI
committed
Version 2.12.0-85.0.dev
Merge commit 'a2acd59d739fb79dbfe7634bd85cf44a841599e0' into 'dev'
2 parents cc0bdc5 + a2acd59 commit 73e6f09

16 files changed

+194
-218
lines changed

runtime/vm/compiler/asm_intrinsifier_arm.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@ intptr_t AsmIntrinsifier::ParameterSlotFromSp() {
2828
return -1;
2929
}
3030

31-
static bool IsABIPreservedRegister(Register reg) {
32-
return ((1 << reg) & kAbiPreservedCpuRegs) != 0;
33-
}
34-
3531
void AsmIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) {
36-
ASSERT(IsABIPreservedRegister(CODE_REG));
37-
ASSERT(IsABIPreservedRegister(ARGS_DESC_REG));
38-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP));
32+
COMPILE_ASSERT(IsAbiPreservedRegister(CODE_REG));
33+
COMPILE_ASSERT(IsAbiPreservedRegister(ARGS_DESC_REG));
34+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP));
3935

4036
// Save LR by moving it to a callee saved temporary register.
4137
assembler->Comment("IntrinsicCallPrologue");

runtime/vm/compiler/asm_intrinsifier_arm64.cc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,15 @@ intptr_t AsmIntrinsifier::ParameterSlotFromSp() {
2828
return -1;
2929
}
3030

31-
static bool IsABIPreservedRegister(Register reg) {
32-
return ((1 << reg) & kAbiPreservedCpuRegs) != 0;
33-
}
34-
3531
void AsmIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) {
36-
ASSERT(IsABIPreservedRegister(CODE_REG));
37-
ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG));
38-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP));
39-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP2));
40-
ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
41-
ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
42-
ASSERT(CALLEE_SAVED_TEMP2 != CODE_REG);
43-
ASSERT(CALLEE_SAVED_TEMP2 != ARGS_DESC_REG);
32+
COMPILE_ASSERT(IsAbiPreservedRegister(CODE_REG));
33+
COMPILE_ASSERT(!IsAbiPreservedRegister(ARGS_DESC_REG));
34+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP));
35+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP2));
36+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
37+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
38+
COMPILE_ASSERT(CALLEE_SAVED_TEMP2 != CODE_REG);
39+
COMPILE_ASSERT(CALLEE_SAVED_TEMP2 != ARGS_DESC_REG);
4440

4541
assembler->Comment("IntrinsicCallPrologue");
4642
assembler->mov(CALLEE_SAVED_TEMP, LR);

runtime/vm/compiler/asm_intrinsifier_x64.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@ intptr_t AsmIntrinsifier::ParameterSlotFromSp() {
2828
return 0;
2929
}
3030

31-
static bool IsABIPreservedRegister(Register reg) {
32-
return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 0;
33-
}
34-
3531
void AsmIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) {
36-
ASSERT(IsABIPreservedRegister(CODE_REG));
37-
ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG));
38-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP));
39-
ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
40-
ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
32+
COMPILE_ASSERT(IsAbiPreservedRegister(CODE_REG));
33+
COMPILE_ASSERT(!IsAbiPreservedRegister(ARGS_DESC_REG));
34+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP));
35+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
36+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
4137

4238
assembler->Comment("IntrinsicCallPrologue");
4339
assembler->movq(CALLEE_SAVED_TEMP, ARGS_DESC_REG);

runtime/vm/compiler/graph_intrinsifier_arm.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ intptr_t GraphIntrinsifier::ParameterSlotFromSp() {
1717
return -1;
1818
}
1919

20-
static bool IsABIPreservedRegister(Register reg) {
21-
return ((1 << reg) & kAbiPreservedCpuRegs) != 0;
22-
}
23-
2420
void GraphIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) {
25-
ASSERT(IsABIPreservedRegister(CODE_REG));
26-
ASSERT(IsABIPreservedRegister(ARGS_DESC_REG));
27-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP));
21+
COMPILE_ASSERT(IsAbiPreservedRegister(CODE_REG));
22+
COMPILE_ASSERT(IsAbiPreservedRegister(ARGS_DESC_REG));
23+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP));
2824

2925
// Save LR by moving it to a callee saved temporary register.
3026
assembler->Comment("IntrinsicCallPrologue");

runtime/vm/compiler/graph_intrinsifier_arm64.cc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,15 @@ intptr_t GraphIntrinsifier::ParameterSlotFromSp() {
1717
return -1;
1818
}
1919

20-
static bool IsABIPreservedRegister(Register reg) {
21-
return ((1 << reg) & kAbiPreservedCpuRegs) != 0;
22-
}
23-
2420
void GraphIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) {
25-
ASSERT(IsABIPreservedRegister(CODE_REG));
26-
ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG));
27-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP));
28-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP2));
29-
ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
30-
ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
31-
ASSERT(CALLEE_SAVED_TEMP2 != CODE_REG);
32-
ASSERT(CALLEE_SAVED_TEMP2 != ARGS_DESC_REG);
21+
COMPILE_ASSERT(IsAbiPreservedRegister(CODE_REG));
22+
COMPILE_ASSERT(!IsAbiPreservedRegister(ARGS_DESC_REG));
23+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP));
24+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP2));
25+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
26+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
27+
COMPILE_ASSERT(CALLEE_SAVED_TEMP2 != CODE_REG);
28+
COMPILE_ASSERT(CALLEE_SAVED_TEMP2 != ARGS_DESC_REG);
3329

3430
assembler->Comment("IntrinsicCallPrologue");
3531
assembler->mov(CALLEE_SAVED_TEMP, LR);

runtime/vm/compiler/graph_intrinsifier_x64.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ intptr_t GraphIntrinsifier::ParameterSlotFromSp() {
1717
return 0;
1818
}
1919

20-
static bool IsABIPreservedRegister(Register reg) {
21-
return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 0;
22-
}
23-
2420
void GraphIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) {
25-
ASSERT(IsABIPreservedRegister(CODE_REG));
26-
ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG));
27-
ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP));
28-
ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
29-
ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
21+
COMPILE_ASSERT(IsAbiPreservedRegister(CODE_REG));
22+
COMPILE_ASSERT(!IsAbiPreservedRegister(ARGS_DESC_REG));
23+
COMPILE_ASSERT(IsAbiPreservedRegister(CALLEE_SAVED_TEMP));
24+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
25+
COMPILE_ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
3026

3127
assembler->Comment("IntrinsicCallPrologue");
3228
assembler->movq(CALLEE_SAVED_TEMP, ARGS_DESC_REG);

runtime/vm/compiler/stub_code_compiler_arm.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ void StubCodeCompiler::GenerateExitSafepointStub(Assembler* assembler) {
350350
// NOTFP, R4: clobbered, although normally callee-saved
351351
void StubCodeCompiler::GenerateCallNativeThroughSafepointStub(
352352
Assembler* assembler) {
353-
COMPILE_ASSERT((kAbiPreservedCpuRegs & (1 << R4)) != 0);
353+
COMPILE_ASSERT(IsAbiPreservedRegister(R4));
354354

355355
// TransitionGeneratedToNative might clobber LR if it takes the slow path.
356356
__ mov(R4, Operand(LR));
@@ -2867,10 +2867,13 @@ void StubCodeCompiler::GenerateGetCStackPointerStub(Assembler* assembler) {
28672867
//
28682868
// Notice: We need to keep this in sync with `Simulator::JumpToFrame()`.
28692869
void StubCodeCompiler::GenerateJumpToFrameStub(Assembler* assembler) {
2870-
ASSERT(kExceptionObjectReg == R0);
2871-
ASSERT(kStackTraceObjectReg == R1);
2870+
COMPILE_ASSERT(kExceptionObjectReg == R0);
2871+
COMPILE_ASSERT(kStackTraceObjectReg == R1);
2872+
COMPILE_ASSERT(IsAbiPreservedRegister(R4));
2873+
COMPILE_ASSERT(IsAbiPreservedRegister(THR));
28722874
__ mov(IP, Operand(R1)); // Copy Stack pointer into IP.
2873-
__ mov(LR, Operand(R0)); // Program counter.
2875+
// TransitionGeneratedToNative might clobber LR if it takes the slow path.
2876+
__ mov(R4, Operand(R0)); // Program counter.
28742877
__ mov(THR, Operand(R3)); // Thread.
28752878
__ mov(FP, Operand(R2)); // Frame_pointer.
28762879
__ mov(SP, Operand(IP)); // Set Stack pointer.
@@ -2903,7 +2906,7 @@ void StubCodeCompiler::GenerateJumpToFrameStub(Assembler* assembler) {
29032906
} else {
29042907
__ LoadPoolPointer();
29052908
}
2906-
__ bx(LR); // Jump to continuation point.
2909+
__ bx(R4); // Jump to continuation point.
29072910
}
29082911

29092912
// Run an exception handler. Execution comes from JumpToFrame

runtime/vm/compiler/stub_code_compiler_arm64.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void StubCodeCompiler::GenerateExitSafepointStub(Assembler* assembler) {
300300
// Stack: preserved, CSP == SP
301301
void StubCodeCompiler::GenerateCallNativeThroughSafepointStub(
302302
Assembler* assembler) {
303-
COMPILE_ASSERT((1 << R19) & kAbiPreservedCpuRegs);
303+
COMPILE_ASSERT(IsAbiPreservedRegister(R19));
304304

305305
__ mov(R19, LR);
306306
__ LoadImmediate(R10, target::Thread::exit_through_ffi());
@@ -3007,7 +3007,8 @@ void StubCodeCompiler::GenerateGetCStackPointerStub(Assembler* assembler) {
30073007
void StubCodeCompiler::GenerateJumpToFrameStub(Assembler* assembler) {
30083008
ASSERT(kExceptionObjectReg == R0);
30093009
ASSERT(kStackTraceObjectReg == R1);
3010-
__ mov(LR, R0); // Program counter.
3010+
// TransitionGeneratedToNative might clobber LR if it takes the slow path.
3011+
__ mov(CALLEE_SAVED_TEMP, R0); // Program counter.
30113012
__ mov(SP, R1); // Stack pointer.
30123013
__ mov(FP, R2); // Frame_pointer.
30133014
__ mov(THR, R3);
@@ -3042,7 +3043,7 @@ void StubCodeCompiler::GenerateJumpToFrameStub(Assembler* assembler) {
30423043
} else {
30433044
__ LoadPoolPointer();
30443045
}
3045-
__ ret(); // Jump to continuation point.
3046+
__ ret(CALLEE_SAVED_TEMP); // Jump to continuation point.
30463047
}
30473048

30483049
// Run an exception handler. Execution comes from JumpToFrame

runtime/vm/constants.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ static constexpr bool IsCalleeSavedRegister(Register reg) {
5353
return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 0;
5454
}
5555

56+
#if !defined(TARGET_ARCH_IA32)
57+
constexpr bool IsAbiPreservedRegister(Register reg) {
58+
return (kAbiPreservedCpuRegs & (1 << reg)) != 0;
59+
}
60+
#endif
61+
5662
} // namespace dart
5763

5864
#endif // RUNTIME_VM_CONSTANTS_H_

runtime/vm/constants_x64.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ class CallingConventions {
457457
(kArgumentRegisters | R(kPointerToReturnStructRegisterCall))) == 0);
458458
};
459459

460+
constexpr intptr_t kAbiPreservedCpuRegs =
461+
CallingConventions::kCalleeSaveCpuRegisters;
462+
460463
#undef R
461464

462465
class Instr {

0 commit comments

Comments
 (0)