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

Issue 11477006: Object.observe: prevent observed objects from using fast elements. (Closed)

Created:
8 years ago by rossberg
Modified:
8 years ago
Reviewers:
Michael Starzinger
CC:
v8-dev, adamk, rafaelw
Visibility:
Public.

Description

Object.observe: prevent observed objects from using fast elements. This is necessary because polymorphic stores generally do not perform a map check but only an instance type check, which misses out on changes in the observation status. Unfortunately, there currently is no efficient way in V8 to maintain that optimisation in the presence of Object.observe. R=mstarzinger@chromium.org BUG=v8:2409 Committed: http://code.google.com/p/v8/source/detail?r=13205

Patch Set 1 #

Patch Set 2 : Tweaked comment #

Total comments: 4

Patch Set 3 : Addressed Michael's comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+100 lines, -1 line) Patch
M src/objects.cc View 4 chunks +6 lines, -0 lines 0 comments Download
M src/objects-inl.h View 1 chunk +7 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 chunk +7 lines, -0 lines 0 comments Download
M test/mjsunit/harmony/object-observe.js View 1 2 2 chunks +78 lines, -0 lines 0 comments Download
M test/mjsunit/regress/regress-observe-empty-double-array.js View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
rossberg
8 years ago (2012-12-11 13:42:16 UTC) #1
Michael Starzinger
LGTM. https://codereview.chromium.org/11477006/diff/3001/src/objects-inl.h File src/objects-inl.h (right): https://codereview.chromium.org/11477006/diff/3001/src/objects-inl.h#newcode1432 src/objects-inl.h:1432: if (IsJSArray()) JSArray::cast(this)->set_length(Smi::FromInt(0)); OMG, having to set the ...
8 years ago (2012-12-11 15:20:19 UTC) #2
rossberg
8 years ago (2012-12-11 15:29:35 UTC) #3
https://codereview.chromium.org/11477006/diff/3001/src/objects-inl.h
File src/objects-inl.h (right):

https://codereview.chromium.org/11477006/diff/3001/src/objects-inl.h#newcode1432
src/objects-inl.h:1432: if (IsJSArray())
JSArray::cast(this)->set_length(Smi::FromInt(0));
On 2012/12/11 15:20:19, Michael Starzinger wrote:
> OMG, having to set the JSArray length to 0 here is extremely ugly. But I guess
> it is the most local hack that achieves this.

Yeah, the whole "abstraction" we have here is bogus, if you ask me.

https://codereview.chromium.org/11477006/diff/3001/test/mjsunit/harmony/objec...
File test/mjsunit/harmony/object-observe.js (right):

https://codereview.chromium.org/11477006/diff/3001/test/mjsunit/harmony/objec...
test/mjsunit/harmony/object-observe.js:28: // Flags: --harmony-observation
--harmony-proxies --harmony-collections --allow-natives-syntax
On 2012/12/11 15:20:19, Michael Starzinger wrote:
> You can have multiple "// Flags:" lines and thereby get by with 80 characters
> per line.

Done.

Powered by Google App Engine
This is Rietveld 408576698