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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/harmony-object-observe.js ('k') | test/mjsunit/array-push7.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/object-observe.js
diff --git a/src/object-observe.js b/src/object-observe.js
index 56859a1c97ba9f7729c2b8fb821c6142d6fdb7f1..6f4f20f078178d791c8b3ae3fb5474c53465cf55 100644
--- a/src/object-observe.js
+++ b/src/object-observe.js
@@ -10,6 +10,9 @@ var $observeNativeObjectObserve;
var $observeNativeObjectGetNotifier;
var $observeNativeObjectNotifierPerformChange;
+var $observeObjectMethods;
+var $observeArrayMethods;
+
(function(global, utils) {
"use strict";
@@ -676,20 +679,29 @@ function ObserveMicrotaskRunner() {
// -------------------------------------------------------------------
-utils.InstallFunctions(GlobalObject, DONT_ENUM, [
+utils.InstallFunctions(notifierPrototype, DONT_ENUM, [
+ "notify", ObjectNotifierNotify,
+ "performChange", ObjectNotifierPerformChange
+]);
+
+$observeObjectMethods = [
"deliverChangeRecords", ObjectDeliverChangeRecords,
"getNotifier", ObjectGetNotifier,
"observe", ObjectObserve,
"unobserve", ObjectUnobserve
-]);
-utils.InstallFunctions(GlobalArray, DONT_ENUM, [
+];
+$observeArrayMethods = [
"observe", ArrayObserve,
"unobserve", ArrayUnobserve
-]);
-utils.InstallFunctions(notifierPrototype, DONT_ENUM, [
- "notify", ObjectNotifierNotify,
- "performChange", ObjectNotifierPerformChange
-]);
+];
+
+// TODO(adamk): Figure out why this prototype removal has to
+// happen as part of initial snapshotting.
+var removePrototypeFn = function(f, i) {
+ if (i % 2 === 1) %FunctionRemovePrototype(f);
+};
+$observeObjectMethods.forEach(removePrototypeFn);
+$observeArrayMethods.forEach(removePrototypeFn);
$observeNotifyChange = NotifyChange;
$observeEnqueueSpliceRecord = EnqueueSpliceRecord;
« 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