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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // Overview: | 7 // Overview: |
8 // | 8 // |
9 // This file contains all of the routing and accounting for Object.observe. | 9 // This file contains all of the routing and accounting for Object.observe. |
10 // User code will interact with these mechanisms via the Object.observe APIs | 10 // User code will interact with these mechanisms via the Object.observe APIs |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 if (!ObjectInfoHasActiveObservers(objectInfo)) | 443 if (!ObjectInfoHasActiveObservers(objectInfo)) |
444 return; | 444 return; |
445 | 445 |
446 var hasType = !IS_UNDEFINED(type); | 446 var hasType = !IS_UNDEFINED(type); |
447 var newRecord = hasType ? | 447 var newRecord = hasType ? |
448 { object: ObjectInfoGetObject(objectInfo), type: type } : | 448 { object: ObjectInfoGetObject(objectInfo), type: type } : |
449 { object: ObjectInfoGetObject(objectInfo) }; | 449 { object: ObjectInfoGetObject(objectInfo) }; |
450 | 450 |
451 for (var prop in changeRecord) { | 451 for (var prop in changeRecord) { |
452 if (prop === 'object' || (hasType && prop === 'type')) continue; | 452 if (prop === 'object' || (hasType && prop === 'type')) continue; |
453 %AddProperty(newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE); | 453 %DefineDataPropertyUnchecked( |
| 454 newRecord, prop, changeRecord[prop], READ_ONLY + DONT_DELETE); |
454 } | 455 } |
455 ObjectFreezeJS(newRecord); | 456 ObjectFreezeJS(newRecord); |
456 | 457 |
457 ObjectInfoEnqueueInternalChangeRecord(objectInfo, newRecord); | 458 ObjectInfoEnqueueInternalChangeRecord(objectInfo, newRecord); |
458 } | 459 } |
459 | 460 |
460 function ObjectInfoEnqueueInternalChangeRecord(objectInfo, changeRecord) { | 461 function ObjectInfoEnqueueInternalChangeRecord(objectInfo, changeRecord) { |
461 // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 462 // TODO(rossberg): adjust once there is a story for symbols vs proxies. |
462 if (IS_SYMBOL(changeRecord.name)) return; | 463 if (IS_SYMBOL(changeRecord.name)) return; |
463 | 464 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 "observe", ArrayObserve, | 644 "observe", ArrayObserve, |
644 "unobserve", ArrayUnobserve | 645 "unobserve", ArrayUnobserve |
645 )); | 646 )); |
646 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( | 647 InstallFunctions(notifierPrototype, DONT_ENUM, $Array( |
647 "notify", ObjectNotifierNotify, | 648 "notify", ObjectNotifierNotify, |
648 "performChange", ObjectNotifierPerformChange | 649 "performChange", ObjectNotifierPerformChange |
649 )); | 650 )); |
650 } | 651 } |
651 | 652 |
652 SetupObjectObserve(); | 653 SetupObjectObserve(); |
OLD | NEW |