Reviewers: bak,

Description:
Fix win32 build in debug mode by moving a template function
definition from objects-debug.cc to objects.cc.

[email protected]

Please review this at http://codereview.chromium.org/155080

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/objects-debug.cc
   M     src/objects.cc


Index: src/objects.cc
===================================================================
--- src/objects.cc      (revision 2358)
+++ src/objects.cc      (working copy)
@@ -5747,7 +5747,35 @@
        (length / (2 * NumberDictionary::kEntrySize));
  }

+
+// Certain compilers request function template instantiation when they
+// see the definition of the other template functions in the
+// class. This requires us to have the template functions put
+// together, so even though this function belongs in objects-debug.cc,
+// we keep it here instead to satisfy certain compilers.
+#ifdef DEBUG
  template<typename Shape, typename Key>
+void Dictionary<Shape, Key>::Print() {
+  int capacity = HashTable<Shape, Key>::Capacity();
+  for (int i = 0; i < capacity; i++) {
+    Object* k = HashTable<Shape, Key>::KeyAt(i);
+    if (HashTable<Shape, Key>::IsKey(k)) {
+      PrintF(" ");
+      if (k->IsString()) {
+        String::cast(k)->StringPrint();
+      } else {
+        k->ShortPrint();
+      }
+      PrintF(": ");
+      ValueAt(i)->ShortPrint();
+      PrintF("\n");
+    }
+  }
+}
+#endif
+
+
+template<typename Shape, typename Key>
  void Dictionary<Shape, Key>::CopyValuesTo(FixedArray* elements) {
    int pos = 0;
    int capacity = HashTable<Shape, Key>::Capacity();
Index: src/objects-debug.cc
===================================================================
--- src/objects-debug.cc        (revision 2358)
+++ src/objects-debug.cc        (working copy)
@@ -744,29 +744,7 @@
    ASSERT(IsProxy());
  }

-template<typename Shape, typename Key>
-void Dictionary<Shape, Key>::Print() {
-  int capacity = HashTable<Shape, Key>::Capacity();
-  for (int i = 0; i < capacity; i++) {
-    Object* k = HashTable<Shape, Key>::KeyAt(i);
-    if (HashTable<Shape, Key>::IsKey(k)) {
-      PrintF(" ");
-      if (k->IsString()) {
-        String::cast(k)->StringPrint();
-      } else {
-        k->ShortPrint();
-      }
-      PrintF(": ");
-      ValueAt(i)->ShortPrint();
-      PrintF("\n");
-    }
-  }
-}

-// Template instantiations.
-template void Dictionary<NumberDictionaryShape, uint32_t>::Print();
-template void Dictionary<StringDictionaryShape, String*>::Print();
-
  void AccessorInfo::AccessorInfoVerify() {
    CHECK(IsAccessorInfo());
    VerifyPointer(getter());



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

Reply via email to