Revision: 9860
Author:   [email protected]
Date:     Wed Nov  2 01:32:40 2011
Log:      Make non-templatized versions of LIR printing functions.

This avoid duplicating the code for each template instance.

Also remove dead code from different places in our code base.

Removed some verification code from release builds.
Review URL: http://codereview.chromium.org/8387070
http://code.google.com/p/v8/source/detail?r=9860

Modified:
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/hashmap.cc
 /branches/bleeding_edge/src/hashmap.h
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/ia32/assembler-ia32.cc
 /branches/bleeding_edge/src/ia32/assembler-ia32.h
 /branches/bleeding_edge/src/ia32/lithium-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-ia32.h
 /branches/bleeding_edge/src/scopes.cc
 /branches/bleeding_edge/src/scopes.h

=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Mon Oct 31 07:42:06 2011
+++ /branches/bleeding_edge/src/code-stubs.h    Wed Nov  2 01:32:40 2011
@@ -58,10 +58,8 @@
   V(FastNewContext)                      \
   V(FastNewBlockContext)                 \
   V(FastCloneShallowArray)               \
-  V(RevertToNumber)                      \
   V(ToBoolean)                           \
   V(ToNumber)                            \
-  V(CounterOp)                           \
   V(ArgumentsAccess)                     \
   V(RegExpConstructResult)               \
   V(NumberToString)                      \
=======================================
--- /branches/bleeding_edge/src/hashmap.cc      Tue Dec  7 03:01:02 2010
+++ /branches/bleeding_edge/src/hashmap.cc      Wed Nov  2 01:32:40 2011
@@ -39,12 +39,6 @@
 Allocator HashMap::DefaultAllocator;


-HashMap::HashMap() {
-  allocator_ = NULL;
-  match_ = NULL;
-}
-
-
 HashMap::HashMap(MatchFun match,
                  Allocator* allocator,
                  uint32_t initial_capacity) {
=======================================
--- /branches/bleeding_edge/src/hashmap.h       Tue May  3 01:23:58 2011
+++ /branches/bleeding_edge/src/hashmap.h       Wed Nov  2 01:32:40 2011
@@ -50,11 +50,6 @@

   typedef bool (*MatchFun) (void* key1, void* key2);

-  // Dummy constructor.  This constructor doesn't set up the hash
-  // map properly so don't use it unless you have good reason (e.g.,
-  // you know that the HashMap will never be used).
-  HashMap();
-
   // initial_capacity is the size of the initial hash map;
   // it must be a power of 2 (and thus must not be 0).
   explicit HashMap(MatchFun match,
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Oct 31 07:15:10 2011 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Nov 2 01:32:40 2011
@@ -126,7 +126,9 @@
   bool may_overflow = false;  // Overflow is ignored here.
   lower_ = AddWithoutOverflow(lower_, value, &may_overflow);
   upper_ = AddWithoutOverflow(upper_, value, &may_overflow);
+#ifdef DEBUG
   Verify();
+#endif
 }


@@ -173,7 +175,9 @@
   lower_ = AddWithoutOverflow(lower_, other->lower(), &may_overflow);
   upper_ = AddWithoutOverflow(upper_, other->upper(), &may_overflow);
   KeepOrder();
+#ifdef DEBUG
   Verify();
+#endif
   return may_overflow;
 }

@@ -183,7 +187,9 @@
   lower_ = SubWithoutOverflow(lower_, other->upper(), &may_overflow);
   upper_ = SubWithoutOverflow(upper_, other->lower(), &may_overflow);
   KeepOrder();
+#ifdef DEBUG
   Verify();
+#endif
   return may_overflow;
 }

@@ -197,9 +203,11 @@
 }


+#ifdef DEBUG
 void Range::Verify() const {
   ASSERT(lower_ <= upper_);
 }
+#endif


 bool Range::MulAndCheckOverflow(Range* other) {
@@ -210,7 +218,9 @@
   int v4 = MulWithoutOverflow(upper_, other->upper(), &may_overflow);
   lower_ = Min(Min(v1, v2), Min(v3, v4));
   upper_ = Max(Max(v1, v2), Max(v3, v4));
+#ifdef DEBUG
   Verify();
+#endif
   return may_overflow;
 }

@@ -232,25 +242,6 @@
   UNREACHABLE();
   return "Unreachable code";
 }
-
-
-const char* HType::ToShortString() {
-  switch (type_) {
-    case kTagged: return "t";
-    case kTaggedPrimitive: return "p";
-    case kTaggedNumber: return "n";
-    case kSmi: return "m";
-    case kHeapNumber: return "h";
-    case kString: return "s";
-    case kBoolean: return "b";
-    case kNonPrimitive: return "r";
-    case kJSArray: return "a";
-    case kJSObject: return "o";
-    case kUninitialized: return "z";
-  }
-  UNREACHABLE();
-  return "Unreachable code";
-}


 HType HType::TypeFromValue(Handle<Object> value) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Tue Nov 1 04:35:54 2011 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Nov 2 01:32:40 2011
@@ -245,7 +245,9 @@
     return lower_ >= Smi::kMinValue && upper_ <= Smi::kMaxValue;
   }
   void KeepOrder();
+#ifdef DEBUG
   void Verify() const;
+#endif

   void StackUpon(Range* other) {
     Intersect(other);
@@ -405,7 +407,6 @@
   static HType TypeFromValue(Handle<Object> value);

   const char* ToString();
-  const char* ToShortString();

  private:
   enum Type {
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.cc Mon Oct 3 04:44:39 2011 +++ /branches/bleeding_edge/src/ia32/assembler-ia32.cc Wed Nov 2 01:32:40 2011
@@ -626,26 +626,6 @@
   EMIT(0xB7);
   emit_operand(dst, src);
 }
-
-
-void Assembler::cmov(Condition cc, Register dst, int32_t imm32) {
-  ASSERT(CpuFeatures::IsEnabled(CMOV));
-  EnsureSpace ensure_space(this);
-  UNIMPLEMENTED();
-  USE(cc);
-  USE(dst);
-  USE(imm32);
-}
-
-
-void Assembler::cmov(Condition cc, Register dst, Handle<Object> handle) {
-  ASSERT(CpuFeatures::IsEnabled(CMOV));
-  EnsureSpace ensure_space(this);
-  UNIMPLEMENTED();
-  USE(cc);
-  USE(dst);
-  USE(handle);
-}


 void Assembler::cmov(Condition cc, Register dst, const Operand& src) {
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h Mon Oct 3 04:44:39 2011 +++ /branches/bleeding_edge/src/ia32/assembler-ia32.h Wed Nov 2 01:32:40 2011
@@ -713,8 +713,6 @@
   void movzx_w(Register dst, const Operand& src);

   // Conditional moves
-  void cmov(Condition cc, Register dst, int32_t imm32);
-  void cmov(Condition cc, Register dst, Handle<Object> handle);
   void cmov(Condition cc, Register dst, Register src) {
     cmov(cc, dst, Operand(src));
   }
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Nov 1 04:49:31 2011 +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Nov 2 01:32:40 2011
@@ -110,22 +110,17 @@
 }


-template<int R, int I, int T>
-void LTemplateInstruction<R, I, T>::PrintDataTo(StringStream* stream) {
+void LInstruction::PrintDataTo(StringStream* stream) {
   stream->Add("= ");
-  for (int i = 0; i < inputs_.length(); i++) {
+  for (int i = 0; i < InputCount(); i++) {
     if (i > 0) stream->Add(" ");
-    inputs_[i]->PrintTo(stream);
+    InputAt(i)->PrintTo(stream);
   }
 }


-template<int R, int I, int T>
-void LTemplateInstruction<R, I, T>::PrintOutputOperandTo(StringStream* stream) {
-  for (int i = 0; i < results_.length(); i++) {
-    if (i > 0) stream->Add(" ");
-    results_[i]->PrintTo(stream);
-  }
+void LInstruction::PrintOutputOperandTo(StringStream* stream) {
+  if (HasResult()) result()->PrintTo(stream);
 }


=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h     Tue Nov  1 04:49:31 2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h     Wed Nov  2 01:32:40 2011
@@ -192,8 +192,8 @@
   virtual void CompileToNative(LCodeGen* generator) = 0;
   virtual const char* Mnemonic() const = 0;
   virtual void PrintTo(StringStream* stream);
-  virtual void PrintDataTo(StringStream* stream) = 0;
-  virtual void PrintOutputOperandTo(StringStream* stream) = 0;
+  virtual void PrintDataTo(StringStream* stream);
+  virtual void PrintOutputOperandTo(StringStream* stream);

   enum Opcode {
     // Declare a unique enum value for each instruction.
@@ -288,9 +288,6 @@

   int TempCount() { return T; }
   LOperand* TempAt(int i) { return temps_[i]; }
-
-  virtual void PrintDataTo(StringStream* stream);
-  virtual void PrintOutputOperandTo(StringStream* stream);

  protected:
   EmbeddedContainer<LOperand*, R> results_;
=======================================
--- /branches/bleeding_edge/src/scopes.cc       Tue Oct 25 01:33:08 2011
+++ /branches/bleeding_edge/src/scopes.cc       Wed Nov  2 01:32:40 2011
@@ -75,9 +75,6 @@
   return name1 == name2;
 }

-
-// Dummy constructor
-VariableMap::VariableMap(bool gotta_love_static_overloading) : HashMap() {}

 VariableMap::VariableMap() : HashMap(Match, &LocalsMapAllocator, 8) {}
 VariableMap::~VariableMap() {}
@@ -112,21 +109,6 @@
// ----------------------------------------------------------------------------
 // Implementation of Scope

-
-// Dummy constructor
-Scope::Scope(ScopeType type)
-    : isolate_(Isolate::Current()),
-      inner_scopes_(0),
-      variables_(false),
-      temps_(0),
-      params_(0),
-      unresolved_(0),
-      decls_(0),
-      already_resolved_(false) {
-  SetDefaults(type, NULL, Handle<SerializedScopeInfo>::null());
-}
-
-
 Scope::Scope(Scope* outer_scope, ScopeType type)
     : isolate_(Isolate::Current()),
       inner_scopes_(4),
=======================================
--- /branches/bleeding_edge/src/scopes.h        Tue Oct 25 01:33:08 2011
+++ /branches/bleeding_edge/src/scopes.h        Wed Nov  2 01:32:40 2011
@@ -42,10 +42,6 @@
  public:
   VariableMap();

-  // Dummy constructor.  This constructor doesn't set up the map
-  // properly so don't use it unless you have a good reason.
-  explicit VariableMap(bool gotta_love_static_overloading);
-
   virtual ~VariableMap();

   Variable* Declare(Scope* scope,
@@ -373,8 +369,6 @@
  protected:
   friend class ParserFactory;

-  explicit Scope(ScopeType type);
-
   Isolate* const isolate_;

   // Scope tree.

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

Reply via email to