Eliminate unnecessary depencencies in some header files.
authorfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 8 Feb 2010 14:33:34 +0000 (14:33 +0000)
committerfschneider@chromium.org <fschneider@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 8 Feb 2010 14:33:34 +0000 (14:33 +0000)
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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3816 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/compiler.h
src/debug.cc
src/frame-element.h
src/register-allocator-inl.h
src/register-allocator.h

index 72abb6ac491771366ba3ffbdfbc87abbef649e48..21affdf567d1aa0d949c5935458a0e5865023fa0 100644 (file)
 #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 {
index 4e27b0f2a7f5e6d3c905ef59ea59906896abd8e4..019081fb8bc0e7d66925e7b3e5aaf6b436b7d37a 100644 (file)
@@ -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"
index ccdecf1d6672bb24eeeac100f832019a2238091c..d1807f64726bdf35f42822aca0b17d97c123081c 100644 (file)
@@ -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 {
index b3fa4747bcdfb960bdf79e472e43d780aa4b5d64..a99f4550849217ba03edd793dec6a3fcb260fb9d 100644 (file)
 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 @@ void Result::CopyTo(Result* destination) const {
 }
 
 
+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_
index 0f46996cf460b099d42cae8cdfe41c5e32312615..9f0132286d6d4e9606817d1488475ee5f6324026 100644 (file)
@@ -75,17 +75,9 @@ class Result BASE_EMBEDDED {
 
   // The copy constructor and assignment operators could each create a new
   // register reference.
-  Result(const Result& other) {
-    other.CopyTo(this);
-  }
+  inline Result(const Result& other);
 
-  Result& operator=(const Result& other) {
-    if (this != &other) {
-      Unuse();
-      other.CopyTo(this);
-    }
-    return *this;
-  }
+  inline Result& operator=(const Result& other);
 
   inline ~Result();
 
@@ -237,18 +229,18 @@ class RegisterAllocator BASE_EMBEDDED {
 
   // 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(); }