Author: [EMAIL PROTECTED]
Date: Sun Nov 30 23:40:43 2008
New Revision: 871

Modified:
    branches/bleeding_edge/include/v8.h
    branches/bleeding_edge/src/counters.h
    branches/bleeding_edge/src/d8.cc
    branches/bleeding_edge/src/d8.h
    branches/bleeding_edge/src/mksnapshot.cc
    branches/bleeding_edge/src/v8-counters.cc

Log:
Commiting Evan's change to use char instead of wchar_t for counter names.

Code review URL:

   http://codereview.chromium.org/13011/show


Modified: branches/bleeding_edge/include/v8.h
==============================================================================
--- branches/bleeding_edge/include/v8.h (original)
+++ branches/bleeding_edge/include/v8.h Sun Nov 30 23:40:43 2008
@@ -1813,7 +1813,7 @@

  // --- C o u n t e r s  C a l l b a c k s ---

-typedef int* (*CounterLookupCallback)(const wchar_t* name);
+typedef int* (*CounterLookupCallback)(const char* name);

  // --- F a i l e d A c c e s s C h e c k C a l l b a c k ---
  typedef void (*FailedAccessCheckCallback)(Local<Object> target,

Modified: branches/bleeding_edge/src/counters.h
==============================================================================
--- branches/bleeding_edge/src/counters.h       (original)
+++ branches/bleeding_edge/src/counters.h       Sun Nov 30 23:40:43 2008
@@ -28,8 +28,6 @@
  #ifndef V8_COUNTERS_H_
  #define V8_COUNTERS_H_

-#include <wchar.h>
-
  namespace v8 { namespace internal {

  // StatsCounters is an interface for plugging into external
@@ -54,7 +52,7 @@
    // may receive a different location to store it's counter.
    // The return value must not be cached and re-used across
    // threads, although a single thread is free to cache it.
-  static int *FindLocation(const wchar_t* name) {
+  static int *FindLocation(const char* name) {
      if (!lookup_function_) return NULL;
      return lookup_function_(name);
    }
@@ -74,9 +72,9 @@
  //
  // This class is designed to be POD initialized.  It will be registered  
with
  // the counter system on first use.  For example:
-//   StatsCounter c = { L"c:myctr", NULL, false };
+//   StatsCounter c = { "c:myctr", NULL, false };
  struct StatsCounter {
-  const wchar_t* name_;
+  const char* name_;
    int* ptr_;
    bool lookup_done_;


Modified: branches/bleeding_edge/src/d8.cc
==============================================================================
--- branches/bleeding_edge/src/d8.cc    (original)
+++ branches/bleeding_edge/src/d8.cc    Sun Nov 30 23:40:43 2008
@@ -209,7 +209,7 @@
  }


-int* Shell::LookupCounter(const wchar_t* name) {
+int* Shell::LookupCounter(const char* name) {
    CounterMap::iterator item = counter_map_.find(name);
    if (item != counter_map_.end()) {
      Counter* result = (*item).second;

Modified: branches/bleeding_edge/src/d8.h
==============================================================================
--- branches/bleeding_edge/src/d8.h     (original)
+++ branches/bleeding_edge/src/d8.h     Sun Nov 30 23:40:43 2008
@@ -44,13 +44,13 @@

  class Counter {
   public:
-  explicit Counter(const wchar_t* name)
+  explicit Counter(const char* name)
      : name_(name), value_(0) { }
    int* GetValuePtr() { return &value_; }
-  const wchar_t* name() { return name_; }
+  const char* name() { return name_; }
    int value() { return value_; }
   private:
-  const wchar_t* name_;
+  const char* name_;
    int value_;
  };

@@ -64,7 +64,7 @@
    static void ReportException(TryCatch* try_catch);
    static void Initialize();
    static void OnExit();
-  static int* LookupCounter(const wchar_t* name);
+  static int* LookupCounter(const char* name);
    static Handle<String> ReadFile(const char* name);
    static void RunShell();
    static int Main(int argc, char* argv[]);
@@ -81,7 +81,7 @@
   private:
    static Persistent<Context> utility_context_;
    static Persistent<Context> evaluation_context_;
-  typedef std::map<const wchar_t*, Counter*> CounterMap;
+  typedef std::map<const char*, Counter*> CounterMap;
    static CounterMap counter_map_;
  };


Modified: branches/bleeding_edge/src/mksnapshot.cc
==============================================================================
--- branches/bleeding_edge/src/mksnapshot.cc    (original)
+++ branches/bleeding_edge/src/mksnapshot.cc    Sun Nov 30 23:40:43 2008
@@ -48,10 +48,10 @@
  class Counter {
   public:
    static const int kMaxNameSize = 64;
-  int32_t* Bind(const wchar_t* name) {
+  int32_t* Bind(const char* name) {
      int i;
      for (i = 0; i < kMaxNameSize - 1 && name[i]; i++) {
-      name_[i] = static_cast<char>(name[i]);
+      name_[i] = name[i];
      }
      name_[i] = '\0';
      return &counter_;
@@ -92,13 +92,13 @@
  static CounterCollection* counters = &local_counters;


-typedef std::map<std::wstring, int*> CounterMap;
-typedef std::map<std::wstring, int*>::iterator CounterMapIterator;
+typedef std::map<std::string, int*> CounterMap;
+typedef std::map<std::string, int*>::iterator CounterMapIterator;
  static CounterMap counter_table_;

  // Callback receiver when v8 has a counter to track.
-static int* counter_callback(const wchar_t* name) {
-  std::wstring counter = name;
+static int* counter_callback(const char* name) {
+  std::string counter = name;
    // See if this counter name is already known.
    if (counter_table_.find(counter) != counter_table_.end())
      return counter_table_[counter];

Modified: branches/bleeding_edge/src/v8-counters.cc
==============================================================================
--- branches/bleeding_edge/src/v8-counters.cc   (original)
+++ branches/bleeding_edge/src/v8-counters.cc   Sun Nov 30 23:40:43 2008
@@ -33,14 +33,14 @@

  #define SR(name, caption) \
    StatsRate Counters::name = { \
-  { { L"t:" L###caption, NULL, false }, 0, 0 }, \
-  { L"c:" L###caption, NULL, false } };
+  { { "t:" #caption, NULL, false }, 0, 0 }, \
+  { "c:" #caption, NULL, false } };

    STATS_RATE_LIST(SR)
  #undef SR

  #define SC(name, caption) \
-  StatsCounter Counters::name = { L"c:" L###caption, NULL, false };
+  StatsCounter Counters::name = { "c:" #caption, NULL, false };

    STATS_COUNTER_LIST_1(SC)
    STATS_COUNTER_LIST_2(SC)
@@ -48,7 +48,7 @@

  StatsCounter Counters::state_counters[] = {
  #define COUNTER_NAME(name) \
-  { L"c:V8.State" L###name, NULL, false },
+  { "c:V8.State" #name, NULL, false },
    STATE_TAG_LIST(COUNTER_NAME)
  #undef COUNTER_NAME
  };

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

Reply via email to