Revision: 3816
Author: [email protected]
Date: Mon Feb  8 06:33:34 2010
Log: Eliminate unnecessary depencencies in some header files.

1. Eliminate unnecessary include of register-allocator-inl.h in frame-element.h. 2. Move functions register-allocator.h to the -inl.h file if they use other inline functions.
3. Add missing includes that resulted from the above changes.


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

Modified:
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/frame-element.h
 /branches/bleeding_edge/src/register-allocator-inl.h
 /branches/bleeding_edge/src/register-allocator.h

=======================================
--- /branches/bleeding_edge/src/compiler.h      Fri Feb  5 05:57:18 2010
+++ /branches/bleeding_edge/src/compiler.h      Mon Feb  8 06:33:34 2010
@@ -28,8 +28,10 @@
 #ifndef V8_COMPILER_H_
 #define V8_COMPILER_H_

+#include "ast.h"
 #include "frame-element.h"
 #include "parser.h"
+#include "register-allocator.h"
 #include "zone.h"

 namespace v8 {
=======================================
--- /branches/bleeding_edge/src/debug.cc        Mon Feb  8 05:44:49 2010
+++ /branches/bleeding_edge/src/debug.cc        Mon Feb  8 06:33:34 2010
@@ -31,6 +31,7 @@
 #include "arguments.h"
 #include "bootstrapper.h"
 #include "code-stubs.h"
+#include "codegen.h"
 #include "compilation-cache.h"
 #include "compiler.h"
 #include "debug.h"
=======================================
--- /branches/bleeding_edge/src/frame-element.h Thu Jul 16 22:37:09 2009
+++ /branches/bleeding_edge/src/frame-element.h Mon Feb  8 06:33:34 2010
@@ -28,7 +28,7 @@
 #ifndef V8_FRAME_ELEMENT_H_
 #define V8_FRAME_ELEMENT_H_

-#include "register-allocator-inl.h"
+#include "macro-assembler.h"

 namespace v8 {
 namespace internal {
=======================================
--- /branches/bleeding_edge/src/register-allocator-inl.h Thu Feb 4 12:36:58 2010 +++ /branches/bleeding_edge/src/register-allocator-inl.h Mon Feb 8 06:33:34 2010
@@ -48,6 +48,20 @@
 namespace v8 {
 namespace internal {

+Result::Result(const Result& other) {
+  other.CopyTo(this);
+}
+
+
+Result& Result::operator=(const Result& other) {
+  if (this != &other) {
+    Unuse();
+    other.CopyTo(this);
+  }
+  return *this;
+}
+
+
 Result::~Result() {
   if (is_register()) {
     CodeGeneratorScope::Current()->allocator()->Unuse(reg());
@@ -71,6 +85,25 @@
 }


+bool RegisterAllocator::is_used(Register reg) {
+  return registers_.is_used(ToNumber(reg));
+}
+
+
+int RegisterAllocator::count(Register reg) {
+  return registers_.count(ToNumber(reg));
+}
+
+
+void RegisterAllocator::Use(Register reg) {
+  registers_.Use(ToNumber(reg));
+}
+
+
+void RegisterAllocator::Unuse(Register reg) {
+  registers_.Unuse(ToNumber(reg));
+}
+
 } }  // namespace v8::internal

 #endif  // V8_REGISTER_ALLOCATOR_INL_H_
=======================================
--- /branches/bleeding_edge/src/register-allocator.h Thu Feb 4 12:36:58 2010 +++ /branches/bleeding_edge/src/register-allocator.h Mon Feb 8 06:33:34 2010
@@ -75,17 +75,9 @@

   // The copy constructor and assignment operators could each create a new
   // register reference.
-  Result(const Result& other) {
-    other.CopyTo(this);
-  }
-
-  Result& operator=(const Result& other) {
-    if (this != &other) {
-      Unuse();
-      other.CopyTo(this);
-    }
-    return *this;
-  }
+  inline Result(const Result& other);
+
+  inline Result& operator=(const Result& other);

   inline ~Result();

@@ -237,18 +229,18 @@

   // Predicates and accessors for the registers' reference counts.
   bool is_used(int num) { return registers_.is_used(num); }
-  bool is_used(Register reg) { return registers_.is_used(ToNumber(reg)); }
+  inline bool is_used(Register reg);

   int count(int num) { return registers_.count(num); }
-  int count(Register reg) { return registers_.count(ToNumber(reg)); }
+  inline int count(Register reg);

   // Explicitly record a reference to a register.
   void Use(int num) { registers_.Use(num); }
-  void Use(Register reg) { registers_.Use(ToNumber(reg)); }
+  inline void Use(Register reg);

   // Explicitly record that a register will no longer be used.
   void Unuse(int num) { registers_.Unuse(num); }
-  void Unuse(Register reg) { registers_.Unuse(ToNumber(reg)); }
+  inline void Unuse(Register reg);

// Reset the register reference counts to free all non-reserved registers.
   void Reset() { registers_.Reset(); }

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

Reply via email to