Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/object-observe.js

Issue 1257063003: Add a --harmony-object-observe runtime flag (on by default) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move some initialization back to the snapshot Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/harmony-object-observe.js ('k') | test/mjsunit/array-push7.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
11 var $observeNativeObjectNotifierPerformChange; 11 var $observeNativeObjectNotifierPerformChange;
12 12
13 var $observeObjectMethods;
14 var $observeArrayMethods;
15
13 (function(global, utils) { 16 (function(global, utils) {
14 17
15 "use strict"; 18 "use strict";
16 19
17 %CheckIsBootstrapping(); 20 %CheckIsBootstrapping();
18 21
19 // ------------------------------------------------------------------- 22 // -------------------------------------------------------------------
20 // Imports 23 // Imports
21 24
22 var GlobalArray = global.Array; 25 var GlobalArray = global.Array;
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 if (!IS_NULL(pendingObservers)) { 672 if (!IS_NULL(pendingObservers)) {
670 SetPendingObservers(null); 673 SetPendingObservers(null);
671 for (var i in pendingObservers) { 674 for (var i in pendingObservers) {
672 CallbackDeliverPending(pendingObservers[i]); 675 CallbackDeliverPending(pendingObservers[i]);
673 } 676 }
674 } 677 }
675 } 678 }
676 679
677 // ------------------------------------------------------------------- 680 // -------------------------------------------------------------------
678 681
679 utils.InstallFunctions(GlobalObject, DONT_ENUM, [
680 "deliverChangeRecords", ObjectDeliverChangeRecords,
681 "getNotifier", ObjectGetNotifier,
682 "observe", ObjectObserve,
683 "unobserve", ObjectUnobserve
684 ]);
685 utils.InstallFunctions(GlobalArray, DONT_ENUM, [
686 "observe", ArrayObserve,
687 "unobserve", ArrayUnobserve
688 ]);
689 utils.InstallFunctions(notifierPrototype, DONT_ENUM, [ 682 utils.InstallFunctions(notifierPrototype, DONT_ENUM, [
690 "notify", ObjectNotifierNotify, 683 "notify", ObjectNotifierNotify,
691 "performChange", ObjectNotifierPerformChange 684 "performChange", ObjectNotifierPerformChange
692 ]); 685 ]);
693 686
687 $observeObjectMethods = [
688 "deliverChangeRecords", ObjectDeliverChangeRecords,
689 "getNotifier", ObjectGetNotifier,
690 "observe", ObjectObserve,
691 "unobserve", ObjectUnobserve
692 ];
693 $observeArrayMethods = [
694 "observe", ArrayObserve,
695 "unobserve", ArrayUnobserve
696 ];
697
698 // TODO(adamk): Figure out why this prototype removal has to
699 // happen as part of initial snapshotting.
700 var removePrototypeFn = function(f, i) {
701 if (i % 2 === 1) %FunctionRemovePrototype(f);
702 };
703 $observeObjectMethods.forEach(removePrototypeFn);
704 $observeArrayMethods.forEach(removePrototypeFn);
705
694 $observeNotifyChange = NotifyChange; 706 $observeNotifyChange = NotifyChange;
695 $observeEnqueueSpliceRecord = EnqueueSpliceRecord; 707 $observeEnqueueSpliceRecord = EnqueueSpliceRecord;
696 $observeBeginPerformSplice = BeginPerformSplice; 708 $observeBeginPerformSplice = BeginPerformSplice;
697 $observeEndPerformSplice = EndPerformSplice; 709 $observeEndPerformSplice = EndPerformSplice;
698 $observeNativeObjectObserve = NativeObjectObserve; 710 $observeNativeObjectObserve = NativeObjectObserve;
699 $observeNativeObjectGetNotifier = NativeObjectGetNotifier; 711 $observeNativeObjectGetNotifier = NativeObjectGetNotifier;
700 $observeNativeObjectNotifierPerformChange = NativeObjectNotifierPerformChange; 712 $observeNativeObjectNotifierPerformChange = NativeObjectNotifierPerformChange;
701 713
702 }) 714 })
OLDNEW
« no previous file with comments | « src/harmony-object-observe.js ('k') | test/mjsunit/array-push7.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698