Bug 1753633 part 5 - Move/fix a comment. r=iain
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 08 Feb 2022 15:23:36 +0000
changeset 607109 25fe67147f22bbbbc33afc8ad305957646787763
parent 607108 f64a89bf96817cd2796e6cc0bce11698e872c0fe
child 607110 e292f817731578b1709b8c1415342814d2adde93
push id157458
push userjdemooij@mozilla.com
push dateTue, 08 Feb 2022 16:33:12 +0000
treeherderautoland@250fa587c2b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersiain
bugs1753633
milestone99.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 1753633 part 5 - Move/fix a comment. r=iain Also use isInt instead of JSID_IS_INT while we're there. Differential Revision: https://phabricator.services.mozilla.com/D137852
js/src/vm/Watchtower.cpp
--- a/js/src/vm/Watchtower.cpp
+++ b/js/src/vm/Watchtower.cpp
@@ -50,20 +50,26 @@ static bool InvokeWatchtowerCallback(JSC
 
   RootedValue rval(cx);
   return JS_CallFunctionValue(cx, nullptr, funVal, HandleValueArray(argv),
                               &rval);
 }
 
 static bool ReshapeForShadowedProp(JSContext* cx, HandleNativeObject obj,
                                    HandleId id) {
+  // |obj| has been used as the prototype of another object. Check if we're
+  // shadowing a property on its proto chain. In this case we need to reshape
+  // that object for shape teleporting to work correctly.
+  //
+  // See also the 'Shape Teleporting Optimization' comment in jit/CacheIR.cpp.
+
   MOZ_ASSERT(obj->isUsedAsPrototype());
 
   // Lookups on integer ids cannot be cached through prototypes.
-  if (JSID_IS_INT(id)) {
+  if (id.isInt()) {
     return true;
   }
 
   RootedObject proto(cx, obj->staticPrototype());
   while (proto) {
     // Lookups will not be cached through non-native protos.
     if (!proto->is<NativeObject>()) {
       break;
@@ -79,21 +85,16 @@ static bool ReshapeForShadowedProp(JSCon
   return true;
 }
 
 // static
 bool Watchtower::watchPropertyAddSlow(JSContext* cx, HandleNativeObject obj,
                                       HandleId id) {
   MOZ_ASSERT(watchesPropertyAdd(obj));
 
-  // If |obj| is a prototype of another object, check if we're shadowing a
-  // property on its proto chain. In this case we need to reshape that object
-  // for shape teleporting to work correctly.
-  //
-  // See also the 'Shape Teleporting Optimization' comment in jit/CacheIR.cpp.
   if (obj->isUsedAsPrototype()) {
     if (!ReshapeForShadowedProp(cx, obj, id)) {
       return false;
     }
   }
 
   if (MOZ_UNLIKELY(obj->useWatchtowerTestingCallback())) {
     RootedValue val(cx, IdToValue(id));