Commit f920ad11 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

Revert "[torque] Port builtins-number-gen to Torque"

This reverts commit 4482f988.

Reason for revert: Causes Torque to break UBSAN

https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20UBSan/11235?

[764/2199] ACTION //:run_torque(//build/toolchain/linux:clang_x64)
FAILED: gen/torque-generated/bit-fields-tq.h gen/torque-generated/builtin-definitions-tq.h gen/torqu...(too long)
python ../../tools/run.py ./torque -o gen/torque-generated -v8-root ../.. src/builtins/array-copywit...(too long)
../../src/torque/implementation-visitor.cc:778:36: runtime error: 2.14748e+09 is outside the range of representable values of type 'int'

Original change's description:
> [torque] Port builtins-number-gen to Torque
> 
> - Ports everything except Add.
> 
> Builtins generated from this CL are slightly larger, e.g. Subtract
> is 424 bytes on x64, as opposed to 400 bytes for the CSA version.
> See https://crbug.com/v8/10521
> 
> Bug: v8:9891
> 
> Change-Id: Id85779eb26d8e51643d8a04f0a75090bc50ef5b2
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2191644
> Commit-Queue: Bill Budge <bbudge@chromium.org>
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#67910}

TBR=bbudge@chromium.org,jgruber@chromium.org,tebbi@chromium.org

Change-Id: Ib124c893753973243563e32c25bc727a5df2ca53
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9891
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2209264Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67911}
parent 4482f988
...@@ -78,8 +78,7 @@ type JSPrimitive = Numeric|String|Symbol|Boolean|Null|Undefined; ...@@ -78,8 +78,7 @@ type JSPrimitive = Numeric|String|Symbol|Boolean|Null|Undefined;
// TheHole or FixedArray. // TheHole or FixedArray.
type JSAny = JSReceiver|JSPrimitive; type JSAny = JSReceiver|JSPrimitive;
type JSAnyNotNumeric = String|Symbol|Boolean|Null|Undefined|JSReceiver; type JSAnyNotNumber = BigInt|String|Symbol|Boolean|Null|Undefined|JSReceiver;
type JSAnyNotNumber = BigInt|JSAnyNotNumeric;
// This is the intersection of JSAny and HeapObject. // This is the intersection of JSAny and HeapObject.
type JSAnyNotSmi = JSAnyNotNumber|HeapNumber; type JSAnyNotSmi = JSAnyNotNumber|HeapNumber;
...@@ -620,11 +619,6 @@ extern macro StringCharCodeAt(String, uintptr): int32; ...@@ -620,11 +619,6 @@ extern macro StringCharCodeAt(String, uintptr): int32;
extern runtime StringCompareSequence(Context, String, String, Number): Boolean; extern runtime StringCompareSequence(Context, String, String, Number): Boolean;
extern macro StringFromSingleCharCode(int32): String; extern macro StringFromSingleCharCode(int32): String;
extern macro Equal(JSAny, JSAny, Context): Boolean;
macro Equal(implicit context: Context)(left: JSAny, right: JSAny): Boolean {
return Equal(left, right);
}
extern macro StrictEqual(JSAny, JSAny): Boolean; extern macro StrictEqual(JSAny, JSAny): Boolean;
extern macro SmiLexicographicCompare(Smi, Smi): Smi; extern macro SmiLexicographicCompare(Smi, Smi): Smi;
extern runtime ReThrow(Context, JSAny): never; extern runtime ReThrow(Context, JSAny): never;
...@@ -823,7 +817,6 @@ extern operator '+' macro Float64Add(float64, float64): float64; ...@@ -823,7 +817,6 @@ extern operator '+' macro Float64Add(float64, float64): float64;
extern operator '-' macro Float64Sub(float64, float64): float64; extern operator '-' macro Float64Sub(float64, float64): float64;
extern operator '*' macro Float64Mul(float64, float64): float64; extern operator '*' macro Float64Mul(float64, float64): float64;
extern operator '/' macro Float64Div(float64, float64): float64; extern operator '/' macro Float64Div(float64, float64): float64;
extern operator '%' macro Float64Mod(float64, float64): float64;
extern operator '+' macro NumberAdd(Number, Number): Number; extern operator '+' macro NumberAdd(Number, Number): Number;
extern operator '-' macro NumberSub(Number, Number): Number; extern operator '-' macro NumberSub(Number, Number): Number;
...@@ -892,7 +885,6 @@ extern macro TaggedIsNotSmi(Object): bool; ...@@ -892,7 +885,6 @@ extern macro TaggedIsNotSmi(Object): bool;
extern macro TaggedIsPositiveSmi(Object): bool; extern macro TaggedIsPositiveSmi(Object): bool;
extern macro IsValidPositiveSmi(intptr): bool; extern macro IsValidPositiveSmi(intptr): bool;
extern macro IsInteger(JSAny): bool;
extern macro IsInteger(HeapNumber): bool; extern macro IsInteger(HeapNumber): bool;
extern macro AllocateHeapNumberWithValue(float64): HeapNumber; extern macro AllocateHeapNumberWithValue(float64): HeapNumber;
...@@ -923,7 +915,6 @@ macro SmiTag<T : type extends uint31>(value: T): SmiTagged<T> { ...@@ -923,7 +915,6 @@ macro SmiTag<T : type extends uint31>(value: T): SmiTagged<T> {
return %RawDownCast<SmiTagged<T>>(SmiFromUint32(value)); return %RawDownCast<SmiTagged<T>>(SmiFromUint32(value));
} }
extern macro SmiToInt32(Smi): int32; extern macro SmiToInt32(Smi): int32;
extern macro SmiToFloat64(Smi): float64;
extern macro TaggedIndexToIntPtr(TaggedIndex): intptr; extern macro TaggedIndexToIntPtr(TaggedIndex): intptr;
extern macro IntPtrToTaggedIndex(intptr): TaggedIndex; extern macro IntPtrToTaggedIndex(intptr): TaggedIndex;
extern macro TaggedIndexToSmi(TaggedIndex): Smi; extern macro TaggedIndexToSmi(TaggedIndex): Smi;
......
...@@ -598,15 +598,53 @@ namespace internal { ...@@ -598,15 +598,53 @@ namespace internal {
TFJ(MapIteratorPrototypeNext, 0, kReceiver) \ TFJ(MapIteratorPrototypeNext, 0, kReceiver) \
TFS(MapIteratorToList, kSource) \ TFS(MapIteratorToList, kSource) \
\ \
/* Number */ \
TFC(AllocateHeapNumber, AllocateHeapNumber) \
/* ES #sec-number-constructor */ \ /* ES #sec-number-constructor */ \
TFJ(NumberConstructor, kDontAdaptArgumentsSentinel) \ TFJ(NumberConstructor, kDontAdaptArgumentsSentinel) \
/* ES6 #sec-number.isfinite */ \
TFJ(NumberIsFinite, 1, kReceiver, kNumber) \
/* ES6 #sec-number.isinteger */ \
TFJ(NumberIsInteger, 1, kReceiver, kNumber) \
/* ES6 #sec-number.isnan */ \
TFJ(NumberIsNaN, 1, kReceiver, kNumber) \
/* ES6 #sec-number.issafeinteger */ \
TFJ(NumberIsSafeInteger, 1, kReceiver, kNumber) \
/* ES6 #sec-number.parsefloat */ \
TFJ(NumberParseFloat, 1, kReceiver, kString) \
/* ES6 #sec-number.parseint */ \
TFJ(NumberParseInt, 2, kReceiver, kString, kRadix) \
TFS(ParseInt, kString, kRadix) \
CPP(NumberPrototypeToExponential) \ CPP(NumberPrototypeToExponential) \
CPP(NumberPrototypeToFixed) \ CPP(NumberPrototypeToFixed) \
CPP(NumberPrototypeToLocaleString) \ CPP(NumberPrototypeToLocaleString) \
CPP(NumberPrototypeToPrecision) \ CPP(NumberPrototypeToPrecision) \
/* ES6 #sec-number.prototype.valueof */ \
TFJ(NumberPrototypeValueOf, 0, kReceiver) \
TFC(Add, BinaryOp) \ TFC(Add, BinaryOp) \
TFC(Subtract, BinaryOp) \
TFC(Multiply, BinaryOp) \
TFC(Divide, BinaryOp) \
TFC(Modulus, BinaryOp) \
TFC(Exponentiate, BinaryOp) \
TFC(BitwiseAnd, BinaryOp) \
TFC(BitwiseOr, BinaryOp) \
TFC(BitwiseXor, BinaryOp) \
TFC(ShiftLeft, BinaryOp) \
TFC(ShiftRight, BinaryOp) \
TFC(ShiftRightLogical, BinaryOp) \
TFC(LessThan, Compare) \
TFC(LessThanOrEqual, Compare) \
TFC(GreaterThan, Compare) \
TFC(GreaterThanOrEqual, Compare) \
TFC(Equal, Compare) \
TFC(SameValue, Compare) \ TFC(SameValue, Compare) \
TFC(SameValueNumbersOnly, Compare) \ TFC(SameValueNumbersOnly, Compare) \
TFC(StrictEqual, Compare) \
TFS(BitwiseNot, kValue) \
TFS(Decrement, kValue) \
TFS(Increment, kValue) \
TFS(Negate, kValue) \
\ \
/* Object */ \ /* Object */ \
/* ES #sec-object-constructor */ \ /* ES #sec-object-constructor */ \
......
This diff is collapsed.
...@@ -103,9 +103,6 @@ macro Convert<To: type, From: type>(i: From): To labels Overflow { ...@@ -103,9 +103,6 @@ macro Convert<To: type, From: type>(i: From): To labels Overflow {
return i; return i;
} }
Convert<Boolean, bool>(b: bool): Boolean {
return b ? True : False;
}
extern macro ConvertElementsKindToInt(ElementsKind): int32; extern macro ConvertElementsKindToInt(ElementsKind): int32;
Convert<int32, ElementsKind>(elementsKind: ElementsKind): int32 { Convert<int32, ElementsKind>(elementsKind: ElementsKind): int32 {
return ConvertElementsKindToInt(elementsKind); return ConvertElementsKindToInt(elementsKind);
......
This diff is collapsed.
...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {r1, r0}; Register registers[] = {r1, r0};
......
...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// x1: left operand // x1: left operand
......
...@@ -195,6 +195,12 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -195,6 +195,12 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {edx, eax}; Register registers[] = {edx, eax};
......
...@@ -83,6 +83,7 @@ void CallDescriptors::InitializeOncePerProcess() { ...@@ -83,6 +83,7 @@ void CallDescriptors::InitializeOncePerProcess() {
DCHECK(ContextOnlyDescriptor{}.HasContextParameter()); DCHECK(ContextOnlyDescriptor{}.HasContextParameter());
DCHECK(!NoContextDescriptor{}.HasContextParameter()); DCHECK(!NoContextDescriptor{}.HasContextParameter());
DCHECK(!AllocateDescriptor{}.HasContextParameter()); DCHECK(!AllocateDescriptor{}.HasContextParameter());
DCHECK(!AllocateHeapNumberDescriptor{}.HasContextParameter());
DCHECK(!AbortDescriptor{}.HasContextParameter()); DCHECK(!AbortDescriptor{}.HasContextParameter());
DCHECK(!WasmFloat32ToNumberDescriptor{}.HasContextParameter()); DCHECK(!WasmFloat32ToNumberDescriptor{}.HasContextParameter());
DCHECK(!WasmFloat64ToNumberDescriptor{}.HasContextParameter()); DCHECK(!WasmFloat64ToNumberDescriptor{}.HasContextParameter());
......
...@@ -23,6 +23,7 @@ namespace internal { ...@@ -23,6 +23,7 @@ namespace internal {
#define INTERFACE_DESCRIPTOR_LIST(V) \ #define INTERFACE_DESCRIPTOR_LIST(V) \
V(Abort) \ V(Abort) \
V(Allocate) \ V(Allocate) \
V(AllocateHeapNumber) \
V(ApiCallback) \ V(ApiCallback) \
V(ApiGetter) \ V(ApiGetter) \
V(ArgumentsAdaptor) \ V(ArgumentsAdaptor) \
...@@ -1056,6 +1057,13 @@ class AbortDescriptor : public CallInterfaceDescriptor { ...@@ -1056,6 +1057,13 @@ class AbortDescriptor : public CallInterfaceDescriptor {
DECLARE_DESCRIPTOR(AbortDescriptor, CallInterfaceDescriptor) DECLARE_DESCRIPTOR(AbortDescriptor, CallInterfaceDescriptor)
}; };
class AllocateHeapNumberDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS_NO_CONTEXT()
DEFINE_PARAMETER_TYPES()
DECLARE_DESCRIPTOR(AllocateHeapNumberDescriptor, CallInterfaceDescriptor)
};
class ArrayConstructorDescriptor : public CallInterfaceDescriptor { class ArrayConstructorDescriptor : public CallInterfaceDescriptor {
public: public:
DEFINE_JS_PARAMETERS(kAllocationSite) DEFINE_JS_PARAMETERS(kAllocationSite)
......
...@@ -217,6 +217,12 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -217,6 +217,12 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {a1, a0}; Register registers[] = {a1, a0};
......
...@@ -217,6 +217,12 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -217,6 +217,12 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {a1, a0}; Register registers[] = {a1, a0};
......
...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {r4, r3}; Register registers[] = {r4, r3};
......
...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -191,6 +191,11 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r2}; Register registers[] = {r3, r2};
......
...@@ -233,6 +233,11 @@ void AbortDescriptor::InitializePlatformSpecific( ...@@ -233,6 +233,11 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {rdx, rax}; Register registers[] = {rdx, rax};
......
...@@ -151,8 +151,6 @@ constexpr int kMaxInt16 = (1 << 15) - 1; ...@@ -151,8 +151,6 @@ constexpr int kMaxInt16 = (1 << 15) - 1;
constexpr int kMinInt16 = -(1 << 15); constexpr int kMinInt16 = -(1 << 15);
constexpr int kMaxUInt16 = (1 << 16) - 1; constexpr int kMaxUInt16 = (1 << 16) - 1;
constexpr int kMinUInt16 = 0; constexpr int kMinUInt16 = 0;
constexpr int kMaxInt31 = kMaxInt / 2;
constexpr int kMinInt31 = kMinInt / 2;
constexpr uint32_t kMaxUInt32 = 0xFFFFFFFFu; constexpr uint32_t kMaxUInt32 = 0xFFFFFFFFu;
constexpr int kMinUInt32 = 0; constexpr int kMinUInt32 = 0;
......
...@@ -5,16 +5,8 @@ ...@@ -5,16 +5,8 @@
@abstract @abstract
@generateCppClass @generateCppClass
extern class Name extends PrimitiveHeapObject { extern class Name extends PrimitiveHeapObject {
hash_field: NameHash; hash_field: uint32;
} }
bitfield struct NameHash extends uint32 {
hash_not_commputed: bool: 1 bit;
is_not_integer_index_mask: bool: 1 bit;
array_index_value: uint32: 24 bit;
array_index_length: uint32: 6 bit;
}
// This is the same as Name, but with the information that there are no other // This is the same as Name, but with the information that there are no other
// kinds of names. // kinds of names.
type AnyName = PrivateSymbol|PublicSymbol|String; type AnyName = PrivateSymbol|PublicSymbol|String;
...@@ -37,12 +29,5 @@ extern class Symbol extends Name { ...@@ -37,12 +29,5 @@ extern class Symbol extends Name {
type PublicSymbol extends Symbol; type PublicSymbol extends Symbol;
type PrivateSymbol extends Symbol; type PrivateSymbol extends Symbol;
const kNameEmptyHashField: NameHash = NameHash{ const kNameEmptyHashField:
hash_not_commputed: true, constexpr uint32 generates 'Name::kEmptyHashField';
is_not_integer_index_mask: true,
array_index_value: 0,
array_index_length: 0
};
const kMaxCachedArrayIndexLength: constexpr uint32
generates 'Name::kMaxCachedArrayIndexLength';
...@@ -72,6 +72,7 @@ struct WasmModule; ...@@ -72,6 +72,7 @@ struct WasmModule;
V(WasmThrow) \ V(WasmThrow) \
V(WasmRethrow) \ V(WasmRethrow) \
V(WasmTraceMemory) \ V(WasmTraceMemory) \
V(AllocateHeapNumber) \
V(ArgumentsAdaptorTrampoline) \ V(ArgumentsAdaptorTrampoline) \
V(BigIntToI32Pair) \ V(BigIntToI32Pair) \
V(BigIntToI64) \ V(BigIntToI64) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment