Ensure that JSProxy::Fix gives the generated JSObject map a constructor
authoradamk@chromium.org <adamk@chromium.org>
Wed, 27 Aug 2014 15:54:23 +0000 (15:54 +0000)
committeradamk@chromium.org <adamk@chromium.org>
Wed, 27 Aug 2014 15:54:23 +0000 (15:54 +0000)
commit71fbe7d4ec414238d768df48842480f1554b1d9b
tree4d2d6f6146f8d2dde7f0a5499a4e12a31f103c26
parent887ba6c13344b18dc45bfa434df9866fdc0f123e
Ensure that JSProxy::Fix gives the generated JSObject map a constructor

All JSObjects in V8 either have a map()->constructor() field or are
JSFunctions. JSProxy::Fix, however, was not enforcing this, and
Object.observe's use of JSObject::GetCreationContext() exposed this.

Note that this is not Object.observe-specific: the API call
v8::Object::CreationContext() also would have revealed this bug.

This patch chooses Object as a reasonable constructor to put on the
newly-fixed object's map. Note that this has no effect on the "constructor"
property in JS. In doing so, I've also tightened up the code underlying
JSProxy::Fix to only support JSObject and JSFunction as possible output
types.

BUG=405844
LOG=N
R=rossberg@chromium.org, verwaest@chromium.org

Review URL: https://codereview.chromium.org/505303004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23466 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
src/factory.cc
src/factory.h
test/mjsunit/harmony/regress/regress-405844.js [new file with mode: 0644]