Diff
Modified: trunk/JSTests/ChangeLog (238834 => 238835)
--- trunk/JSTests/ChangeLog 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/JSTests/ChangeLog 2018-12-04 01:34:28 UTC (rev 238835)
@@ -1,3 +1,15 @@
+2018-12-03 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r238833.
+
+ Breaks macOS and iOS debug builds.
+
+ Reverted changeset:
+
+ "[ESNext][BigInt] Support logic operations"
+ https://bugs.webkit.org/show_bug.cgi?id=179903
+ https://trac.webkit.org/changeset/238833
+
2018-12-03 Caio Lima <[email protected]>
[ESNext][BigInt] Support logic operations
Deleted: trunk/JSTests/stress/big-int-branch-usage.js (238834 => 238835)
--- trunk/JSTests/stress/big-int-branch-usage.js 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/JSTests/stress/big-int-branch-usage.js 2018-12-04 01:34:28 UTC (rev 238835)
@@ -1,23 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a, e) {
- if (a !== e) {
- throw new Error("Bad!");
- }
-}
-
-function branchTest(a) {
- if (a)
- return a;
- else
- return false;
-}
-noInline(branchTest);
-
-for (let i = 0; i < 100000; i++) {
- assert(branchTest(10n), 10n);
- assert(branchTest(1n), 1n);
- assert(branchTest(0n), false);
- assert(branchTest(-1n), -1n);
-}
-
Deleted: trunk/JSTests/stress/big-int-logical-and.js (238834 => 238835)
--- trunk/JSTests/stress/big-int-logical-and.js 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/JSTests/stress/big-int-logical-and.js 2018-12-04 01:34:28 UTC (rev 238835)
@@ -1,20 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a, e) {
- if (a !== e) {
- throw new Error("Bad!");
- }
-}
-
-function logicalAnd(a, b) {
- return a && b;
-}
-noInline(logicalAnd);
-
-for (let i = 0; i < 100000; i++) {
- assert(logicalAnd(1n, 10n), 10n);
- assert(logicalAnd(1n, 1n), 1n);
- assert(logicalAnd(1n, 0n), 0n);
- assert(logicalAnd(1n, -1n), -1n);
-}
-
Deleted: trunk/JSTests/stress/big-int-logical-not.js (238834 => 238835)
--- trunk/JSTests/stress/big-int-logical-not.js 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/JSTests/stress/big-int-logical-not.js 2018-12-04 01:34:28 UTC (rev 238835)
@@ -1,20 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a, e) {
- if (a !== e) {
- throw new Error("Bad!");
- }
-}
-
-function logicalNot(a) {
- return !a;
-}
-noInline(logicalNot);
-
-for (let i = 0; i < 100000; i++) {
- assert(logicalNot(10n), false);
- assert(logicalNot(1n), false);
- assert(logicalNot(0n), true);
- assert(logicalNot(-1n), false);
-}
-
Deleted: trunk/JSTests/stress/big-int-logical-or.js (238834 => 238835)
--- trunk/JSTests/stress/big-int-logical-or.js 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/JSTests/stress/big-int-logical-or.js 2018-12-04 01:34:28 UTC (rev 238835)
@@ -1,20 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a, e) {
- if (a !== e) {
- throw new Error("Bad!");
- }
-}
-
-function logicalOr(a, b) {
- return a || b;
-}
-noInline(logicalOr);
-
-for (let i = 0; i < 100000; i++) {
- assert(logicalOr(10n, "abc"), 10n);
- assert(logicalOr(1n, "abc"), 1n);
- assert(logicalOr(0n, "abc"), "abc");
- assert(logicalOr(-1n, "abc"), -1n);
-}
-
Modified: trunk/Source/_javascript_Core/ChangeLog (238834 => 238835)
--- trunk/Source/_javascript_Core/ChangeLog 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-12-04 01:34:28 UTC (rev 238835)
@@ -1,3 +1,15 @@
+2018-12-03 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r238833.
+
+ Breaks macOS and iOS debug builds.
+
+ Reverted changeset:
+
+ "[ESNext][BigInt] Support logic operations"
+ https://bugs.webkit.org/show_bug.cgi?id=179903
+ https://trac.webkit.org/changeset/238833
+
2018-12-03 Caio Lima <[email protected]>
[ESNext][BigInt] Support logic operations
Modified: trunk/Source/_javascript_Core/ftl/FTLAbstractHeapRepository.h (238834 => 238835)
--- trunk/Source/_javascript_Core/ftl/FTLAbstractHeapRepository.h 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/Source/_javascript_Core/ftl/FTLAbstractHeapRepository.h 2018-12-04 01:34:28 UTC (rev 238835)
@@ -85,7 +85,6 @@
macro(JSString_flags, JSString::offsetOfFlags()) \
macro(JSString_length, JSString::offsetOfLength()) \
macro(JSString_value, JSString::offsetOfValue()) \
- macro(JSBigInt_length, JSBigInt::offsetOfLength()) \
macro(JSSymbolTableObject_symbolTable, JSSymbolTableObject::offsetOfSymbolTable()) \
macro(JSWrapperObject_internalValue, JSWrapperObject::internalValueOffset()) \
macro(RegExpConstructor_cachedResult_lastRegExp, RegExpConstructor::offsetOfCachedResult() + RegExpCachedResult::offsetOfLastRegExp()) \
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (238834 => 238835)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2018-12-04 01:34:28 UTC (rev 238835)
@@ -13578,7 +13578,7 @@
// Implements the following control flow structure:
// if (value is cell) {
- // if (value is string or value is BigInt)
+ // if (value is string)
// result = !!value->length
// else {
// do evil things for masquerades-as-undefined
@@ -13595,8 +13595,6 @@
LBasicBlock cellCase = m_out.newBlock();
LBasicBlock stringCase = m_out.newBlock();
LBasicBlock notStringCase = m_out.newBlock();
- LBasicBlock bigIntCase = m_out.newBlock();
- LBasicBlock notBigIntCase = m_out.newBlock();
LBasicBlock notCellCase = m_out.newBlock();
LBasicBlock int32Case = m_out.newBlock();
LBasicBlock notInt32Case = m_out.newBlock();
@@ -13618,19 +13616,8 @@
m_out.load32NonNegative(value, m_heaps.JSString_length));
results.append(m_out.anchor(nonEmptyString));
m_out.jump(continuation);
-
- m_out.appendTo(notStringCase, bigIntCase);
- m_out.branch(
- isBigInt(value, provenType(edge) & SpecCell),
- unsure(bigIntCase), unsure(notBigIntCase));
-
- m_out.appendTo(bigIntCase, notBigIntCase);
- LValue nonZeroBigInt = m_out.notZero32(
- m_out.load32NonNegative(value, m_heaps.JSBigInt_length));
- results.append(m_out.anchor(nonZeroBigInt));
- m_out.jump(continuation);
- m_out.appendTo(notBigIntCase, notCellCase);
+ m_out.appendTo(notStringCase, notCellCase);
LValue isTruthyObject;
if (masqueradesAsUndefinedWatchpointIsStillValid())
isTruthyObject = m_out.booleanTrue;
@@ -15624,15 +15611,6 @@
m_out.constInt32(vm().bigIntStructure->id()));
}
- LValue isBigInt(LValue cell, SpeculatedType type = SpecFullTop)
- {
- if (LValue proven = isProvenValue(type & SpecCell, SpecBigInt))
- return proven;
- return m_out.equal(
- m_out.load32(cell, m_heaps.JSCell_structureID),
- m_out.constInt32(vm().bigIntStructure->id()));
- }
-
LValue isArrayTypeForArrayify(LValue cell, ArrayMode arrayMode)
{
switch (arrayMode.type()) {
Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp (238834 => 238835)
--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.cpp 2018-12-04 01:34:28 UTC (rev 238835)
@@ -758,7 +758,7 @@
{
// Implements the following control flow structure:
// if (value is cell) {
- // if (value is string or value is BigInt)
+ // if (value is string)
// result = !!value->length
// else {
// do evil things for masquerades-as-undefined
@@ -781,12 +781,6 @@
done.append(jump());
isCellButNotString.link(this);
- auto isCellButNotBigIntOrString = branchIfNotBigInt(value.payloadGPR());
- load32(Address(value.payloadGPR(), JSBigInt::offsetOfLength()), result);
- compare32(invert ? Equal : NotEqual, result, TrustedImm32(0), result);
- done.append(jump());
-
- isCellButNotBigIntOrString.link(this);
if (shouldCheckMasqueradesAsUndefined) {
ASSERT(scratchIfShouldCheckMasqueradesAsUndefined != InvalidGPRReg);
JumpList isNotMasqueradesAsUndefined;
@@ -837,7 +831,7 @@
{
// Implements the following control flow structure:
// if (value is cell) {
- // if (value is string or value is BigInt)
+ // if (value is string)
// result = !!value->length
// else {
// do evil things for masquerades-as-undefined
@@ -858,13 +852,9 @@
auto isCellButNotString = branchIfNotString(value.payloadGPR());
truthy.append(branchTest32(invert ? Zero : NonZero, Address(value.payloadGPR(), JSString::offsetOfLength())));
done.append(jump());
- isCellButNotString.link(this);
- auto isCellButNotBigIntOrString = branchIfNotBigInt(value.payloadGPR());
- truthy.append(branchTest32(invert ? Zero : NonZero, Address(value.payloadGPR(), JSBigInt::offsetOfLength())));
- done.append(jump());
if (shouldCheckMasqueradesAsUndefined) {
- isCellButNotBigIntOrString.link(this);
+ isCellButNotString.link(this);
ASSERT(scratchIfShouldCheckMasqueradesAsUndefined != InvalidGPRReg);
JumpList isNotMasqueradesAsUndefined;
isNotMasqueradesAsUndefined.append(branchTest8(Zero, Address(value.payloadGPR(), JSCell::typeInfoFlagsOffset()), TrustedImm32(MasqueradesAsUndefined)));
@@ -884,9 +874,9 @@
truthy.append(isNotMasqueradesAsUndefined);
} else {
if (invert)
- done.append(isCellButNotBigIntOrString);
+ done.append(isCellButNotString);
else
- truthy.append(isCellButNotBigIntOrString);
+ truthy.append(isCellButNotString);
}
notCell.link(this);
Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.cpp (238834 => 238835)
--- trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2018-12-04 01:34:28 UTC (rev 238835)
@@ -232,6 +232,12 @@
return toStringGeneric(exec, this, radix);
}
+inline bool JSBigInt::isZero()
+{
+ ASSERT(length() || !sign());
+ return length() == 0;
+}
+
// Multiplies {this} with {factor} and adds {summand} to the result.
void JSBigInt::inplaceMultiplyAdd(Digit factor, Digit summand)
{
@@ -1694,11 +1700,6 @@
return WTF::roundUpToMultipleOf<sizeof(Digit)>(sizeof(JSBigInt));
}
-size_t JSBigInt::offsetOfLength()
-{
- return OBJECT_OFFSETOF(JSBigInt, m_length);
-}
-
template <typename CharType>
JSBigInt* JSBigInt::parseInt(ExecState* exec, CharType* data, unsigned length, ErrorParseMode errorParseMode)
{
@@ -1817,7 +1818,6 @@
ASSERT(n < length());
dataStorage()[n] = value;
}
-
JSObject* JSBigInt::toObject(ExecState* exec, JSGlobalObject* globalObject) const
{
return BigIntObject::create(exec->vm(), globalObject, const_cast<JSBigInt*>(this));
Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.h (238834 => 238835)
--- trunk/Source/_javascript_Core/runtime/JSBigInt.h 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.h 2018-12-04 01:34:28 UTC (rev 238835)
@@ -28,6 +28,7 @@
#include "CPU.h"
#include "ExceptionHelpers.h"
#include "JSObject.h"
+#include "ParseInt.h"
#include <wtf/CagedPtr.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringView.h>
@@ -58,8 +59,6 @@
static JSBigInt* createFrom(VM&, int64_t value);
static JSBigInt* createFrom(VM&, bool value);
- static size_t offsetOfLength();
-
DECLARE_EXPORT_INFO;
JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
@@ -105,7 +104,6 @@
double toNumber(ExecState*) const;
JSObject* toObject(ExecState*, JSGlobalObject*) const;
- JS_EXPORT_PRIVATE inline bool toBoolean() const { return !isZero(); }
static JSBigInt* multiply(ExecState*, JSBigInt* x, JSBigInt* y);
@@ -196,11 +194,7 @@
static String toStringBasePowerOfTwo(ExecState*, JSBigInt*, unsigned radix);
static String toStringGeneric(ExecState*, JSBigInt*, unsigned radix);
- inline bool isZero() const
- {
- ASSERT(length() || !sign());
- return length() == 0;
- }
+ bool isZero();
template <typename CharType>
static JSBigInt* parseInt(ExecState*, CharType* data, unsigned length, ErrorParseMode);
Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (238834 => 238835)
--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2018-12-04 01:15:13 UTC (rev 238834)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2018-12-04 01:34:28 UTC (rev 238835)
@@ -33,7 +33,6 @@
#include "FreeListInlines.h"
#include "Handle.h"
#include "IsoSubspaceInlines.h"
-#include "JSBigInt.h"
#include "JSCast.h"
#include "JSDestructibleObject.h"
#include "JSObject.h"
@@ -340,8 +339,6 @@
{
if (isString())
return static_cast<const JSString*>(this)->toBoolean();
- if (isBigInt())
- return static_cast<const JSBigInt*>(this)->toBoolean();
return !structure(exec->vm())->masqueradesAsUndefined(exec->lexicalGlobalObject());
}
@@ -349,8 +346,6 @@
{
if (isString())
return static_cast<const JSString*>(this)->toBoolean() ? TrueTriState : FalseTriState;
- if (isBigInt())
- return static_cast<const JSBigInt*>(this)->toBoolean() ? TrueTriState : FalseTriState;
if (isSymbol())
return TrueTriState;
return MixedTriState;