mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #3049 - loongarch64: drop inert minimal JIT path
This commit is contained in:
parent
1b904254ce
commit
71c63cd70f
10 changed files with 6 additions and 2012 deletions
|
|
@ -290,19 +290,14 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */)
|
|||
}
|
||||
|
||||
// Context options.
|
||||
bool useAsmJS = GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs"));
|
||||
bool useWasm = GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm"));
|
||||
bool useIon = GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion"));
|
||||
bool useNativeRegExp = GetWorkerPref<bool>(NS_LITERAL_CSTRING("native_regexp"));
|
||||
|
||||
JS::ContextOptions contextOptions;
|
||||
contextOptions.setAsmJS(useAsmJS)
|
||||
.setWasm(useWasm)
|
||||
contextOptions.setAsmJS(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs")))
|
||||
.setWasm(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm")))
|
||||
.setThrowOnAsmJSValidationFailure(GetWorkerPref<bool>(
|
||||
NS_LITERAL_CSTRING("throw_on_asmjs_validation_failure")))
|
||||
.setBaseline(GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit")))
|
||||
.setIon(useIon)
|
||||
.setNativeRegExp(useNativeRegExp)
|
||||
.setIon(GetWorkerPref<bool>(NS_LITERAL_CSTRING("ion")))
|
||||
.setNativeRegExp(GetWorkerPref<bool>(NS_LITERAL_CSTRING("native_regexp")))
|
||||
.setAsyncStack(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asyncstack")))
|
||||
.setWerror(GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror")))
|
||||
.setStreams(GetWorkerPref<bool>(NS_LITERAL_CSTRING("streams")))
|
||||
|
|
|
|||
|
|
@ -1251,7 +1251,7 @@ SampleChars(FrequencyCollator* collator, const CharT* chars, size_t length)
|
|||
static bool
|
||||
IsNativeRegExpEnabled(JSContext* cx)
|
||||
{
|
||||
#if defined(JS_CODEGEN_NONE)
|
||||
#ifdef JS_CODEGEN_NONE
|
||||
return false;
|
||||
#else
|
||||
return cx->options().nativeRegExp();
|
||||
|
|
|
|||
|
|
@ -1,376 +0,0 @@
|
|||
function add(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
function withLocal(a, b) {
|
||||
var c = a + b;
|
||||
var d = c - 1;
|
||||
return d + 1;
|
||||
}
|
||||
|
||||
function addEight(a, b, c, d, e, f, g, h) {
|
||||
return a + b + c + d + e + f + g + h;
|
||||
}
|
||||
|
||||
function assignSixthArg(a, b, c, d, e, f) {
|
||||
f = a + e;
|
||||
return f;
|
||||
}
|
||||
|
||||
function overflow(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
function unsupported(a, b) {
|
||||
return a + (b + 0.5);
|
||||
}
|
||||
|
||||
function largeResult(a) {
|
||||
return a + 300;
|
||||
}
|
||||
|
||||
function negativeResult(a) {
|
||||
return a - 300;
|
||||
}
|
||||
|
||||
function lessThan(a, b) {
|
||||
return a < b;
|
||||
}
|
||||
|
||||
function lessEqual(a, b) {
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
function greaterThan(a, b) {
|
||||
return a > b;
|
||||
}
|
||||
|
||||
function greaterEqual(a, b) {
|
||||
return a >= b;
|
||||
}
|
||||
|
||||
function notLess(a, b) {
|
||||
return !(a < b);
|
||||
}
|
||||
|
||||
function boolStrictEq(a, b) {
|
||||
return (a < b) === (b > a);
|
||||
}
|
||||
|
||||
function strictBoolIntEq(a, b) {
|
||||
return (a < b) === 1;
|
||||
}
|
||||
|
||||
function strictBoolIntNe(a, b) {
|
||||
return (a < b) !== 1;
|
||||
}
|
||||
|
||||
function boolLooseEq(a, b) {
|
||||
return (a < b) == 1;
|
||||
}
|
||||
|
||||
function boolLooseNe(a, b) {
|
||||
return (a < b) != 1;
|
||||
}
|
||||
|
||||
function bitMix(a, b) {
|
||||
return (a & b) ^ (a | 8);
|
||||
}
|
||||
|
||||
function invertBits(a) {
|
||||
return ~a;
|
||||
}
|
||||
|
||||
function negate(a) {
|
||||
return -a;
|
||||
}
|
||||
|
||||
function leftShift(a, b) {
|
||||
return a << b;
|
||||
}
|
||||
|
||||
function rightShift(a, b) {
|
||||
return a >> b;
|
||||
}
|
||||
|
||||
function unsignedRightShift(a, b) {
|
||||
return a >>> b;
|
||||
}
|
||||
|
||||
function multiply(a, b) {
|
||||
return a * b;
|
||||
}
|
||||
|
||||
function multiplyZero(a) {
|
||||
return a * 0;
|
||||
}
|
||||
|
||||
function divide(a, b) {
|
||||
return a / b;
|
||||
}
|
||||
|
||||
function divideNegativeZero(a) {
|
||||
return 0 / a;
|
||||
}
|
||||
|
||||
function remainder(a, b) {
|
||||
return a % b;
|
||||
}
|
||||
|
||||
function remainderNegativeZero(a) {
|
||||
return a % 2;
|
||||
}
|
||||
|
||||
function uint16Const() {
|
||||
return 50000;
|
||||
}
|
||||
|
||||
function uint24Const() {
|
||||
return 70000;
|
||||
}
|
||||
|
||||
function popMany(a, b) {
|
||||
return (a + 1, b + 2, a + 3, b + 4, a + b);
|
||||
}
|
||||
|
||||
function assignArg(a, b) {
|
||||
a = a < b;
|
||||
return a;
|
||||
}
|
||||
|
||||
function boolToNumeric(a, b) {
|
||||
var flag = a < b;
|
||||
return +flag;
|
||||
}
|
||||
|
||||
function nullValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function voidValue(a) {
|
||||
return void a;
|
||||
}
|
||||
|
||||
function unsetLocal() {
|
||||
var x;
|
||||
return x;
|
||||
}
|
||||
|
||||
function unsetLooseEqNull() {
|
||||
var x;
|
||||
return x == null;
|
||||
}
|
||||
|
||||
function conditional(a, b) {
|
||||
if (a < b)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function logicalOr(a, b) {
|
||||
return a || b;
|
||||
}
|
||||
|
||||
function logicalAnd(a, b) {
|
||||
return a && b;
|
||||
}
|
||||
|
||||
function logicalBoolOr(a, b) {
|
||||
return (a < b) || (b < a);
|
||||
}
|
||||
|
||||
function logicalBoolAnd(a, b) {
|
||||
return (a < b) && (b < 10);
|
||||
}
|
||||
|
||||
function minValue(a, b) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
function chooseOrder(a, b) {
|
||||
return a < b ? true : false;
|
||||
}
|
||||
|
||||
function sumRange(n) {
|
||||
var i = 0;
|
||||
var total = 0;
|
||||
while (i < n) {
|
||||
total = total + i;
|
||||
i = i + 1;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
function coalesceArg(a) {
|
||||
return a ?? 9;
|
||||
}
|
||||
|
||||
function coalesceLocal() {
|
||||
var x;
|
||||
return x ?? 5;
|
||||
}
|
||||
|
||||
function coalesceNull() {
|
||||
return null ?? 5;
|
||||
}
|
||||
|
||||
function sparseSwitchValue(a) {
|
||||
var out = -1;
|
||||
switch (a) {
|
||||
case 1:
|
||||
out = 10;
|
||||
break;
|
||||
case 4:
|
||||
out = 40;
|
||||
break;
|
||||
default:
|
||||
out = 99;
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function denseSwitchValue(a) {
|
||||
var out = -1;
|
||||
switch (a) {
|
||||
case 0:
|
||||
out = 7;
|
||||
break;
|
||||
case 1:
|
||||
out = 8;
|
||||
break;
|
||||
case 2:
|
||||
out = 9;
|
||||
break;
|
||||
default:
|
||||
out = 11;
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function groupedSwitchValue(a) {
|
||||
var out = 0;
|
||||
switch (a) {
|
||||
case 0:
|
||||
case 1:
|
||||
out = 10;
|
||||
break;
|
||||
case 3:
|
||||
out = 30;
|
||||
default:
|
||||
out = out + 1;
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
for (var i = 0; i < 100; i++) {
|
||||
assertEq(add(i, i + 1), (i + i + 1));
|
||||
assertEq(withLocal(i, 7), i + 7);
|
||||
assertEq(addEight(i, 1, 2, 3, 4, 5, 6, 7), i + 28);
|
||||
}
|
||||
|
||||
assertEq(assignSixthArg(2, 0, 0, 0, 5, 99), 7);
|
||||
assertEq(assignSixthArg(-3, 0, 0, 0, 8, 11), 5);
|
||||
|
||||
assertEq(overflow(2147483647, 1), 2147483648);
|
||||
assertEq(unsupported(2, 3), 5.5);
|
||||
assertEq(largeResult(7), 307);
|
||||
assertEq(negativeResult(7), -293);
|
||||
assertEq(lessThan(2, 3), true);
|
||||
assertEq(lessThan(3, 2), false);
|
||||
assertEq(lessEqual(3, 3), true);
|
||||
assertEq(lessEqual(4, 3), false);
|
||||
assertEq(greaterThan(4, 3), true);
|
||||
assertEq(greaterThan(2, 3), false);
|
||||
assertEq(greaterEqual(4, 4), true);
|
||||
assertEq(greaterEqual(2, 3), false);
|
||||
assertEq(notLess(2, 3), false);
|
||||
assertEq(notLess(3, 2), true);
|
||||
assertEq(boolStrictEq(2, 3), true);
|
||||
assertEq(boolStrictEq(3, 2), true);
|
||||
assertEq(strictBoolIntEq(2, 3), false);
|
||||
assertEq(strictBoolIntEq(3, 2), false);
|
||||
assertEq(strictBoolIntNe(2, 3), true);
|
||||
assertEq(strictBoolIntNe(3, 2), true);
|
||||
assertEq(boolLooseEq(2, 3), true);
|
||||
assertEq(boolLooseEq(3, 2), false);
|
||||
assertEq(boolLooseNe(2, 3), false);
|
||||
assertEq(boolLooseNe(3, 2), true);
|
||||
assertEq(bitMix(6, 3), (6 & 3) ^ (6 | 8));
|
||||
assertEq(invertBits(6), ~6);
|
||||
assertEq(negate(3), -3);
|
||||
assertEq(negate(-4), 4);
|
||||
assertEq(1 / negate(0), -Infinity);
|
||||
assertEq(negate(-2147483648), 2147483648);
|
||||
assertEq(leftShift(3, 2), 12);
|
||||
assertEq(leftShift(1, 33), 2);
|
||||
assertEq(rightShift(-8, 1), -4);
|
||||
assertEq(unsignedRightShift(-1, 1), 2147483647);
|
||||
assertEq(unsignedRightShift(-1, 0), 4294967295);
|
||||
assertEq(multiply(6, 7), 42);
|
||||
assertEq(multiply(-3, 7), -21);
|
||||
assertEq(multiply(1073741824, 4), 4294967296);
|
||||
assertEq(multiplyZero(3), 0);
|
||||
assertEq(1 / multiplyZero(-3), -Infinity);
|
||||
assertEq(divide(8, 2), 4);
|
||||
assertEq(divide(-9, 3), -3);
|
||||
assertEq(divide(7, 2), 3.5);
|
||||
assertEq(1 / divideNegativeZero(-3), -Infinity);
|
||||
assertEq(divide(-2147483648, -1), 2147483648);
|
||||
assertEq(remainder(7, 3), 1);
|
||||
assertEq(remainder(8, 2), 0);
|
||||
assertEq(1 / remainderNegativeZero(-4), -Infinity);
|
||||
assertEq(uint16Const(), 50000);
|
||||
assertEq(uint24Const(), 70000);
|
||||
assertEq(popMany(3, 4), 7);
|
||||
assertEq(assignArg(2, 3), true);
|
||||
assertEq(assignArg(3, 2), false);
|
||||
assertEq(boolToNumeric(2, 3), 1);
|
||||
assertEq(boolToNumeric(3, 2), 0);
|
||||
assertEq(nullValue(), null);
|
||||
assertEq(voidValue(7), undefined);
|
||||
assertEq(unsetLocal(), undefined);
|
||||
assertEq(unsetLooseEqNull(), true);
|
||||
assertEq(conditional(2, 3), true);
|
||||
assertEq(conditional(3, 2), false);
|
||||
assertEq(logicalOr(0, 7), 7);
|
||||
assertEq(logicalOr(5, 7), 5);
|
||||
assertEq(logicalAnd(0, 7), 0);
|
||||
assertEq(logicalAnd(5, 7), 7);
|
||||
assertEq(logicalBoolOr(2, 3), true);
|
||||
assertEq(logicalBoolOr(3, 3), false);
|
||||
assertEq(logicalBoolAnd(2, 3), true);
|
||||
assertEq(logicalBoolAnd(3, 2), false);
|
||||
assertEq(minValue(2, 3), 2);
|
||||
assertEq(minValue(5, 1), 1);
|
||||
assertEq(chooseOrder(2, 3), true);
|
||||
assertEq(chooseOrder(3, 2), false);
|
||||
assertEq(sumRange(0), 0);
|
||||
assertEq(sumRange(5), 10);
|
||||
assertEq(coalesceArg(0), 0);
|
||||
assertEq(coalesceArg(7), 7);
|
||||
assertEq(coalesceLocal(), 5);
|
||||
assertEq(coalesceNull(), 5);
|
||||
assertEq(sparseSwitchValue(1), 10);
|
||||
assertEq(sparseSwitchValue(4), 40);
|
||||
assertEq(sparseSwitchValue(2), 99);
|
||||
assertEq(denseSwitchValue(0), 7);
|
||||
assertEq(denseSwitchValue(1), 8);
|
||||
assertEq(denseSwitchValue(2), 9);
|
||||
assertEq(denseSwitchValue(5), 11);
|
||||
assertEq(groupedSwitchValue(0), 10);
|
||||
assertEq(groupedSwitchValue(1), 10);
|
||||
assertEq(groupedSwitchValue(3), 31);
|
||||
assertEq(groupedSwitchValue(5), 1);
|
||||
|
||||
(function testPropertyWrappers() {
|
||||
function getX(obj) { return obj.x; }
|
||||
function setX(obj, value) { return obj.x = value; }
|
||||
|
||||
var obj = { x: 7 };
|
||||
assertEq(getX(obj), 7);
|
||||
assertEq(setX(obj, 42), 42);
|
||||
assertEq(obj.x, 42);
|
||||
})();
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,24 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* 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/. */
|
||||
|
||||
#ifndef jit_LoongArchMinimalJit_h
|
||||
#define jit_LoongArchMinimalJit_h
|
||||
|
||||
#include "jspubtd.h"
|
||||
#include "js/CallArgs.h"
|
||||
|
||||
namespace js {
|
||||
|
||||
class RunState;
|
||||
|
||||
namespace jit {
|
||||
|
||||
[[nodiscard]] bool TryEnterLoongArchMinimalJit(JSContext* cx, RunState& state);
|
||||
[[nodiscard]] bool TryCallLoongArchMinimalJit(JSContext* cx, HandleFunction fun, const CallArgs& args, bool* handled);
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
#endif /* jit_LoongArchMinimalJit_h */
|
||||
|
|
@ -38,7 +38,6 @@
|
|||
#include "frontend/SharedContext.h"
|
||||
#include "gc/Marking.h"
|
||||
#include "jit/BaselineJIT.h"
|
||||
#include "jit/ProcessExecutableMemory.h"
|
||||
#include "jit/Ion.h"
|
||||
#include "jit/IonCode.h"
|
||||
#include "js/MemoryMetrics.h"
|
||||
|
|
@ -3106,9 +3105,6 @@ JSScript::finalize(FreeOp* fop)
|
|||
|
||||
jit::DestroyJitScripts(fop, this);
|
||||
|
||||
if (loongArchMinimalJitCode_)
|
||||
jit::DeallocateExecutableMemory(loongArchMinimalJitCode_, loongArchMinimalJitCodeSize_);
|
||||
|
||||
destroyScriptCounts(fop);
|
||||
destroyDebugScript(fop);
|
||||
|
||||
|
|
|
|||
|
|
@ -921,18 +921,9 @@ class JSScript : public js::gc::TenuredCell
|
|||
*/
|
||||
uint8_t* baselineOrIonRaw;
|
||||
uint8_t* baselineOrIonSkipArgCheck;
|
||||
uint8_t* loongArchMinimalJitCode_;
|
||||
|
||||
uint8_t loongArchMinimalFastPathKind_;
|
||||
uint8_t loongArchMinimalFastPathObjectArg_;
|
||||
uint8_t loongArchMinimalFastPathValueArg_;
|
||||
uint8_t loongArchMinimalFastPathReserved_;
|
||||
|
||||
// 32-bit fields.
|
||||
|
||||
uint32_t loongArchMinimalJitCodeSize_;
|
||||
uint32_t loongArchMinimalFastPathOffset_;
|
||||
|
||||
uint32_t dataSize_; /* size of the used part of the data array */
|
||||
|
||||
uint32_t lineno_; /* base line number of script */
|
||||
|
|
@ -1600,34 +1591,6 @@ class JSScript : public js::gc::TenuredCell
|
|||
static size_t offsetOfBaselineOrIonSkipArgCheck() {
|
||||
return offsetof(JSScript, baselineOrIonSkipArgCheck);
|
||||
}
|
||||
uint8_t* loongArchMinimalJitCodeRaw() const {
|
||||
return loongArchMinimalJitCode_;
|
||||
}
|
||||
uint32_t loongArchMinimalJitCodeSize() const {
|
||||
return loongArchMinimalJitCodeSize_;
|
||||
}
|
||||
void setLoongArchMinimalJitCode(uint8_t* code, uint32_t size) {
|
||||
loongArchMinimalJitCode_ = code;
|
||||
loongArchMinimalJitCodeSize_ = size;
|
||||
}
|
||||
uint8_t loongArchMinimalFastPathKind() const {
|
||||
return loongArchMinimalFastPathKind_;
|
||||
}
|
||||
uint8_t loongArchMinimalFastPathObjectArg() const {
|
||||
return loongArchMinimalFastPathObjectArg_;
|
||||
}
|
||||
uint8_t loongArchMinimalFastPathValueArg() const {
|
||||
return loongArchMinimalFastPathValueArg_;
|
||||
}
|
||||
uint32_t loongArchMinimalFastPathOffset() const {
|
||||
return loongArchMinimalFastPathOffset_;
|
||||
}
|
||||
void setLoongArchMinimalFastPath(uint8_t kind, uint8_t objectArg, uint8_t valueArg, uint32_t offset) {
|
||||
loongArchMinimalFastPathKind_ = kind;
|
||||
loongArchMinimalFastPathObjectArg_ = objectArg;
|
||||
loongArchMinimalFastPathValueArg_ = valueArg;
|
||||
loongArchMinimalFastPathOffset_ = offset;
|
||||
}
|
||||
|
||||
bool isRelazifiable() const {
|
||||
return (selfHosted() || lazyScript) && !hasInnerFunctions_ && !types_ &&
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ main_deunified_sources = [
|
|||
'jit/LICM.cpp',
|
||||
'jit/Linker.cpp',
|
||||
'jit/LIR.cpp',
|
||||
'jit/LoongArchMinimalJit.cpp',
|
||||
'jit/LoopUnroller.cpp',
|
||||
'jit/Lowering.cpp',
|
||||
'jit/MacroAssembler.cpp',
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "jit/BaselineJIT.h"
|
||||
#include "jit/Ion.h"
|
||||
#include "jit/IonAnalysis.h"
|
||||
#include "jit/LoongArchMinimalJit.h"
|
||||
#include "vm/AsyncFunction.h"
|
||||
#include "vm/AsyncIteration.h"
|
||||
#include "vm/BigIntType.h"
|
||||
|
|
@ -401,9 +400,6 @@ js::RunScript(JSContext* cx, RunState& state)
|
|||
if (jit::TryEnterLoongArchMinimalJit(cx, state))
|
||||
return true;
|
||||
|
||||
if (jit::TryEnterLoongArchMinimalJit(cx, state))
|
||||
return true;
|
||||
|
||||
if (jit::IsIonEnabled(cx)) {
|
||||
jit::MethodStatus status = jit::CanEnter(cx, state);
|
||||
if (status == jit::Method_Error)
|
||||
|
|
@ -503,14 +499,6 @@ js::InternalCallOrConstruct(JSContext* cx, const CallArgs& args, MaybeConstruct
|
|||
if (!JSFunction::getOrCreateScript(cx, fun))
|
||||
return false;
|
||||
|
||||
if (construct != CONSTRUCT) {
|
||||
bool handled;
|
||||
if (!jit::TryCallLoongArchMinimalJit(cx, fun, args, &handled))
|
||||
return false;
|
||||
if (handled)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Run function until JSOP_RETRVAL, JSOP_RETURN or error. */
|
||||
InvokeState state(cx, args, construct);
|
||||
|
||||
|
|
|
|||
|
|
@ -1264,6 +1264,7 @@ pref("javascript.options.strict.debug", false);
|
|||
pref("javascript.options.unboxed_objects", false);
|
||||
pref("javascript.options.baselinejit", true);
|
||||
pref("javascript.options.ion", true);
|
||||
pref("javascript.options.ion.inlining", true);
|
||||
// JIT warm-up thresholds (-1 keeps engine defaults).
|
||||
// Lower values can improve sustained throughput on large script bundles
|
||||
// (e.g. React/jQuery-heavy apps) at some startup compile cost.
|
||||
|
|
@ -1271,7 +1272,6 @@ pref("javascript.options.baselinejit.threshold", 6);
|
|||
pref("javascript.options.ion.threshold", 50);
|
||||
pref("javascript.options.asmjs", true);
|
||||
pref("javascript.options.wasm", true);
|
||||
pref("javascript.options.ion.inlining", true);
|
||||
// wasm jit crashes in 32bit builds because of 64bit casts so
|
||||
// only enable it by default for 64bit builds
|
||||
#ifdef HAVE_64BIT_BUILD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue