Commit 4482f988 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

[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: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67910}
parent b9d2c22a
......@@ -78,7 +78,8 @@ type JSPrimitive = Numeric|String|Symbol|Boolean|Null|Undefined;
// TheHole or FixedArray.
type JSAny = JSReceiver|JSPrimitive;
type JSAnyNotNumber = BigInt|String|Symbol|Boolean|Null|Undefined|JSReceiver;
type JSAnyNotNumeric = String|Symbol|Boolean|Null|Undefined|JSReceiver;
type JSAnyNotNumber = BigInt|JSAnyNotNumeric;
// This is the intersection of JSAny and HeapObject.
type JSAnyNotSmi = JSAnyNotNumber|HeapNumber;
......@@ -619,6 +620,11 @@ extern macro StringCharCodeAt(String, uintptr): int32;
extern runtime StringCompareSequence(Context, String, String, Number): Boolean;
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 SmiLexicographicCompare(Smi, Smi): Smi;
extern runtime ReThrow(Context, JSAny): never;
......@@ -817,6 +823,7 @@ extern operator '+' macro Float64Add(float64, float64): float64;
extern operator '-' macro Float64Sub(float64, float64): float64;
extern operator '*' macro Float64Mul(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 NumberSub(Number, Number): Number;
......@@ -885,6 +892,7 @@ extern macro TaggedIsNotSmi(Object): bool;
extern macro TaggedIsPositiveSmi(Object): bool;
extern macro IsValidPositiveSmi(intptr): bool;
extern macro IsInteger(JSAny): bool;
extern macro IsInteger(HeapNumber): bool;
extern macro AllocateHeapNumberWithValue(float64): HeapNumber;
......@@ -915,6 +923,7 @@ macro SmiTag<T : type extends uint31>(value: T): SmiTagged<T> {
return %RawDownCast<SmiTagged<T>>(SmiFromUint32(value));
}
extern macro SmiToInt32(Smi): int32;
extern macro SmiToFloat64(Smi): float64;
extern macro TaggedIndexToIntPtr(TaggedIndex): intptr;
extern macro IntPtrToTaggedIndex(intptr): TaggedIndex;
extern macro TaggedIndexToSmi(TaggedIndex): Smi;
......
......@@ -598,53 +598,15 @@ namespace internal {
TFJ(MapIteratorPrototypeNext, 0, kReceiver) \
TFS(MapIteratorToList, kSource) \
\
/* Number */ \
TFC(AllocateHeapNumber, AllocateHeapNumber) \
/* ES #sec-number-constructor */ \
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(NumberPrototypeToFixed) \
CPP(NumberPrototypeToLocaleString) \
CPP(NumberPrototypeToPrecision) \
/* ES6 #sec-number.prototype.valueof */ \
TFJ(NumberPrototypeValueOf, 0, kReceiver) \
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(SameValueNumbersOnly, Compare) \
TFC(StrictEqual, Compare) \
TFS(BitwiseNot, kValue) \
TFS(Decrement, kValue) \
TFS(Increment, kValue) \
TFS(Negate, kValue) \
\
/* Object */ \
/* ES #sec-object-constructor */ \
......
This diff is collapsed.
......@@ -103,6 +103,9 @@ macro Convert<To: type, From: type>(i: From): To labels Overflow {
return i;
}
Convert<Boolean, bool>(b: bool): Boolean {
return b ? True : False;
}
extern macro ConvertElementsKindToInt(ElementsKind): int32;
Convert<int32, ElementsKind>(elementsKind: ElementsKind): int32 {
return ConvertElementsKindToInt(elementsKind);
......
This diff is collapsed.
......@@ -191,11 +191,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r1, r0};
......
......@@ -191,11 +191,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// x1: left operand
......
......@@ -195,12 +195,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {edx, eax};
......
......@@ -83,7 +83,6 @@ void CallDescriptors::InitializeOncePerProcess() {
DCHECK(ContextOnlyDescriptor{}.HasContextParameter());
DCHECK(!NoContextDescriptor{}.HasContextParameter());
DCHECK(!AllocateDescriptor{}.HasContextParameter());
DCHECK(!AllocateHeapNumberDescriptor{}.HasContextParameter());
DCHECK(!AbortDescriptor{}.HasContextParameter());
DCHECK(!WasmFloat32ToNumberDescriptor{}.HasContextParameter());
DCHECK(!WasmFloat64ToNumberDescriptor{}.HasContextParameter());
......
......@@ -23,7 +23,6 @@ namespace internal {
#define INTERFACE_DESCRIPTOR_LIST(V) \
V(Abort) \
V(Allocate) \
V(AllocateHeapNumber) \
V(ApiCallback) \
V(ApiGetter) \
V(ArgumentsAdaptor) \
......@@ -1057,13 +1056,6 @@ class AbortDescriptor : public 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 {
public:
DEFINE_JS_PARAMETERS(kAllocationSite)
......
......@@ -217,12 +217,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {a1, a0};
......
......@@ -217,12 +217,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {a1, a0};
......
......@@ -191,11 +191,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4, r3};
......
......@@ -191,11 +191,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r2};
......
......@@ -233,11 +233,6 @@ void AbortDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rdx, rax};
......
......@@ -151,6 +151,8 @@ constexpr int kMaxInt16 = (1 << 15) - 1;
constexpr int kMinInt16 = -(1 << 15);
constexpr int kMaxUInt16 = (1 << 16) - 1;
constexpr int kMinUInt16 = 0;
constexpr int kMaxInt31 = kMaxInt / 2;
constexpr int kMinInt31 = kMinInt / 2;
constexpr uint32_t kMaxUInt32 = 0xFFFFFFFFu;
constexpr int kMinUInt32 = 0;
......
......@@ -5,8 +5,16 @@
@abstract
@generateCppClass
extern class Name extends PrimitiveHeapObject {
hash_field: uint32;
hash_field: NameHash;
}
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
// kinds of names.
type AnyName = PrivateSymbol|PublicSymbol|String;
......@@ -29,5 +37,12 @@ extern class Symbol extends Name {
type PublicSymbol extends Symbol;
type PrivateSymbol extends Symbol;
const kNameEmptyHashField:
constexpr uint32 generates 'Name::kEmptyHashField';
const kNameEmptyHashField: NameHash = NameHash{
hash_not_commputed: true,
is_not_integer_index_mask: true,
array_index_value: 0,
array_index_length: 0
};
const kMaxCachedArrayIndexLength: constexpr uint32
generates 'Name::kMaxCachedArrayIndexLength';
......@@ -72,7 +72,6 @@ struct WasmModule;
V(WasmThrow) \
V(WasmRethrow) \
V(WasmTraceMemory) \
V(AllocateHeapNumber) \
V(ArgumentsAdaptorTrampoline) \
V(BigIntToI32Pair) \
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