Revision: 9517
Author:   [email protected]
Date:     Tue Oct  4 08:54:57 2011
Log:      Fix verification of weak maps during initialization.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/objects-debug.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects-printer.cc
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/objects-debug.cc        Fri Sep 23 06:28:17 2011
+++ /branches/bleeding_edge/src/objects-debug.cc        Tue Oct  4 08:54:57 2011
@@ -498,7 +498,7 @@
   CHECK(IsJSWeakMap());
   JSObjectVerify();
   VerifyHeapPointer(table());
-  ASSERT(table()->IsHashTable());
+  ASSERT(table()->IsHashTable() || table()->IsUndefined());
 }


=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Tue Oct  4 00:45:25 2011
+++ /branches/bleeding_edge/src/objects-inl.h   Tue Oct  4 08:54:57 2011
@@ -3887,7 +3887,7 @@
 }


-ACCESSORS(JSWeakMap, table, ObjectHashTable, kTableOffset)
+ACCESSORS(JSWeakMap, table, Object, kTableOffset)
 ACCESSORS_GCSAFE(JSWeakMap, next, Object, kNextOffset)


=======================================
--- /branches/bleeding_edge/src/objects-printer.cc      Fri Sep 23 08:09:00 2011
+++ /branches/bleeding_edge/src/objects-printer.cc      Tue Oct  4 08:54:57 2011
@@ -708,7 +708,6 @@
 void JSWeakMap::JSWeakMapPrint(FILE* out) {
   HeapObject::PrintHeader(out, "JSWeakMap");
   PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
-  PrintF(out, " - number of elements = %d\n", table()->NumberOfElements());
   PrintF(out, " - table = ");
   table()->ShortPrint(out);
   PrintF(out, "\n");
=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Oct  4 06:49:50 2011
+++ /branches/bleeding_edge/src/objects.cc      Tue Oct  4 08:54:57 2011
@@ -1002,8 +1002,7 @@
       break;
     }
     case JS_WEAK_MAP_TYPE: {
-      int elements = JSWeakMap::cast(this)->table()->NumberOfElements();
-      accumulator->Add("<JS WeakMap[%d]>", elements);
+      accumulator->Add("<JS WeakMap>");
       break;
     }
     case JS_REGEXP_TYPE: {
=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Oct  4 00:45:25 2011
+++ /branches/bleeding_edge/src/objects.h       Tue Oct  4 08:54:57 2011
@@ -6897,7 +6897,7 @@
 class JSWeakMap: public JSObject {
  public:
   // [table]: the backing hash table mapping keys to values.
-  DECL_ACCESSORS(table, ObjectHashTable)
+  DECL_ACCESSORS(table, Object)

   // [next]: linked list of encountered weak maps during GC.
   DECL_ACCESSORS(next, Object)
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Mon Oct  3 04:13:20 2011
+++ /branches/bleeding_edge/src/runtime.cc      Tue Oct  4 08:54:57 2011
@@ -716,7 +716,7 @@
   ASSERT(args.length() == 2);
   CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0);
   CONVERT_ARG_CHECKED(JSReceiver, key, 1);
-  return weakmap->table()->Lookup(*key);
+  return ObjectHashTable::cast(weakmap->table())->Lookup(*key);
 }


@@ -726,7 +726,7 @@
   CONVERT_ARG_CHECKED(JSWeakMap, weakmap, 0);
   CONVERT_ARG_CHECKED(JSReceiver, key, 1);
   Handle<Object> value(args[2]);
-  Handle<ObjectHashTable> table(weakmap->table());
+  Handle<ObjectHashTable> table(ObjectHashTable::cast(weakmap->table()));
Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value);
   weakmap->set_table(*new_table);
   return *value;

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

Reply via email to