Skip to content

Commit 80805ff

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[VM] Make FlowGraphCompiler::EmitTestAndCallCheckCid static and therefore usable from stubs
Issue #31798 Change-Id: I375cc01bf59d848a203dbcdbd59377d55e9aafe4 Reviewed-on: https://dart-review.googlesource.com/44540 Commit-Queue: Martin Kustermann <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]>
1 parent 9cfd721 commit 80805ff

6 files changed

+34
-13
lines changed

runtime/vm/compiler/backend/flow_graph_compiler.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,8 @@ void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets,
18311831
}
18321832
Label next_test;
18331833
if (!complete || !is_last_check) {
1834-
bias = EmitTestAndCallCheckCid(is_last_check ? failed : &next_test,
1834+
bias = EmitTestAndCallCheckCid(assembler(),
1835+
is_last_check ? failed : &next_test,
18351836
EmitTestCidRegister(), targets[i], bias,
18361837
/*jump_on_miss =*/true);
18371838
}
@@ -1871,7 +1872,8 @@ bool FlowGraphCompiler::GenerateSubclassTypeCheck(Register class_id_reg,
18711872
for (intptr_t i = 0; i < ranges.length(); ++i) {
18721873
const CidRange& range = ranges[i];
18731874
if (!range.IsIllegalRange()) {
1874-
bias = EmitTestAndCallCheckCid(is_subtype, class_id_reg, range, bias,
1875+
bias = EmitTestAndCallCheckCid(assembler(), is_subtype, class_id_reg,
1876+
range, bias,
18751877
/*jump_on_miss=*/false);
18761878
}
18771879
}

runtime/vm/compiler/backend/flow_graph_compiler.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,16 @@ class FlowGraphCompiler : public ValueObject {
622622
void RecordAfterCall(Instruction* instr, CallResult result);
623623
#endif
624624

625+
// Returns new class-id bias.
626+
//
627+
// TODO(kustermann): We should move this code out of the [FlowGraphCompiler]!
628+
static int EmitTestAndCallCheckCid(Assembler* assembler,
629+
Label* label,
630+
Register class_id_reg,
631+
const CidRange& range,
632+
int bias,
633+
bool jump_on_miss = true);
634+
625635
private:
626636
friend class CheckStackOverflowSlowPath; // For pending_deoptimization_env_.
627637
friend class CheckedSmiSlowPath; // Same.
@@ -668,13 +678,6 @@ class FlowGraphCompiler : public ValueObject {
668678

669679
void EmitTestAndCallLoadCid(Register class_id_reg);
670680

671-
// Returns new class-id bias.
672-
int EmitTestAndCallCheckCid(Label* label,
673-
Register class_id_reg,
674-
const CidRange& range,
675-
int bias,
676-
bool jump_on_miss = true);
677-
678681
// DBC handles type tests differently from all other architectures due
679682
// to its interpreted nature.
680683
#if !defined(TARGET_ARCH_DBC)

runtime/vm/compiler/backend/flow_graph_compiler_arm.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,11 @@ void FlowGraphCompiler::EmitTestAndCallLoadCid(Register class_id_reg) {
11821182
__ LoadClassId(class_id_reg, R0);
11831183
}
11841184

1185-
int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* label,
1185+
#undef __
1186+
#define __ assembler->
1187+
1188+
int FlowGraphCompiler::EmitTestAndCallCheckCid(Assembler* assembler,
1189+
Label* label,
11861190
Register class_id_reg,
11871191
const CidRange& range,
11881192
int bias,

runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,11 @@ void FlowGraphCompiler::EmitTestAndCallLoadCid(Register class_id_reg) {
11371137
__ LoadClassId(class_id_reg, R0);
11381138
}
11391139

1140-
int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* label,
1140+
#undef __
1141+
#define __ assembler->
1142+
1143+
int FlowGraphCompiler::EmitTestAndCallCheckCid(Assembler* assembler,
1144+
Label* label,
11411145
Register class_id_reg,
11421146
const CidRange& range,
11431147
int bias,

runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,11 @@ void FlowGraphCompiler::EmitTestAndCallLoadCid(Register class_id_reg) {
11231123
__ LoadClassId(class_id_reg, EAX);
11241124
}
11251125

1126-
int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* label,
1126+
#undef __
1127+
#define __ assembler->
1128+
1129+
int FlowGraphCompiler::EmitTestAndCallCheckCid(Assembler* assembler,
1130+
Label* label,
11271131
Register class_id_reg,
11281132
const CidRange& range,
11291133
int bias,

runtime/vm/compiler/backend/flow_graph_compiler_x64.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,11 @@ void FlowGraphCompiler::EmitTestAndCallLoadCid(Register class_id_reg) {
10991099
__ LoadClassId(class_id_reg, RAX);
11001100
}
11011101

1102-
int FlowGraphCompiler::EmitTestAndCallCheckCid(Label* label,
1102+
#undef __
1103+
#define __ assembler->
1104+
1105+
int FlowGraphCompiler::EmitTestAndCallCheckCid(Assembler* assembler,
1106+
Label* label,
11031107
Register class_id_reg,
11041108
const CidRange& range,
11051109
int bias,

0 commit comments

Comments
 (0)