Bug 1511891 part 4 - Move DefLexicalOperation from Interpreter-inl.h to Interpreter.cpp. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 11 Jan 2019 09:12:51 +0000
changeset 453458 8fccd1861a223be784a3cb3215ee341d9bacc5e6
parent 453457 452034cea923027f9db55730d5156210ff8e8ad6
child 453459 c6e9f5fd0ee7df11463b1bec4b795794752c8fd5
push id35357
push usernerli@mozilla.com
push dateFri, 11 Jan 2019 21:54:07 +0000
treeherdermozilla-central@0ce024c91511 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1511891
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511891 part 4 - Move DefLexicalOperation from Interpreter-inl.h to Interpreter.cpp. r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D13702
js/src/vm/Interpreter-inl.h
js/src/vm/Interpreter.cpp
js/src/vm/Interpreter.h
--- a/js/src/vm/Interpreter-inl.h
+++ b/js/src/vm/Interpreter-inl.h
@@ -346,48 +346,16 @@ inline bool SetNameOperation(JSContext* 
     MOZ_ASSERT(!varobj->getOpsSetProperty());
     ok = NativeSetProperty<Unqualified>(cx, varobj, id, val, receiver, result);
   } else {
     ok = SetProperty(cx, env, id, val, receiver, result);
   }
   return ok && result.checkStrictErrorOrWarning(cx, env, id, strict);
 }
 
-inline bool DefLexicalOperation(JSContext* cx,
-                                Handle<LexicalEnvironmentObject*> lexicalEnv,
-                                HandleObject varObj, HandlePropertyName name,
-                                unsigned attrs) {
-  // Redeclaration checks should have already been done.
-  MOZ_ASSERT(CheckLexicalNameConflict(cx, lexicalEnv, varObj, name));
-  RootedId id(cx, NameToId(name));
-  RootedValue uninitialized(cx, MagicValue(JS_UNINITIALIZED_LEXICAL));
-  return NativeDefineDataProperty(cx, lexicalEnv, id, uninitialized, attrs);
-}
-
-inline bool DefLexicalOperation(JSContext* cx,
-                                LexicalEnvironmentObject* lexicalEnvArg,
-                                JSObject* varObjArg, JSScript* script,
-                                jsbytecode* pc) {
-  MOZ_ASSERT(*pc == JSOP_DEFLET || *pc == JSOP_DEFCONST);
-  RootedPropertyName name(cx, script->getName(pc));
-
-  unsigned attrs = JSPROP_ENUMERATE | JSPROP_PERMANENT;
-  if (*pc == JSOP_DEFCONST) {
-    attrs |= JSPROP_READONLY;
-  }
-
-  Rooted<LexicalEnvironmentObject*> lexicalEnv(cx, lexicalEnvArg);
-  RootedObject varObj(cx, varObjArg);
-  MOZ_ASSERT_IF(!script->hasNonSyntacticScope(),
-                lexicalEnv == &cx->global()->lexicalEnvironment() &&
-                    varObj == cx->global());
-
-  return DefLexicalOperation(cx, lexicalEnv, varObj, name, attrs);
-}
-
 inline void InitGlobalLexicalOperation(JSContext* cx,
                                        LexicalEnvironmentObject* lexicalEnvArg,
                                        JSScript* script, jsbytecode* pc,
                                        HandleValue value) {
   MOZ_ASSERT_IF(!script->hasNonSyntacticScope(),
                 lexicalEnvArg == &cx->global()->lexicalEnvironment());
   MOZ_ASSERT(*pc == JSOP_INITGLEXICAL);
   Rooted<LexicalEnvironmentObject*> lexicalEnv(cx, lexicalEnvArg);
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -4625,16 +4625,48 @@ bool js::DefVarOperation(JSContext* cx, 
     if (!varobj->as<GlobalObject>().realm()->addToVarNames(cx, name)) {
       return false;
     }
   }
 
   return true;
 }
 
+bool js::DefLexicalOperation(JSContext* cx,
+                             Handle<LexicalEnvironmentObject*> lexicalEnv,
+                             HandleObject varObj, HandlePropertyName name,
+                             unsigned attrs) {
+  // Redeclaration checks should have already been done.
+  MOZ_ASSERT(CheckLexicalNameConflict(cx, lexicalEnv, varObj, name));
+  RootedId id(cx, NameToId(name));
+  RootedValue uninitialized(cx, MagicValue(JS_UNINITIALIZED_LEXICAL));
+  return NativeDefineDataProperty(cx, lexicalEnv, id, uninitialized, attrs);
+}
+
+bool js::DefLexicalOperation(JSContext* cx,
+                             LexicalEnvironmentObject* lexicalEnvArg,
+                             JSObject* varObjArg, JSScript* script,
+                             jsbytecode* pc) {
+  MOZ_ASSERT(*pc == JSOP_DEFLET || *pc == JSOP_DEFCONST);
+  RootedPropertyName name(cx, script->getName(pc));
+
+  unsigned attrs = JSPROP_ENUMERATE | JSPROP_PERMANENT;
+  if (*pc == JSOP_DEFCONST) {
+    attrs |= JSPROP_READONLY;
+  }
+
+  Rooted<LexicalEnvironmentObject*> lexicalEnv(cx, lexicalEnvArg);
+  RootedObject varObj(cx, varObjArg);
+  MOZ_ASSERT_IF(!script->hasNonSyntacticScope(),
+                lexicalEnv == &cx->global()->lexicalEnvironment() &&
+                    varObj == cx->global());
+
+  return DefLexicalOperation(cx, lexicalEnv, varObj, name, attrs);
+}
+
 bool js::DefFunOperation(JSContext* cx, HandleScript script,
                          HandleObject envChain, HandleFunction fun) {
   /*
    * We define the function as a property of the variable object and not the
    * current scope chain even for the case of function expression statements
    * and functions defined by eval inside let or with blocks.
    */
   RootedObject parent(cx, envChain);
--- a/js/src/vm/Interpreter.h
+++ b/js/src/vm/Interpreter.h
@@ -444,16 +444,26 @@ template <bool strict>
 bool DeleteElementJit(JSContext* cx, HandleValue val, HandleValue index,
                       bool* bv);
 
 JSObject* BindVarOperation(JSContext* cx, JSObject* envChain);
 
 bool DefVarOperation(JSContext* cx, HandleObject envChain, HandleScript script,
                      jsbytecode* pc);
 
+bool DefLexicalOperation(JSContext* cx,
+                         Handle<LexicalEnvironmentObject*> lexicalEnv,
+                         HandleObject varObj, HandlePropertyName name,
+                         unsigned attrs);
+
+bool DefLexicalOperation(JSContext* cx,
+                         LexicalEnvironmentObject* lexicalEnvArg,
+                         JSObject* varObjArg, JSScript* script,
+                         jsbytecode* pc);
+
 bool DefFunOperation(JSContext* cx, HandleScript script, HandleObject envChain,
                      HandleFunction funArg);
 
 bool ThrowMsgOperation(JSContext* cx, const unsigned errorNum);
 
 bool GetAndClearException(JSContext* cx, MutableHandleValue res);
 
 bool DeleteNameOperation(JSContext* cx, HandlePropertyName name,