Index: runtime/vm/code_descriptors_test.cc |
diff --git a/runtime/vm/code_descriptors_test.cc b/runtime/vm/code_descriptors_test.cc |
index 5c5e860109150ab4e4c704ac437e2d2bb3f1dc13..9361cb43ad46f402e4e476a46f5e03262110a56b 100644 |
--- a/runtime/vm/code_descriptors_test.cc |
+++ b/runtime/vm/code_descriptors_test.cc |
@@ -192,8 +192,8 @@ TEST_CASE(StackmapGC) { |
EXPECT(CompilerTest::TestCompileFunction(function_foo)); |
EXPECT(function_foo.HasCode()); |
- // Build and setup a stackmap for function 'A.foo' in order to test the |
- // traversal of stack maps when a GC happens. |
+ // Build and setup a stackmap for the call to 'func' in 'A.foo' in order |
+ // to test the traversal of stack maps when a GC happens. |
StackmapBuilder* builder = new StackmapBuilder(); |
EXPECT(builder != NULL); |
builder->SetSlotAsValue(0); // var i. |
@@ -201,15 +201,22 @@ TEST_CASE(StackmapGC) { |
builder->SetSlotAsValue(2); // var k. |
builder->SetSlotAsObject(3); // var s2. |
builder->SetSlotAsObject(4); // var s3. |
+ builder->SetSlotAsObject(5); // First argument to func(i, k). |
+ builder->SetSlotAsObject(6); // Second argument to func(i, k). |
const Code& code = Code::Handle(function_foo.unoptimized_code()); |
// Search for the pc of the call to 'func'. |
const PcDescriptors& descriptors = |
PcDescriptors::Handle(code.pc_descriptors()); |
+ int call_count = 0; |
for (int i = 0; i < descriptors.Length(); ++i) { |
if (descriptors.DescriptorKind(i) == PcDescriptors::kFuncCall) { |
builder->AddEntry(descriptors.PC(i) - code.EntryPoint()); |
+ ++call_count; |
} |
} |
+ // We can't easily check that we put the stackmap at the correct pc, but |
+ // we did if there was exactly one call seen. |
+ EXPECT(call_count == 1); |
const Array& stack_maps = Array::Handle(builder->FinalizeStackmaps(code)); |
code.set_stackmaps(stack_maps); |