Revision: 3896
Author: [email protected]
Date: Thu Feb 18 04:47:17 2010
Log: Kill some unused code.

It doesn't mean I'm participating in some fixit, just spotted some
code which doesn't have usages and decided to remove it.

Review URL: http://codereview.chromium.org/646007
http://code.google.com/p/v8/source/detail?r=3896

Modified:
 /branches/bleeding_edge/src/log-utils.cc
 /branches/bleeding_edge/src/log-utils.h
 /branches/bleeding_edge/src/log.cc
 /branches/bleeding_edge/src/log.h
 /branches/bleeding_edge/src/utils.cc
 /branches/bleeding_edge/src/utils.h
 /branches/bleeding_edge/test/cctest/test-utils.cc

=======================================
--- /branches/bleeding_edge/src/log-utils.cc    Wed Nov 11 01:50:06 2009
+++ /branches/bleeding_edge/src/log-utils.cc    Thu Feb 18 04:47:17 2010
@@ -349,15 +349,6 @@
     write_failure_handler();
   }
 }
-
-
-void LogMessageBuilder::WriteCStringToLogFile(const char* str) {
-  const int len = StrLength(str);
-  const int written = Log::Write(str, len);
-  if (written != len && write_failure_handler != NULL) {
-    write_failure_handler();
-  }
-}


 // Formatting string for back references to the whole line. E.g. "#2" means
=======================================
--- /branches/bleeding_edge/src/log-utils.h     Wed Nov 11 01:50:06 2009
+++ /branches/bleeding_edge/src/log-utils.h     Thu Feb 18 04:47:17 2010
@@ -268,9 +268,6 @@
   // Write the log message to the log file currently opened.
   void WriteToLogFile();

-  // Write a null-terminated string to to the log file currently opened.
-  void WriteCStringToLogFile(const char* str);
-
   // A handler that is called when Log::Write fails.
   typedef void (*WriteFailureHandler)();

=======================================
--- /branches/bleeding_edge/src/log.cc  Wed Feb 17 05:23:46 2010
+++ /branches/bleeding_edge/src/log.cc  Thu Feb 18 04:47:17 2010
@@ -370,15 +370,6 @@
 #endif  // ENABLE_LOGGING_AND_PROFILING


-void Logger::Preamble(const char* content) {
-#ifdef ENABLE_LOGGING_AND_PROFILING
-  if (!Log::IsEnabled() || !FLAG_log_code) return;
-  LogMessageBuilder msg;
-  msg.WriteCStringToLogFile(content);
-#endif
-}
-
-
 void Logger::StringEvent(const char* name, const char* value) {
 #ifdef ENABLE_LOGGING_AND_PROFILING
   if (FLAG_log) UncheckedStringEvent(name, value);
=======================================
--- /branches/bleeding_edge/src/log.h   Wed Feb 17 05:23:46 2010
+++ /branches/bleeding_edge/src/log.h   Thu Feb 18 04:47:17 2010
@@ -161,12 +161,6 @@
   // Enable the computation of a sliding window of states.
   static void EnableSlidingStateWindow();

-  // Write a raw string to the log to be used as a preamble.
-  // No check is made that the 'preamble' is actually at the beginning
-  // of the log. The preample is used to write code events saved in the
-  // snapshot.
-  static void Preamble(const char* content);
-
   // Emits an event with a string value -> (name, value).
   static void StringEvent(const char* name, const char* value);

=======================================
--- /branches/bleeding_edge/src/utils.cc        Thu Jan  7 05:17:18 2010
+++ /branches/bleeding_edge/src/utils.cc        Thu Feb 18 04:47:17 2010
@@ -49,43 +49,6 @@
   x = x | (x >> 16);
   return x + 1;
 }
-
-
-byte* EncodeInt(byte* p, int x) {
-  while (x < -64 || x >= 64) {
-    *p++ = static_cast<byte>(x & 127);
-    x = ArithmeticShiftRight(x, 7);
-  }
-  // -64 <= x && x < 64
-  *p++ = static_cast<byte>(x + 192);
-  return p;
-}
-
-
-byte* DecodeInt(byte* p, int* x) {
-  int r = 0;
-  unsigned int s = 0;
-  byte b = *p++;
-  while (b < 128) {
-    r |= static_cast<int>(b) << s;
-    s += 7;
-    b = *p++;
-  }
-  // b >= 128
-  *x = r | ((static_cast<int>(b) - 192) << s);
-  return p;
-}
-
-
-byte* EncodeUnsignedIntBackward(byte* p, unsigned int x) {
-  while (x >= 128) {
-    *--p = static_cast<byte>(x & 127);
-    x = x >> 7;
-  }
-  // x < 128
-  *--p = static_cast<byte>(x + 128);
-  return p;
-}


 // Thomas Wang, Integer Hash Functions.
=======================================
--- /branches/bleeding_edge/src/utils.h Tue Nov 24 06:10:06 2009
+++ /branches/bleeding_edge/src/utils.h Thu Feb 18 04:47:17 2010
@@ -171,48 +171,6 @@
     return static_cast<T>((value >> shift) & ((1U << (size)) - 1));
   }
 };
-
-
-// ----------------------------------------------------------------------------
-// Support for compressed, machine-independent encoding
-// and decoding of integer values of arbitrary size.
-
-// Encoding and decoding from/to a buffer at position p;
-// the result is the position after the encoded integer.
-// Small signed integers in the range -64 <= x && x < 64
-// are encoded in 1 byte; larger values are encoded in 2
-// or more bytes. At most sizeof(int) + 1 bytes are used
-// in the worst case.
-byte* EncodeInt(byte* p, int x);
-byte* DecodeInt(byte* p, int* x);
-
-
-// Encoding and decoding from/to a buffer at position p - 1
-// moving backward; the result is the position of the last
-// byte written. These routines are useful to read/write
-// into a buffer starting at the end of the buffer.
-byte* EncodeUnsignedIntBackward(byte* p, unsigned int x);
-
-// The decoding function is inlined since its performance is
-// important to mark-sweep garbage collection.
-inline byte* DecodeUnsignedIntBackward(byte* p, unsigned int* x) {
-  byte b = *--p;
-  if (b >= 128) {
-    *x = static_cast<unsigned int>(b) - 128;
-    return p;
-  }
-  unsigned int r = static_cast<unsigned int>(b);
-  unsigned int s = 7;
-  b = *--p;
-  while (b < 128) {
-    r |= static_cast<unsigned int>(b) << s;
-    s += 7;
-    b = *--p;
-  }
-  // b >= 128
-  *x = r | ((static_cast<unsigned int>(b) - 128) << s);
-  return p;
-}


// ----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/test/cctest/test-utils.cc Wed Nov 11 01:50:06 2009 +++ /branches/bleeding_edge/test/cctest/test-utils.cc Thu Feb 18 04:47:17 2010
@@ -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));

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to