Bug 1521696 - Fix PropertyEmitter not to use JSOP_OBJECT when the objest has accessor. r=jorendorff a=lizzard
authorTooru Fujisawa <arai_a@mac.com>
Tue, 29 Jan 2019 22:26:24 +0000
changeset 499501 818b91df49bb72a0ee4a15c920f662d4fb2b2ea5
parent 499500 e7f9d4cd8d73341f0166a97dc988a6ff4ed6bae0
child 499502 2c323705bd256f820349aca73b5453d6849484fd
push idunknown
push userunknown
push dateunknown
reviewersjorendorff, lizzard
bugs1521696
milestone66.0
Bug 1521696 - Fix PropertyEmitter not to use JSOP_OBJECT when the objest has accessor. r=jorendorff a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D17471
js/src/frontend/ObjectEmitter.cpp
--- a/js/src/frontend/ObjectEmitter.cpp
+++ b/js/src/frontend/ObjectEmitter.cpp
@@ -288,58 +288,64 @@ bool PropertyEmitter::emitInitHomeObject
 bool PropertyEmitter::emitInitProp(
     JS::Handle<JSAtom*> key, bool isPropertyAnonFunctionOrClass /* = false */,
     JS::Handle<JSFunction*> anonFunction /* = nullptr */) {
   return emitInit(isClass_ ? JSOP_INITHIDDENPROP : JSOP_INITPROP, key,
                   isPropertyAnonFunctionOrClass, anonFunction);
 }
 
 bool PropertyEmitter::emitInitGetter(JS::Handle<JSAtom*> key) {
+  obj_ = nullptr;
   return emitInit(isClass_ ? JSOP_INITHIDDENPROP_GETTER : JSOP_INITPROP_GETTER,
                   key, false, nullptr);
 }
 
 bool PropertyEmitter::emitInitSetter(JS::Handle<JSAtom*> key) {
+  obj_ = nullptr;
   return emitInit(isClass_ ? JSOP_INITHIDDENPROP_SETTER : JSOP_INITPROP_SETTER,
                   key, false, nullptr);
 }
 
 bool PropertyEmitter::emitInitIndexProp(
     bool isPropertyAnonFunctionOrClass /* = false */) {
   return emitInitIndexOrComputed(isClass_ ? JSOP_INITHIDDENELEM : JSOP_INITELEM,
                                  FunctionPrefixKind::None,
                                  isPropertyAnonFunctionOrClass);
 }
 
 bool PropertyEmitter::emitInitIndexGetter() {
+  obj_ = nullptr;
   return emitInitIndexOrComputed(
       isClass_ ? JSOP_INITHIDDENELEM_GETTER : JSOP_INITELEM_GETTER,
       FunctionPrefixKind::Get, false);
 }
 
 bool PropertyEmitter::emitInitIndexSetter() {
+  obj_ = nullptr;
   return emitInitIndexOrComputed(
       isClass_ ? JSOP_INITHIDDENELEM_SETTER : JSOP_INITELEM_SETTER,
       FunctionPrefixKind::Set, false);
 }
 
 bool PropertyEmitter::emitInitComputedProp(
     bool isPropertyAnonFunctionOrClass /* = false */) {
   return emitInitIndexOrComputed(isClass_ ? JSOP_INITHIDDENELEM : JSOP_INITELEM,
                                  FunctionPrefixKind::None,
                                  isPropertyAnonFunctionOrClass);
 }
 
 bool PropertyEmitter::emitInitComputedGetter() {
+  obj_ = nullptr;
   return emitInitIndexOrComputed(
       isClass_ ? JSOP_INITHIDDENELEM_GETTER : JSOP_INITELEM_GETTER,
       FunctionPrefixKind::Get, true);
 }
 
 bool PropertyEmitter::emitInitComputedSetter() {
+  obj_ = nullptr;
   return emitInitIndexOrComputed(
       isClass_ ? JSOP_INITHIDDENELEM_SETTER : JSOP_INITELEM_SETTER,
       FunctionPrefixKind::Set, true);
 }
 
 bool PropertyEmitter::emitInit(JSOp op, JS::Handle<JSAtom*> key,
                                bool isPropertyAnonFunctionOrClass,
                                JS::Handle<JSFunction*> anonFunction) {