Commit 280776f8 authored by Daniel Clifford's avatar Daniel Clifford Committed by Commit Bot

Incremental Torque type cleanup

Includes creating Oddball-specific types.

Change-Id: Ib5d80dfe95838b2deb0a2fcae67c349940970252
Reviewed-on: https://chromium-review.googlesource.com/c/1342930Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Daniel Clifford <danno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57655}
parent 4547a5b1
......@@ -54,7 +54,7 @@ namespace array {
return LoadElementOrUndefined(a, Convert<intptr>(i));
}
macro LoadElementOrUndefined(a: FixedDoubleArray, i: Smi): Object {
macro LoadElementOrUndefined(a: FixedDoubleArray, i: Smi): NumberOrUndefined {
try {
const f: float64 = LoadDoubleWithHoleCheck(a, i) otherwise IfHole;
return AllocateHeapNumberWithValue(f);
......@@ -64,7 +64,8 @@ namespace array {
}
}
macro LoadElementOrUndefined(a: FixedDoubleArray, i: intptr): Object {
macro LoadElementOrUndefined(a: FixedDoubleArray, i: intptr):
NumberOrUndefined {
try {
const f: float64 = LoadDoubleWithHoleCheck(a, i) otherwise IfHole;
return AllocateHeapNumberWithValue(f);
......@@ -75,7 +76,7 @@ namespace array {
}
macro LoadElementOrUndefined(a: FixedDoubleArray, i: constexpr int31):
Object {
NumberOrUndefined {
return LoadElementOrUndefined(a, Convert<intptr>(i));
}
......
......@@ -35,7 +35,6 @@ type HeapNumber extends HeapObject generates 'TNode<HeapNumber>';
type Number = Smi | HeapNumber;
type BigInt extends HeapObject generates 'TNode<BigInt>';
type Numeric = Number | BigInt;
type Boolean extends Oddball generates 'TNode<Oddball>';
type JSProxy extends JSReceiver generates 'TNode<JSProxy>';
type JSObject extends JSReceiver generates 'TNode<JSObject>';
type JSArgumentsObjectWithLength extends JSObject
......@@ -216,21 +215,30 @@ const kInvalidDataViewAccessorOffset: constexpr MessageTemplate
const kStrictReadOnlyProperty: constexpr MessageTemplate
generates 'MessageTemplate::kStrictReadOnlyProperty';
extern macro TheHoleConstant(): Oddball;
extern macro NullConstant(): Oddball;
extern macro UndefinedConstant(): Oddball;
extern macro TrueConstant(): Boolean;
extern macro FalseConstant(): Boolean;
type Hole extends Oddball generates 'TNode<Oddball>';
type Null extends Oddball generates 'TNode<Oddball>';
type Undefined extends Oddball generates 'TNode<Oddball>';
type True extends Oddball generates 'TNode<Oddball>';
type False extends Oddball generates 'TNode<Oddball>';
type Boolean = True | False;
type NumberOrUndefined = Number | Undefined;
extern macro TheHoleConstant(): Hole;
extern macro NullConstant(): Null;
extern macro UndefinedConstant(): Undefined;
extern macro TrueConstant(): True;
extern macro FalseConstant(): False;
extern macro Int32TrueConstant(): bool;
extern macro Int32FalseConstant(): bool;
extern macro EmptyStringConstant(): String;
extern macro LengthStringConstant(): String;
const Hole: Oddball = TheHoleConstant();
const Null: Oddball = NullConstant();
const Undefined: Oddball = UndefinedConstant();
const True: Boolean = TrueConstant();
const False: Boolean = FalseConstant();
const Hole: Hole = TheHoleConstant();
const Null: Null = NullConstant();
const Undefined: Undefined = UndefinedConstant();
const True: True = TrueConstant();
const False: False = FalseConstant();
const kEmptyString: String = EmptyStringConstant();
const kLengthString: String = LengthStringConstant();
......
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