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

Issue 19132002: [Object.observe] Lazily allocate callbackInfo structure (Closed)

Created:
7 years, 5 months ago by rafaelw
Modified:
7 years, 5 months ago
Reviewers:
rossberg, adamk
Base URL:
https://github.com/v8/v8.git@bleeding_edge
Visibility:
Public.

Description

[Object.observe] Lazily allocate callbackInfo structure This patch allows callbacks to lazily allocate the InternalArray which is used to store pendingChangeRecords. This moves some of the expense of observation to the case where changes actually occurred. When there are no pendingChangeRecords, the callbackInfo structure is a number which is the callbacks priority. Whenever a changeRecord is enqueued to the callback, it "normalizes" to be an InternalArray with a priority property. Immediately before its changeRecords are delivered, it returns to its optimized state. --- Note: Naming confusion resolved: This patch corrects some naming confusion in object-observe.js. Previously, we used the terms "callback" and "observer" to mean roughly the same thing, and overloaded the term "observer" to be both the callback itself and the *registration* on a object to observe (which now includes an accept map). This patch resolves this confusion: "object" (objectInfo, objectInfoMap): This refers to the observed object and its structures "callback" (callbackInfo, callbackInfoMap): This refers to the callback to whom change records may be delivered "observer" (objectInfo.changeObservers): This refers to a registration to observe a given object by a given callback with the specified accept list. --- R=rossberg@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=15682

Patch Set 1 #

Total comments: 2

Patch Set 2 : cr comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -36 lines) Patch
M src/object-observe.js View 1 9 chunks +43 lines, -32 lines 0 comments Download
M test/cctest/test-object-observe.cc View 1 chunk +4 lines, -4 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
rafaelw
7 years, 5 months ago (2013-07-13 18:16:33 UTC) #1
rossberg
LGTM with nit https://codereview.chromium.org/19132002/diff/1/src/object-observe.js File src/object-observe.js (right): https://codereview.chromium.org/19132002/diff/1/src/object-observe.js#newcode206 src/object-observe.js:206: function NormalizeCallback(callback) { Nit: Not sure ...
7 years, 5 months ago (2013-07-15 17:02:43 UTC) #2
rafaelw
https://codereview.chromium.org/19132002/diff/1/src/object-observe.js File src/object-observe.js (right): https://codereview.chromium.org/19132002/diff/1/src/object-observe.js#newcode206 src/object-observe.js:206: function NormalizeCallback(callback) { Agreed. I'd like to be explicit ...
7 years, 5 months ago (2013-07-15 19:13:11 UTC) #3
adamk
7 years, 5 months ago (2013-07-15 22:16:35 UTC) #4
Message was sent while issue was closed.
Committed patchset #2 manually as r15682 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698