Skip to content

Commit

Permalink
Update SpiderMonkey to ESR115.9 (#459)
Browse files Browse the repository at this point in the history
* Remove obsolete patch

* Update SpiderMonkey

* Apply patches

* Update SM version info

* Update upgrading info
  • Loading branch information
sagudev committed Mar 20, 2024
1 parent 20f7934 commit b846d78
Show file tree
Hide file tree
Showing 325 changed files with 44,780 additions and 33,967 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ In order to upgrade to a new version of SpiderMonkey:

4. Run `python3 ./mozjs-sys/etc/update.py path/to/tarball`.

5. Update `mozjs-sys/etc/COMMIT` with the commit number.
5. Update `mozjs-sys/etc/COMMIT` with the commit number and mozjs-sys version with SpiderMonkey version.

6. Run `./mozjs/src/generate_wrappers.sh` to regenerate wrappers.

Expand Down
2 changes: 1 addition & 1 deletion mozjs-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mozjs_sys"
description = "System crate for the Mozilla SpiderMonkey JavaScript engine."
repository.workspace = true
version = "0.115.7-0"
version = "0.115.9-0"
authors = ["Mozilla"]
links = "mozjs"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion mozjs-sys/etc/COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9d63a16503940029057c683f9862e293716215d4
b1a9839f82305b18dfd3edc07e79fece06d7f3d1
2,491 changes: 0 additions & 2,491 deletions mozjs-sys/etc/patches/bug1857492.patch

This file was deleted.

12 changes: 12 additions & 0 deletions mozjs-sys/mozjs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified mozjs-sys/mozjs/build/pgo/certs/cert9.db
Binary file not shown.
Binary file modified mozjs-sys/mozjs/build/pgo/certs/key4.db
Binary file not shown.
Binary file modified mozjs-sys/mozjs/build/pgo/certs/mochitest.client
Binary file not shown.
Binary file modified mozjs-sys/mozjs/config/external/icu/data/icudt73l.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion mozjs-sys/mozjs/config/milestone.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------

115.7.0
115.9.0
13 changes: 11 additions & 2 deletions mozjs-sys/mozjs/js/src/builtin/intl/TimeZoneDataGenerated.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated by make_intl_data.py. DO NOT EDIT.
// tzdata version = 2023c
// tzdata version = 2024a

#ifndef builtin_intl_TimeZoneDataGenerated_h
#define builtin_intl_TimeZoneDataGenerated_h
Expand All @@ -22,8 +22,14 @@ const char* const ianaZonesTreatedAsLinksByICU[] = {
"America/Ensenada", // America/Tijuana [backzone]
"America/Indiana/Indianapolis", // America/Indianapolis [northamerica]
"America/Kentucky/Louisville", // America/Louisville [northamerica]
"America/Montreal", // America/Toronto [backzone]
"America/Nipigon", // America/Toronto [backzone]
"America/Nuuk", // America/Godthab [europe]
"America/Pangnirtung", // America/Iqaluit [backzone]
"America/Rainy_River", // America/Winnipeg [backzone]
"America/Rosario", // America/Cordoba [backzone]
"America/Thunder_Bay", // America/Toronto [backzone]
"America/Yellowknife", // America/Edmonton [backzone]
"Asia/Chongqing", // Asia/Shanghai [backzone]
"Asia/Harbin", // Asia/Shanghai [backzone]
"Asia/Ho_Chi_Minh", // Asia/Saigon [asia]
Expand All @@ -34,13 +40,17 @@ const char* const ianaZonesTreatedAsLinksByICU[] = {
"Asia/Yangon", // Asia/Rangoon [asia]
"Atlantic/Faroe", // Atlantic/Faeroe [europe]
"Atlantic/Jan_Mayen", // Arctic/Longyearbyen [backzone]
"Australia/Currie", // Australia/Hobart [backzone]
"EST", // Etc/GMT+5 [northamerica]
"Europe/Belfast", // Europe/London [backzone]
"Europe/Kyiv", // Europe/Kiev [europe]
"Europe/Tiraspol", // Europe/Chisinau [backzone]
"Europe/Uzhgorod", // Europe/Kiev [backzone]
"Europe/Zaporozhye", // Europe/Kiev [backzone]
"HST", // Etc/GMT+10 [northamerica]
"MST", // Etc/GMT+7 [northamerica]
"Pacific/Chuuk", // Pacific/Truk [backzone]
"Pacific/Johnston", // Pacific/Honolulu [backzone]
"Pacific/Kanton", // Pacific/Enderbury [australasia]
"Pacific/Pohnpei", // Pacific/Ponape [backzone]
};
Expand All @@ -67,7 +77,6 @@ const LinkAndTarget ianaLinksCanonicalizedDifferentlyByICU[] = {
{ "America/Lower_Princes", "America/Curacao" }, // America/Lower_Princes [backward]
{ "America/Marigot", "America/Port_of_Spain" }, // America/Marigot [backward]
{ "America/Mendoza", "America/Argentina/Mendoza" }, // America/Mendoza [backward]
{ "America/Santa_Isabel", "America/Tijuana" }, // America/Santa_Isabel [backward]
{ "America/St_Barthelemy", "America/Port_of_Spain" }, // America/St_Barthelemy [backward]
{ "Antarctica/South_Pole", "Antarctica/McMurdo" }, // Pacific/Auckland [backward]
{ "Arctic/Longyearbyen", "Europe/Oslo" }, // Arctic/Longyearbyen [backward]
Expand Down
8 changes: 7 additions & 1 deletion mozjs-sys/mozjs/js/src/jit/BaselineBailouts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class MOZ_STACK_CLASS BaselineStackBuilder {

BailoutKind bailoutKind_;

bool canUseTrialInlinedICScripts_ = true;

// The baseline frames we will reconstruct on the heap are not
// rooted, so GC must be suppressed.
gc::AutoSuppressGC suppress_;
Expand Down Expand Up @@ -486,7 +488,8 @@ void BaselineStackBuilder::setNextCallee(
JSFunction* nextCallee, TrialInliningState trialInliningState) {
nextCallee_ = nextCallee;

if (trialInliningState == TrialInliningState::Inlined) {
if (trialInliningState == TrialInliningState::Inlined &&
canUseTrialInlinedICScripts_) {
// Update icScript_ to point to the icScript of nextCallee
const uint32_t pcOff = script_->pcToOffset(pc_);
icScript_ = icScript_->findInlinedChild(pcOff);
Expand All @@ -496,6 +499,9 @@ void BaselineStackBuilder::setNextCallee(
// inlined ICScript available, but we also could not if we transitioned
// to TrialInliningState::Failure after being monomorphic inlined.
icScript_ = nextCallee->nonLazyScript()->jitScript()->icScript();
if (trialInliningState != TrialInliningState::MonomorphicInlined) {
canUseTrialInlinedICScripts_ = false;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions mozjs-sys/mozjs/js/src/jit/MacroAssembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2662,11 +2662,11 @@ void MacroAssembler::emitMegamorphicCachedSetSlot(
branchTest32(Assembler::Zero, scratch2, scratch2, &doAddDynamic);

AllocatableRegisterSet regs(RegisterSet::Volatile());
LiveRegisterSet save(regs.asLiveSet());
regs.takeUnchecked(scratch2);

LiveRegisterSet save(regs.asLiveSet());
PushRegsInMask(save);

regs.takeUnchecked(scratch2);
Register tmp;
if (regs.has(obj)) {
regs.takeUnchecked(obj);
Expand Down
26 changes: 15 additions & 11 deletions mozjs-sys/mozjs/js/src/jit/arm/MacroAssembler-arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4592,7 +4592,7 @@ void MacroAssembler::moveValue(const TypedOrValueRegister& src,
return;
}

ScratchFloat32Scope scratch(*this);
ScratchDoubleScope scratch(*this);
FloatRegister freg = reg.fpu();
if (type == MIRType::Float32) {
convertFloat32ToDouble(freg, scratch);
Expand Down Expand Up @@ -5843,11 +5843,13 @@ inline void EmitRemainderOrQuotient(bool isRemainder, MacroAssembler& masm,
masm.quotient32(rhs, lhsOutput, isUnsigned);
}
} else {
// Ensure that the output registers are saved and restored properly,
MOZ_ASSERT(volatileLiveRegs.has(ReturnRegVal0));
MOZ_ASSERT(volatileLiveRegs.has(ReturnRegVal1));
// Ensure that the output registers are saved and restored properly.
LiveRegisterSet liveRegs = volatileLiveRegs;
liveRegs.addUnchecked(ReturnRegVal0);
liveRegs.addUnchecked(ReturnRegVal1);

masm.PushRegsInMask(liveRegs);

masm.PushRegsInMask(volatileLiveRegs);
using Fn = int64_t (*)(int, int);
{
ScratchRegisterScope scratch(masm);
Expand All @@ -5870,7 +5872,7 @@ inline void EmitRemainderOrQuotient(bool isRemainder, MacroAssembler& masm,

LiveRegisterSet ignore;
ignore.add(lhsOutput);
masm.PopRegsInMaskIgnore(volatileLiveRegs, ignore);
masm.PopRegsInMaskIgnore(liveRegs, ignore);
}
}

Expand Down Expand Up @@ -5899,10 +5901,12 @@ void MacroAssembler::flexibleDivMod32(Register rhs, Register lhsOutput,
remainder32(rhs, remOutput, isUnsigned);
quotient32(rhs, lhsOutput, isUnsigned);
} else {
// Ensure that the output registers are saved and restored properly,
MOZ_ASSERT(volatileLiveRegs.has(ReturnRegVal0));
MOZ_ASSERT(volatileLiveRegs.has(ReturnRegVal1));
PushRegsInMask(volatileLiveRegs);
// Ensure that the output registers are saved and restored properly.
LiveRegisterSet liveRegs = volatileLiveRegs;
liveRegs.addUnchecked(ReturnRegVal0);
liveRegs.addUnchecked(ReturnRegVal1);

PushRegsInMask(liveRegs);

using Fn = int64_t (*)(int, int);
{
Expand All @@ -5923,7 +5927,7 @@ void MacroAssembler::flexibleDivMod32(Register rhs, Register lhsOutput,
LiveRegisterSet ignore;
ignore.add(remOutput);
ignore.add(lhsOutput);
PopRegsInMaskIgnore(volatileLiveRegs, ignore);
PopRegsInMaskIgnore(liveRegs, ignore);
}
}

Expand Down
18 changes: 5 additions & 13 deletions mozjs-sys/mozjs/mozglue/misc/RuntimeExceptionModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# include <werapi.h> // For WerRegisterRuntimeExceptionModule()
# include <stdlib.h>

# include "mozilla/mozalloc_oom.h"
# include "mozilla/Unused.h"

using mozilla::Unused;
Expand All @@ -31,12 +30,6 @@ namespace CrashReporter {

#ifdef XP_WIN

struct InProcessWindowsErrorReportingData {
uint32_t mProcessType;
size_t* mOOMAllocationSizePtr;
};

static InProcessWindowsErrorReportingData gInProcessWerData;
const static size_t kModulePathLength = MAX_PATH + 1;
static wchar_t sModulePath[kModulePathLength];

Expand Down Expand Up @@ -86,10 +79,9 @@ void RegisterRuntimeExceptionModule() {
return;
}

gInProcessWerData.mProcessType = mozilla::GetGeckoProcessType();
gInProcessWerData.mOOMAllocationSizePtr = &gOOMAllocationSize;
if (FAILED(::WerRegisterRuntimeExceptionModule(sModulePath,
&gInProcessWerData))) {
if (FAILED(::WerRegisterRuntimeExceptionModule(
sModulePath,
reinterpret_cast<PVOID>(mozilla::GetGeckoProcessType())))) {
// The registration failed null out sModulePath to record this.
*sModulePath = L'\0';
return;
Expand All @@ -101,8 +93,8 @@ void UnregisterRuntimeExceptionModule() {
#ifdef XP_WIN
// If sModulePath is set then we have registered the module.
if (*sModulePath) {
Unused << ::WerUnregisterRuntimeExceptionModule(sModulePath,
&gInProcessWerData);
Unused << ::WerUnregisterRuntimeExceptionModule(
sModulePath, reinterpret_cast<PVOID>(mozilla::GetGeckoProcessType()));
*sModulePath = L'\0';
}
#endif // XP_WIN
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

from fluent.migrate.helpers import transforms_from


def migrate(ctx):
"""Bug 1866295 - Land new strings for device migration ASRouter messages, part {index}."""

source = "browser/browser/newtab/asrouter.ftl"
target = source

ctx.add_transforms(
target,
target,
transforms_from(
"""
device-migration-fxa-spotlight-getting-new-device-primary-button = {COPY_PATTERN(from_path, "device-migration-fxa-spotlight-primary-button")}
""",
from_path=source,
),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

from fluent.migrate.helpers import transforms_from


def migrate(ctx):
"""Bug 1867346 - Replace a string for device migration ASRouter messages, part {index}."""

source = "browser/browser/newtab/asrouter.ftl"
target = source

ctx.add_transforms(
target,
target,
transforms_from(
"""
device-migration-fxa-spotlight-getting-new-device-header-2 = {COPY_PATTERN(from_path, "fxa-sync-cfr-header")}
""",
from_path=source,
),
)
8 changes: 5 additions & 3 deletions mozjs-sys/mozjs/python/mach/mach/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
import argparse
import codecs
import errno
import imp
import logging
import os
import sys
import traceback
import types
import uuid
from collections.abc import Iterable
from pathlib import Path
from typing import Dict, List, Union

from mozfile import load_source

from .base import (
CommandContext,
FailedCommandError,
Expand Down Expand Up @@ -267,13 +269,13 @@ def load_commands_from_file(self, path: Union[str, Path], module_name=None):
# Ensure parent module is present otherwise we'll (likely) get
# an error due to unknown parent.
if "mach.commands" not in sys.modules:
mod = imp.new_module("mach.commands")
mod = types.ModuleType("mach.commands")
sys.modules["mach.commands"] = mod

module_name = f"mach.commands.{uuid.uuid4().hex}"

try:
imp.load_source(module_name, str(path))
load_source(module_name, str(path))
except IOError as e:
if e.errno != errno.ENOENT:
raise
Expand Down
4 changes: 2 additions & 2 deletions mozjs-sys/mozjs/python/mach/mach/test/test_entry_point.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import imp
import sys
import types
from pathlib import Path
from unittest.mock import patch

Expand Down Expand Up @@ -38,7 +38,7 @@ def test_load_entry_point_from_directory(self, mock):
# Ensure parent module is present otherwise we'll (likely) get
# an error due to unknown parent.
if "mach.commands" not in sys.modules:
mod = imp.new_module("mach.commands")
mod = types.ModuleType("mach.commands")
sys.modules["mach.commands"] = mod

mock.return_value = [Entry([self.provider_dir])]
Expand Down
3 changes: 2 additions & 1 deletion mozjs-sys/mozjs/python/mozboot/mozboot/android-avds/arm.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"hw.lcd.density": "320",
"disk.dataPartition.size": "4000MB",
"sdcard.size": "600M"
}
},
"emulator_prewarm": false
}
7 changes: 0 additions & 7 deletions mozjs-sys/mozjs/python/mozboot/mozboot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@ def validate_environment(self):
to the user, if necessary.
"""

def suggest_install_distutils(self):
"""Called if distutils.{sysconfig,spawn} can't be imported."""
print(
"Does your distro require installing another package for distutils?",
file=sys.stderr,
)

def suggest_install_pip3(self):
"""Called if pip3 can't be found."""
print(
Expand Down
16 changes: 0 additions & 16 deletions mozjs-sys/mozjs/python/mozboot/mozboot/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,22 +491,6 @@ def _output_mozconfig(self, application, mozconfig_builder):

def _validate_python_environment(self, topsrcdir):
valid = True
try:
# distutils is singled out here because some distros (namely Ubuntu)
# include it in a separate package outside of the main Python
# installation.
import distutils.spawn
import distutils.sysconfig

assert distutils.sysconfig is not None and distutils.spawn is not None
except ImportError as e:
print("ERROR: Could not import package %s" % e.name, file=sys.stderr)
self.instance.suggest_install_distutils()
valid = False
except AssertionError:
print("ERROR: distutils is not behaving as expected.", file=sys.stderr)
self.instance.suggest_install_distutils()
valid = False
pip3 = to_optional_path(which("pip3"))
if not pip3:
print("ERROR: Could not find pip3.", file=sys.stderr)
Expand Down

0 comments on commit b846d78

Please sign in to comment.