OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var $observeNotifyChange; | 5 var $observeNotifyChange; |
6 var $observeEnqueueSpliceRecord; | 6 var $observeEnqueueSpliceRecord; |
7 var $observeBeginPerformSplice; | 7 var $observeBeginPerformSplice; |
8 var $observeEndPerformSplice; | 8 var $observeEndPerformSplice; |
9 var $observeNativeObjectObserve; | 9 var $observeNativeObjectObserve; |
10 var $observeNativeObjectGetNotifier; | 10 var $observeNativeObjectGetNotifier; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 %SetIsObserved(object); | 201 %SetIsObserved(object); |
202 } | 202 } |
203 objectInfo = { | 203 objectInfo = { |
204 object: object, | 204 object: object, |
205 changeObservers: null, | 205 changeObservers: null, |
206 notifier: null, | 206 notifier: null, |
207 performing: null, | 207 performing: null, |
208 performingCount: 0, | 208 performingCount: 0, |
209 }; | 209 }; |
210 %WeakCollectionSet(GetObservationStateJS().objectInfoMap, | 210 %WeakCollectionSet(GetObservationStateJS().objectInfoMap, |
211 object, objectInfo); | 211 object, objectInfo, $getHash(object)); |
212 } | 212 } |
213 return objectInfo; | 213 return objectInfo; |
214 } | 214 } |
215 | 215 |
216 | 216 |
217 function ObjectInfoGet(object) { | 217 function ObjectInfoGet(object) { |
218 return %WeakCollectionGet(GetObservationStateJS().objectInfoMap, object); | 218 return %WeakCollectionGet(GetObservationStateJS().objectInfoMap, object, |
| 219 $getHash(object)); |
219 } | 220 } |
220 | 221 |
221 | 222 |
222 function ObjectInfoGetFromNotifier(notifier) { | 223 function ObjectInfoGetFromNotifier(notifier) { |
223 return %WeakCollectionGet(GetObservationStateJS().notifierObjectInfoMap, | 224 return %WeakCollectionGet(GetObservationStateJS().notifierObjectInfoMap, |
224 notifier); | 225 notifier, $getHash(notifier)); |
225 } | 226 } |
226 | 227 |
227 | 228 |
228 function ObjectInfoGetNotifier(objectInfo) { | 229 function ObjectInfoGetNotifier(objectInfo) { |
229 if (IS_NULL(objectInfo.notifier)) { | 230 if (IS_NULL(objectInfo.notifier)) { |
230 objectInfo.notifier = { __proto__: notifierPrototype }; | 231 var notifier = { __proto__: notifierPrototype }; |
| 232 objectInfo.notifier = notifier; |
231 %WeakCollectionSet(GetObservationStateJS().notifierObjectInfoMap, | 233 %WeakCollectionSet(GetObservationStateJS().notifierObjectInfoMap, |
232 objectInfo.notifier, objectInfo); | 234 notifier, objectInfo, $getHash(notifier)); |
233 } | 235 } |
234 | 236 |
235 return objectInfo.notifier; | 237 return objectInfo.notifier; |
236 } | 238 } |
237 | 239 |
238 | 240 |
239 function ChangeObserversIsOptimized(changeObservers) { | 241 function ChangeObserversIsOptimized(changeObservers) { |
240 return IS_SPEC_FUNCTION(changeObservers) || | 242 return IS_SPEC_FUNCTION(changeObservers) || |
241 IS_SPEC_FUNCTION(changeObservers.callback); | 243 IS_SPEC_FUNCTION(changeObservers.callback); |
242 } | 244 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (len < 0) len = 0; | 335 if (len < 0) len = 0; |
334 | 336 |
335 return TypeMapCreateFromList(arg, len); | 337 return TypeMapCreateFromList(arg, len); |
336 } | 338 } |
337 | 339 |
338 | 340 |
339 // CallbackInfo's optimized state is just a number which represents its global | 341 // CallbackInfo's optimized state is just a number which represents its global |
340 // priority. When a change record must be enqueued for the callback, it | 342 // priority. When a change record must be enqueued for the callback, it |
341 // normalizes. When delivery clears any pending change records, it re-optimizes. | 343 // normalizes. When delivery clears any pending change records, it re-optimizes. |
342 function CallbackInfoGet(callback) { | 344 function CallbackInfoGet(callback) { |
343 return %WeakCollectionGet(GetObservationStateJS().callbackInfoMap, callback); | 345 return %WeakCollectionGet(GetObservationStateJS().callbackInfoMap, callback, |
| 346 $getHash(callback)); |
344 } | 347 } |
345 | 348 |
346 | 349 |
347 function CallbackInfoSet(callback, callbackInfo) { | 350 function CallbackInfoSet(callback, callbackInfo) { |
348 %WeakCollectionSet(GetObservationStateJS().callbackInfoMap, | 351 %WeakCollectionSet(GetObservationStateJS().callbackInfoMap, |
349 callback, callbackInfo); | 352 callback, callbackInfo, $getHash(callback)); |
350 } | 353 } |
351 | 354 |
352 | 355 |
353 function CallbackInfoGetOrCreate(callback) { | 356 function CallbackInfoGetOrCreate(callback) { |
354 var callbackInfo = CallbackInfoGet(callback); | 357 var callbackInfo = CallbackInfoGet(callback); |
355 if (!IS_UNDEFINED(callbackInfo)) | 358 if (!IS_UNDEFINED(callbackInfo)) |
356 return callbackInfo; | 359 return callbackInfo; |
357 | 360 |
358 var priority = GetNextCallbackPriority(); | 361 var priority = GetNextCallbackPriority(); |
359 CallbackInfoSet(callback, priority); | 362 CallbackInfoSet(callback, priority); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 | 693 |
691 $observeNotifyChange = NotifyChange; | 694 $observeNotifyChange = NotifyChange; |
692 $observeEnqueueSpliceRecord = EnqueueSpliceRecord; | 695 $observeEnqueueSpliceRecord = EnqueueSpliceRecord; |
693 $observeBeginPerformSplice = BeginPerformSplice; | 696 $observeBeginPerformSplice = BeginPerformSplice; |
694 $observeEndPerformSplice = EndPerformSplice; | 697 $observeEndPerformSplice = EndPerformSplice; |
695 $observeNativeObjectObserve = NativeObjectObserve; | 698 $observeNativeObjectObserve = NativeObjectObserve; |
696 $observeNativeObjectGetNotifier = NativeObjectGetNotifier; | 699 $observeNativeObjectGetNotifier = NativeObjectGetNotifier; |
697 $observeNativeObjectNotifierPerformChange = NativeObjectNotifierPerformChange; | 700 $observeNativeObjectNotifierPerformChange = NativeObjectNotifierPerformChange; |
698 | 701 |
699 }) | 702 }) |
OLD | NEW |