Files
sdk/runtime/vm/bit_vector_test.cc
T
fschneider@google.com ee4a0fd042 First step to SSA construction: Phi insertion.
This CL contains the phi insertion step of the SSA construction algorithmus: The phi instructions inserted are not functional yet. Renaming is not included yet.


I based it on Kevin's CL (http://codereview.chromium.org/10388161/), rebased and fixed a bug (added missing iterator.Advance()) there.

It also reintroduces the Definition IL class because Phi-instructions are also
definitions that are referenced by UseVal.

I also added the set of immediately dominated blocks to each basic block.
This will be needed for pre-order dominator-tree traversal in the renaming pass.
Review URL: https://chromiumcodereview.appspot.com//10539108

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8604 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 13:36:04 +00:00

58 lines
1.5 KiB
C++

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "platform/assert.h"
#include "vm/bit_vector.h"
#include "vm/unit_test.h"
namespace dart {
TEST_CASE(BitVector) {
{ BitVector* v = new BitVector(15);
v->Add(1);
EXPECT_EQ(true, v->Contains(1));
EXPECT_EQ(false, v->Contains(0));
{ BitVector::Iterator iter(v);
EXPECT_EQ(1, iter.Current());
iter.Advance();
EXPECT(iter.Done());
}
v->Add(0);
v->Add(1);
EXPECT_EQ(true, v->Contains(0));
EXPECT_EQ(true, v->Contains(1));
{ BitVector::Iterator iter(v);
EXPECT_EQ(0, iter.Current());
iter.Advance();
EXPECT_EQ(1, iter.Current());
iter.Advance();
EXPECT(iter.Done());
}
}
{ BitVector* v = new BitVector(128);
v->Add(49);
v->Add(62);
v->Add(63);
v->Add(65);
EXPECT_EQ(true, v->Contains(49));
EXPECT_EQ(true, v->Contains(62));
EXPECT_EQ(true, v->Contains(63));
EXPECT_EQ(true, v->Contains(65));
EXPECT_EQ(false, v->Contains(64));
BitVector::Iterator iter(v);
EXPECT_EQ(49, iter.Current());
iter.Advance();
EXPECT_EQ(62, iter.Current());
iter.Advance();
EXPECT_EQ(63, iter.Current());
iter.Advance();
EXPECT_EQ(65, iter.Current());
iter.Advance();
EXPECT(iter.Done());
}
}
} // namespace dart