Bug 1682767 part 20 - Remove unused group argument from StringSplitString. r=iain
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 04 Jan 2021 19:45:54 +0000
changeset 562000 c38229ecc9a40ab7f5a7c28950e90f1cc88bbe4a
parent 561999 cd28fb3ff9644596a311193be124b2351fb3966c
child 562001 b7097bb2492dd8b261910687f23e7bd8a737bacf
push id38079
push userncsoregi@mozilla.com
push dateTue, 05 Jan 2021 21:56:58 +0000
treeherdermozilla-central@bcfbf7c9d108 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersiain
bugs1682767
milestone86.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 1682767 part 20 - Remove unused group argument from StringSplitString. r=iain Depends on D100677 Differential Revision: https://phabricator.services.mozilla.com/D100678
js/src/builtin/String.cpp
js/src/builtin/String.h
js/src/jit/CacheIR.cpp
js/src/jit/CacheIRCompiler.cpp
js/src/jit/CacheIROps.yaml
js/src/jit/CodeGenerator.cpp
js/src/jit/MIR.h
js/src/jit/Recover.cpp
js/src/jit/WarpCacheIRTranspiler.cpp
js/src/vm/SelfHosting.cpp
--- a/js/src/builtin/String.cpp
+++ b/js/src/builtin/String.cpp
@@ -3519,20 +3519,18 @@ static ArrayObject* SplitSingleCharHelpe
                                  ch);
   }
 
   return SplitSingleCharHelper(cx, str, linearChars.twoByteChars(), strLength,
                                ch);
 }
 
 // ES 2016 draft Mar 25, 2016 21.1.3.17 steps 4, 8, 12-18.
-// TODO(no-TI): remove unused group argument.
-ArrayObject* js::StringSplitString(JSContext* cx, HandleObjectGroup group,
-                                   HandleString str, HandleString sep,
-                                   uint32_t limit) {
+ArrayObject* js::StringSplitString(JSContext* cx, HandleString str,
+                                   HandleString sep, uint32_t limit) {
   MOZ_ASSERT(limit > 0, "Only called for strictly positive limit.");
 
   RootedLinearString linearStr(cx, str->ensureLinear(cx));
   if (!linearStr) {
     return nullptr;
   }
 
   RootedLinearString linearSep(cx, sep->ensureLinear(cx));
--- a/js/src/builtin/String.h
+++ b/js/src/builtin/String.h
@@ -65,19 +65,18 @@ extern MOZ_MUST_USE bool intl_toLocaleLo
  * specific case mappings for the input locale.
  *
  * Usage: upperCase = intl_toLocaleUpperCase(string, locale)
  */
 extern MOZ_MUST_USE bool intl_toLocaleUpperCase(JSContext* cx, unsigned argc,
                                                 Value* vp);
 #endif
 
-ArrayObject* StringSplitString(JSContext* cx, Handle<ObjectGroup*> group,
-                               HandleString str, HandleString sep,
-                               uint32_t limit);
+ArrayObject* StringSplitString(JSContext* cx, HandleString str,
+                               HandleString sep, uint32_t limit);
 
 JSString* StringFlatReplaceString(JSContext* cx, HandleString string,
                                   HandleString pattern,
                                   HandleString replacement);
 
 JSString* str_replace_string_raw(JSContext* cx, HandleString string,
                                  HandleString pattern,
                                  HandleString replacement);
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -6000,34 +6000,28 @@ AttachDecision CallIRGenerator::tryAttac
 
 AttachDecision CallIRGenerator::tryAttachStringSplitString(
     HandleFunction callee) {
   // Self-hosted code calls this with (string, string) arguments.
   MOZ_ASSERT(argc_ == 2);
   MOZ_ASSERT(args_[0].isString());
   MOZ_ASSERT(args_[1].isString());
 
-  ObjectGroup* group = ObjectGroupRealm::getStringSplitStringGroup(cx_);
-  if (!group) {
-    cx_->clearPendingException();
-    return AttachDecision::NoAction;
-  }
-
   // Initialize the input operand.
   Int32OperandId argcId(writer.setInputOperandId(0));
 
   // Note: we don't need to call emitNativeCalleeGuard for intrinsics.
 
   ValOperandId arg0Id = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
   StringOperandId strId = writer.guardToString(arg0Id);
 
   ValOperandId arg1Id = writer.loadArgumentFixedSlot(ArgumentKind::Arg1, argc_);
   StringOperandId separatorId = writer.guardToString(arg1Id);
 
-  writer.stringSplitStringResult(strId, separatorId, group);
+  writer.stringSplitStringResult(strId, separatorId);
   writer.returnFromIC();
 
   trackAttached("StringSplitString");
   return AttachDecision::Attach;
 }
 
 AttachDecision CallIRGenerator::tryAttachStringChar(HandleFunction callee,
                                                     StringChar kind) {
--- a/js/src/jit/CacheIRCompiler.cpp
+++ b/js/src/jit/CacheIRCompiler.cpp
@@ -7092,37 +7092,30 @@ bool CacheIRCompiler::emitStringReplaceS
 
   using Fn =
       JSString* (*)(JSContext*, HandleString, HandleString, HandleString);
   callvm.call<Fn, jit::StringReplace>();
   return true;
 }
 
 bool CacheIRCompiler::emitStringSplitStringResult(StringOperandId strId,
-                                                  StringOperandId separatorId,
-                                                  uint32_t groupOffset) {
+                                                  StringOperandId separatorId) {
   JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
 
   AutoCallVM callvm(masm, this, allocator);
 
   Register str = allocator.useRegister(masm, strId);
   Register separator = allocator.useRegister(masm, separatorId);
-  AutoScratchRegister scratch(allocator, masm);
-
-  StubFieldOffset group(groupOffset, StubField::Type::ObjectGroup);
-  emitLoadStubField(group, scratch);
 
   callvm.prepare();
   masm.Push(Imm32(INT32_MAX));
   masm.Push(separator);
   masm.Push(str);
-  masm.Push(scratch);
-
-  using Fn = ArrayObject* (*)(JSContext*, HandleObjectGroup, HandleString,
-                              HandleString, uint32_t);
+
+  using Fn = ArrayObject* (*)(JSContext*, HandleString, HandleString, uint32_t);
   callvm.call<Fn, js::StringSplitString>();
   return true;
 }
 
 bool CacheIRCompiler::emitRegExpPrototypeOptimizableResult(
     ObjOperandId protoId) {
   JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
 
--- a/js/src/jit/CacheIROps.yaml
+++ b/js/src/jit/CacheIROps.yaml
@@ -319,17 +319,16 @@
 
 - name: StringSplitStringResult
   shared: true
   transpile: true
   cost_estimate: 5
   args:
     str: StringId
     separator: StringId
-    group: GroupField
 
 - name: RegExpPrototypeOptimizableResult
   shared: true
   transpile: true
   cost_estimate: 4
   args:
     proto: ObjId
 
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -10831,20 +10831,18 @@ void CodeGenerator::visitStringConvertCa
     callVM<Fn, js::StringToUpperCase>(lir);
   }
 }
 
 void CodeGenerator::visitStringSplit(LStringSplit* lir) {
   pushArg(Imm32(INT32_MAX));
   pushArg(ToRegister(lir->separator()));
   pushArg(ToRegister(lir->string()));
-  pushArg(ImmGCPtr(lir->mir()->group()));
-
-  using Fn = ArrayObject* (*)(JSContext*, HandleObjectGroup, HandleString,
-                              HandleString, uint32_t);
+
+  using Fn = ArrayObject* (*)(JSContext*, HandleString, HandleString, uint32_t);
   callVM<Fn, js::StringSplitString>(lir);
 }
 
 void CodeGenerator::visitInitializedLength(LInitializedLength* lir) {
   Address initLength(ToRegister(lir->elements()),
                      ObjectElements::offsetOfInitializedLength());
   masm.load32(initLength, ToRegister(lir->output()));
 }
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -6408,30 +6408,26 @@ class MStringConvertCase : public MUnary
   }
   AliasSet getAliasSet() const override { return AliasSet::None(); }
   bool possiblyCalls() const override { return true; }
   Mode mode() const { return mode_; }
 };
 
 class MStringSplit : public MBinaryInstruction,
                      public MixPolicy<StringPolicy<0>, StringPolicy<1>>::Data {
-  CompilerObjectGroup group_;
-
-  MStringSplit(TempAllocator& alloc, MDefinition* string, MDefinition* sep,
-               ObjectGroup* group)
-      : MBinaryInstruction(classOpcode, string, sep), group_(group) {
+  MStringSplit(TempAllocator& alloc, MDefinition* string, MDefinition* sep)
+      : MBinaryInstruction(classOpcode, string, sep) {
     setResultType(MIRType::Object);
   }
 
  public:
   INSTRUCTION_HEADER(StringSplit)
   TRIVIAL_NEW_WRAPPERS_WITH_ALLOC
   NAMED_OPERANDS((0, string), (1, separator))
 
-  ObjectGroup* group() const { return group_; }
   bool possiblyCalls() const override { return true; }
   virtual AliasSet getAliasSet() const override {
     // Although this instruction returns a new array, we don't have to mark
     // it as store instruction, see also MNewArray.
     return AliasSet::None();
   }
   [[nodiscard]] bool writeRecoverData(
       CompactBufferWriter& writer) const override;
--- a/js/src/jit/Recover.cpp
+++ b/js/src/jit/Recover.cpp
@@ -1299,29 +1299,23 @@ bool MStringSplit::writeRecoverData(Comp
   return true;
 }
 
 RStringSplit::RStringSplit(CompactBufferReader& reader) {}
 
 bool RStringSplit::recover(JSContext* cx, SnapshotIterator& iter) const {
   RootedString str(cx, iter.read().toString());
   RootedString sep(cx, iter.read().toString());
-  RootedObjectGroup group(cx, ObjectGroupRealm::getStringSplitStringGroup(cx));
-  if (!group) {
-    return false;
-  }
-  RootedValue result(cx);
 
-  JSObject* res = StringSplitString(cx, group, str, sep, INT32_MAX);
+  JSObject* res = StringSplitString(cx, str, sep, INT32_MAX);
   if (!res) {
     return false;
   }
 
-  result.setObject(*res);
-  iter.storeInstructionResult(result);
+  iter.storeInstructionResult(ObjectValue(*res));
   return true;
 }
 
 bool MNaNToZero::writeRecoverData(CompactBufferWriter& writer) const {
   MOZ_ASSERT(canRecoverOnBailout());
   writer.writeUnsigned(uint32_t(RInstruction::Recover_NaNToZero));
   return true;
 }
--- a/js/src/jit/WarpCacheIRTranspiler.cpp
+++ b/js/src/jit/WarpCacheIRTranspiler.cpp
@@ -3146,22 +3146,21 @@ bool WarpCacheIRTranspiler::emitStringRe
   auto* replace = MStringReplace::New(alloc(), str, pattern, replacement);
   add(replace);
 
   pushResult(replace);
   return true;
 }
 
 bool WarpCacheIRTranspiler::emitStringSplitStringResult(
-    StringOperandId strId, StringOperandId separatorId, uint32_t groupOffset) {
+    StringOperandId strId, StringOperandId separatorId) {
   MDefinition* str = getOperand(strId);
   MDefinition* separator = getOperand(separatorId);
-  ObjectGroup* group = groupStubField(groupOffset);
-
-  auto* split = MStringSplit::New(alloc(), str, separator, group);
+
+  auto* split = MStringSplit::New(alloc(), str, separator);
   add(split);
 
   pushResult(split);
   return true;
 }
 
 bool WarpCacheIRTranspiler::emitRegExpPrototypeOptimizableResult(
     ObjOperandId protoId) {
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -1604,22 +1604,17 @@ static bool intrinsic_StringReplaceAllSt
 static bool intrinsic_StringSplitString(JSContext* cx, unsigned argc,
                                         Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
   MOZ_ASSERT(args.length() == 2);
 
   RootedString string(cx, args[0].toString());
   RootedString sep(cx, args[1].toString());
 
-  RootedObjectGroup group(cx, ObjectGroupRealm::getStringSplitStringGroup(cx));
-  if (!group) {
-    return false;
-  }
-
-  JSObject* aobj = StringSplitString(cx, group, string, sep, INT32_MAX);
+  JSObject* aobj = StringSplitString(cx, string, sep, INT32_MAX);
   if (!aobj) {
     return false;
   }
 
   args.rval().setObject(*aobj);
   return true;
 }
 
@@ -1632,22 +1627,17 @@ static bool intrinsic_StringSplitStringL
   RootedString sep(cx, args[1].toString());
 
   // args[2] should be already in UInt32 range, but it could be double typed,
   // because of Ion optimization.
   uint32_t limit = uint32_t(args[2].toNumber());
   MOZ_ASSERT(limit > 0,
              "Zero limit case is already handled in self-hosted code.");
 
-  RootedObjectGroup group(cx, ObjectGroupRealm::getStringSplitStringGroup(cx));
-  if (!group) {
-    return false;
-  }
-
-  JSObject* aobj = StringSplitString(cx, group, string, sep, limit);
+  JSObject* aobj = StringSplitString(cx, string, sep, limit);
   if (!aobj) {
     return false;
   }
 
   args.rval().setObject(*aobj);
   return true;
 }