Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Unified Diff: runtime/vm/code_descriptors_test.cc

Issue 10835034: Fix an off-by-one error in the stack frame iteration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/stack_frame.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/stack_frame.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698