Index: test/cctest/test-utils.cc |
diff --git a/test/cctest/test-utils.cc b/test/cctest/test-utils.cc |
index 1d65e686e4b59ec91f2a12f974fcf2bf175eff41..24b3c908ad73c4321e46e36bcfd7c411b3131fdf 100644 |
--- a/test/cctest/test-utils.cc |
+++ b/test/cctest/test-utils.cc |
@@ -35,111 +35,6 @@ |
using namespace v8::internal; |
-enum Mode { |
- forward, |
- backward_unsigned |
-}; |
- |
- |
-static v8::internal::byte* Write(v8::internal::byte* p, Mode m, int x) { |
- v8::internal::byte* q = NULL; |
- switch (m) { |
- case forward: |
- q = EncodeInt(p, x); |
- CHECK(q <= p + sizeof(x) + 1); |
- break; |
- case backward_unsigned: |
- q = EncodeUnsignedIntBackward(p, x); |
- CHECK(q >= p - sizeof(x) - 1); |
- break; |
- } |
- return q; |
-} |
- |
- |
-static v8::internal::byte* Read(v8::internal::byte* p, Mode m, int x) { |
- v8::internal::byte* q = NULL; |
- int y; |
- switch (m) { |
- case forward: |
- q = DecodeInt(p, &y); |
- CHECK(q <= p + sizeof(y) + 1); |
- break; |
- case backward_unsigned: { |
- unsigned int uy; |
- q = DecodeUnsignedIntBackward(p, &uy); |
- y = uy; |
- CHECK(q >= p - sizeof(uy) - 1); |
- break; |
- } |
- } |
- CHECK(y == x); |
- return q; |
-} |
- |
- |
-static v8::internal::byte* WriteMany(v8::internal::byte* p, Mode m, int x) { |
- p = Write(p, m, x - 7); |
- p = Write(p, m, x - 1); |
- p = Write(p, m, x); |
- p = Write(p, m, x + 1); |
- p = Write(p, m, x + 2); |
- p = Write(p, m, -x - 5); |
- p = Write(p, m, -x - 1); |
- p = Write(p, m, -x); |
- p = Write(p, m, -x + 1); |
- p = Write(p, m, -x + 3); |
- |
- return p; |
-} |
- |
- |
-static v8::internal::byte* ReadMany(v8::internal::byte* p, Mode m, int x) { |
- p = Read(p, m, x - 7); |
- p = Read(p, m, x - 1); |
- p = Read(p, m, x); |
- p = Read(p, m, x + 1); |
- p = Read(p, m, x + 2); |
- p = Read(p, m, -x - 5); |
- p = Read(p, m, -x - 1); |
- p = Read(p, m, -x); |
- p = Read(p, m, -x + 1); |
- p = Read(p, m, -x + 3); |
- |
- return p; |
-} |
- |
- |
-void ProcessValues(int* values, int n, Mode m) { |
- v8::internal::byte buf[4 * KB]; // make this big enough |
- v8::internal::byte* p0 = (m == forward ? buf : buf + ARRAY_SIZE(buf)); |
- |
- v8::internal::byte* p = p0; |
- for (int i = 0; i < n; i++) { |
- p = WriteMany(p, m, values[i]); |
- } |
- |
- v8::internal::byte* q = p0; |
- for (int i = 0; i < n; i++) { |
- q = ReadMany(q, m, values[i]); |
- } |
- |
- CHECK(p == q); |
-} |
- |
- |
-TEST(Utils0) { |
- int values[] = { |
- 0, 1, 10, 16, 32, 64, 128, 256, 512, 1024, 1234, 5731, |
- 10000, 100000, 1000000, 10000000, 100000000, 1000000000 |
- }; |
- const int n = ARRAY_SIZE(values); |
- |
- ProcessValues(values, n, forward); |
- ProcessValues(values, n, backward_unsigned); |
-} |
- |
- |
TEST(Utils1) { |
CHECK_EQ(-1000000, FastD2I(-1000000.0)); |
CHECK_EQ(-1, FastD2I(-1.0)); |