Reviewers: rossberg,

Message:
Still needs a test, but I have to figure out how to blow out the hash table
first.

Description:
Fix InternalObjectHashTable to properly update table ref in observationState

The previous fix wasn't broad enough: it only fixed the reference for a single
Context.


Please review this at https://codereview.chromium.org/11361172/

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

Affected files:
  M src/object-observe.js


Index: src/object-observe.js
diff --git a/src/object-observe.js b/src/object-observe.js
index 5214f7a143953b23df47c1c2a6e66fd5d5e2dd23..086159f9cb81db03ecfa87ec87a1a4fdb588e4ef 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -38,25 +38,25 @@ if (IS_UNDEFINED(observationState.observerInfoMap)) {
   observationState.observerPriority = 0;
 }

-function InternalObjectHashTable(table) {
-  this.table = table;
+function InternalObjectHashTable(tableName) {
+  this.tableName = tableName;
 }

 InternalObjectHashTable.prototype = {
   get: function(key) {
-    return %ObjectHashTableGet(this.table, key);
+    return %ObjectHashTableGet(observationState[this.tableName], key);
   },
   set: function(key, value) {
-    this.table = %ObjectHashTableSet(this.table, key, value);
+    observationState[this.tableName] =
+        %ObjectHashTableSet(observationState[this.tableName], key, value);
   },
   has: function(key) {
-    return %ObjectHashTableHas(this.table, key);
+    return %ObjectHashTableHas(observationState[this.tableName], key);
   }
 };

-var observerInfoMap = new InternalObjectHashTable(
-    observationState.observerInfoMap);
-var objectInfoMap = new InternalObjectHashTable(observationState.objectInfoMap);
+var observerInfoMap = new InternalObjectHashTable('observerInfoMap');
+var objectInfoMap = new InternalObjectHashTable('objectInfoMap');

 function ObjectObserve(object, callback) {
   if (!IS_SPEC_OBJECT(object))


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

Reply via email to