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

Issue 5861006: Change Object.defineProperty to accept undefined as getters and setters and t... (Closed)

Created:
10 years ago by Rico
Modified:
9 years, 6 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

Change Object.defineProperty to accept undefined as getters and setters and to correctly accept overriding an accessor with a data property. In the past we only accepted functions as argument for setting an accessor. Since one should be able to set an accessor to undefined this had to be changed to take either. In addition, we did not lookup properties in the prototype chain, causing us to call the setter of an existing accessor up the prototype chain when trying to replace an existing accessor (that was not local) with a data property. Committed: http://code.google.com/p/v8/source/detail?r=6045

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 7

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+97 lines, -18 lines) Patch
M src/objects.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/objects.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/runtime.cc View 1 2 3 chunks +5 lines, -3 lines 0 comments Download
M src/v8natives.js View 1 2 2 chunks +5 lines, -3 lines 0 comments Download
M test/mjsunit/object-define-property.js View 1 2 10 chunks +9 lines, -10 lines 0 comments Download
A test/mjsunit/regress/regress-687.js View 1 2 1 chunk +75 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Rico
This fixes issue 687
10 years ago (2010-12-16 09:16:54 UTC) #1
Lasse Reichstein
LGTM http://codereview.chromium.org/5861006/diff/5001/src/runtime.cc File src/runtime.cc (right): http://codereview.chromium.org/5861006/diff/5001/src/runtime.cc#newcode3517 src/runtime.cc:3517: CONVERT_CHECKED(String, name, args[1]); This argument is not stored ...
10 years ago (2010-12-16 09:43:34 UTC) #2
Rico
10 years ago (2010-12-16 12:17:55 UTC) #3
http://codereview.chromium.org/5861006/diff/5001/src/runtime.cc
File src/runtime.cc (right):

http://codereview.chromium.org/5861006/diff/5001/src/runtime.cc#newcode3517
src/runtime.cc:3517: CONVERT_CHECKED(String, name, args[1]);
On 2010/12/16 09:43:34, Lasse Reichstein wrote:
> This argument is not stored in a handle, so why use a handle for fun?
> (In fact, this whole function seems like it should not use handles at all,
since
> it doesn't for most of its values).

Done.

http://codereview.chromium.org/5861006/diff/5001/src/v8natives.js
File src/v8natives.js (right):

http://codereview.chromium.org/5861006/diff/5001/src/v8natives.js#newcode626
src/v8natives.js:626: if (desc.hasGetter() &&
On 2010/12/16 09:43:34, Lasse Reichstein wrote:
> How about putting desc.getGet() in a variable (and ditto for desc.getSet()
> below). You are up to two or three uses of it by now.
Well, we don't know if desc has a getter, intuitively I would not like to have a
variable with a value that is not there (if you call getGet it will return
undefined even when there is no getter)

http://codereview.chromium.org/5861006/diff/5001/test/mjsunit/regress/regress...
File test/mjsunit/regress/regress-687.js (right):

http://codereview.chromium.org/5861006/diff/5001/test/mjsunit/regress/regress...
test/mjsunit/regress/regress-687.js:45: set value(v) {
Object.defineProperty(this, "value", {value: v}); }};
On 2010/12/16 09:43:34, Lasse Reichstein wrote:
> Indentation.

Done.

http://codereview.chromium.org/5861006/diff/5001/test/mjsunit/regress/regress...
test/mjsunit/regress/regress-687.js:75: 
Removed the rest of this test file, the stuff below was a regression test for
issue 992

Powered by Google App Engine
This is Rietveld 408576698