2018-04-16 09:24:22 +00:00
|
|
|
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2018-05-29 08:34:01 +00:00
|
|
|
type Arguments constexpr 'CodeStubArguments*';
|
2018-04-16 09:24:22 +00:00
|
|
|
type void generates 'void';
|
|
|
|
type never generates 'void';
|
|
|
|
|
2018-05-29 13:31:56 +00:00
|
|
|
type Tagged generates 'TNode<Object>';
|
|
|
|
type Smi extends Tagged generates 'TNode<Smi>';
|
|
|
|
type HeapObject extends Tagged generates 'TNode<HeapObject>';
|
2018-10-24 11:28:28 +00:00
|
|
|
type Object = Smi | HeapObject;
|
2018-06-25 13:28:25 +00:00
|
|
|
type int32 generates 'TNode<Int32T>' constexpr 'int32_t';
|
|
|
|
type uint32 generates 'TNode<Uint32T>' constexpr 'uint32_t';
|
2018-06-07 08:02:33 +00:00
|
|
|
type int64 generates 'TNode<Int64T>' constexpr 'int64_t';
|
2018-05-04 15:04:42 +00:00
|
|
|
type intptr generates 'TNode<IntPtrT>' constexpr 'intptr_t';
|
2018-06-15 12:23:58 +00:00
|
|
|
type uintptr generates 'TNode<UintPtrT>' constexpr 'uintptr_t';
|
2018-06-07 08:02:33 +00:00
|
|
|
type float32 generates 'TNode<Float32T>' constexpr 'float';
|
2018-05-04 15:04:42 +00:00
|
|
|
type float64 generates 'TNode<Float64T>' constexpr 'double';
|
|
|
|
type bool generates 'TNode<BoolT>' constexpr 'bool';
|
2018-07-03 12:02:05 +00:00
|
|
|
type string constexpr 'const char*';
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-06-12 11:11:44 +00:00
|
|
|
type int31 extends int32 generates 'TNode<Int32T>' constexpr 'int31_t';
|
2018-05-04 15:04:42 +00:00
|
|
|
type RawPtr generates 'TNode<RawPtrT>' constexpr 'void*';
|
2018-05-16 14:00:35 +00:00
|
|
|
type AbstractCode extends HeapObject generates 'TNode<AbstractCode>';
|
|
|
|
type Code extends AbstractCode generates 'TNode<Code>';
|
2018-05-09 08:16:07 +00:00
|
|
|
type JSReceiver extends HeapObject generates 'TNode<JSReceiver>';
|
2018-10-24 09:31:21 +00:00
|
|
|
type Constructor extends JSReceiver generates 'TNode<JSReceiver>';
|
2018-04-16 09:24:22 +00:00
|
|
|
type Context extends HeapObject generates 'TNode<Context>';
|
2018-09-28 11:28:29 +00:00
|
|
|
type NativeContext extends Context generates 'TNode<Context>';
|
2018-07-03 12:02:05 +00:00
|
|
|
type String extends HeapObject generates 'TNode<String>';
|
2018-04-16 09:24:22 +00:00
|
|
|
type Oddball extends HeapObject generates 'TNode<Oddball>';
|
2018-05-09 08:16:07 +00:00
|
|
|
type HeapNumber extends HeapObject generates 'TNode<HeapNumber>';
|
2018-10-24 11:28:28 +00:00
|
|
|
type Number = Smi | HeapNumber;
|
2018-06-15 12:23:58 +00:00
|
|
|
type BigInt extends HeapObject generates 'TNode<BigInt>';
|
2018-10-24 11:28:28 +00:00
|
|
|
type Numeric = Number | BigInt;
|
2018-04-16 09:24:22 +00:00
|
|
|
type Boolean extends Oddball generates 'TNode<Oddball>';
|
2018-05-29 13:31:56 +00:00
|
|
|
type JSProxy extends JSReceiver generates 'TNode<JSProxy>';
|
2018-05-29 08:34:01 +00:00
|
|
|
type JSObject extends JSReceiver generates 'TNode<JSObject>';
|
2018-09-28 11:28:29 +00:00
|
|
|
type JSArgumentsObjectWithLength extends JSObject
|
|
|
|
generates 'TNode<JSArgumentsObjectWithLength>';
|
|
|
|
type JSArray extends JSArgumentsObjectWithLength
|
|
|
|
generates 'TNode<JSArray>';
|
2018-10-27 11:56:57 +00:00
|
|
|
transient type FastJSArray extends JSArray
|
2018-10-19 16:00:14 +00:00
|
|
|
generates 'TNode<JSArray>';
|
2018-10-27 11:56:57 +00:00
|
|
|
transient type FastJSArrayForCopy extends FastJSArray
|
2018-10-19 16:00:14 +00:00
|
|
|
generates 'TNode<JSArray>';
|
2018-05-29 13:31:56 +00:00
|
|
|
type JSFunction extends JSObject generates 'TNode<JSFunction>';
|
|
|
|
type JSBoundFunction extends JSObject generates 'TNode<JSBoundFunction>';
|
2018-10-24 11:28:28 +00:00
|
|
|
type Callable = JSFunction | JSBoundFunction | JSProxy;
|
2018-05-09 08:16:07 +00:00
|
|
|
type Map extends HeapObject generates 'TNode<Map>';
|
|
|
|
type FixedArrayBase extends HeapObject generates 'TNode<FixedArrayBase>';
|
2018-04-16 09:24:22 +00:00
|
|
|
type FixedArray extends FixedArrayBase generates 'TNode<FixedArray>';
|
2018-09-24 09:28:48 +00:00
|
|
|
type FixedDoubleArray extends FixedArrayBase
|
|
|
|
generates 'TNode<FixedDoubleArray>';
|
|
|
|
type FixedTypedArrayBase extends FixedArrayBase
|
|
|
|
generates 'TNode<FixedTypedArrayBase>';
|
|
|
|
type FixedTypedArray extends FixedTypedArrayBase
|
|
|
|
generates 'TNode<FixedTypedArray>';
|
2018-10-19 16:00:14 +00:00
|
|
|
type SloppyArgumentsElements extends FixedArray
|
|
|
|
generates 'TNode<FixedArray>';
|
2018-09-24 09:28:48 +00:00
|
|
|
type NumberDictionary extends HeapObject
|
|
|
|
generates 'TNode<NumberDictionary>';
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-28 11:28:29 +00:00
|
|
|
type NativeContextSlot generates 'TNode<IntPtrT>' constexpr 'int32_t';
|
2018-10-16 12:52:25 +00:00
|
|
|
const ARRAY_JOIN_STACK_INDEX: constexpr NativeContextSlot
|
|
|
|
generates 'Context::ARRAY_JOIN_STACK_INDEX';
|
2018-09-28 11:28:29 +00:00
|
|
|
extern operator '[]' macro LoadContextElement(
|
|
|
|
NativeContext, NativeContextSlot): Object;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '[]=' macro StoreContextElement(
|
|
|
|
NativeContext, NativeContextSlot, Object): void;
|
2018-09-28 11:28:29 +00:00
|
|
|
|
|
|
|
extern operator '[]' macro LoadContextElement(Context, intptr): Object;
|
|
|
|
extern operator '[]' macro LoadContextElement(Context, Smi): Object;
|
|
|
|
|
2018-05-29 08:34:01 +00:00
|
|
|
type JSArrayBuffer extends JSObject generates 'TNode<JSArrayBuffer>';
|
2018-09-24 09:28:48 +00:00
|
|
|
type JSArrayBufferView extends JSObject
|
|
|
|
generates 'TNode<JSArrayBufferView>';
|
|
|
|
type JSTypedArray extends JSArrayBufferView
|
|
|
|
generates 'TNode<JSTypedArray>';
|
2018-05-24 13:43:57 +00:00
|
|
|
type JSDataView extends JSArrayBufferView generates 'TNode<JSDataView>';
|
2018-04-25 08:14:09 +00:00
|
|
|
|
2018-05-29 08:34:01 +00:00
|
|
|
type InstanceType generates 'TNode<Int32T>' constexpr 'InstanceType';
|
2018-05-04 15:04:42 +00:00
|
|
|
type ElementsKind generates 'TNode<Int32T>' constexpr 'ElementsKind';
|
|
|
|
type LanguageMode generates 'TNode<Smi>' constexpr 'LanguageMode';
|
2018-09-24 09:28:48 +00:00
|
|
|
type ExtractFixedArrayFlags
|
|
|
|
generates 'TNode<Smi>' constexpr 'ExtractFixedArrayFlags';
|
2018-06-05 07:54:49 +00:00
|
|
|
type ParameterMode generates 'TNode<Int32T>' constexpr 'ParameterMode';
|
2018-09-20 10:14:46 +00:00
|
|
|
type RootIndex generates 'TNode<Int32T>' constexpr 'RootIndex';
|
2018-09-24 09:28:48 +00:00
|
|
|
type WriteBarrierMode
|
|
|
|
generates 'TNode<Int32T>' constexpr 'WriteBarrierMode';
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-10-11 21:35:34 +00:00
|
|
|
type MessageTemplate constexpr 'MessageTemplate';
|
2018-08-02 14:41:58 +00:00
|
|
|
type ToIntegerTruncationMode constexpr 'ToIntegerTruncationMode';
|
2018-10-16 12:52:25 +00:00
|
|
|
type AllocationFlags constexpr 'AllocationFlags';
|
2018-08-02 14:41:58 +00:00
|
|
|
|
2018-06-22 08:26:19 +00:00
|
|
|
const NO_ELEMENTS: constexpr ElementsKind generates 'NO_ELEMENTS';
|
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
const PACKED_SMI_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'PACKED_SMI_ELEMENTS';
|
|
|
|
const HOLEY_SMI_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'HOLEY_SMI_ELEMENTS';
|
2018-09-25 10:59:03 +00:00
|
|
|
const PACKED_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'PACKED_ELEMENTS';
|
2018-06-22 08:26:19 +00:00
|
|
|
const HOLEY_ELEMENTS: constexpr ElementsKind generates 'HOLEY_ELEMENTS';
|
2018-09-24 09:28:48 +00:00
|
|
|
const PACKED_DOUBLE_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'PACKED_DOUBLE_ELEMENTS';
|
|
|
|
const HOLEY_DOUBLE_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'HOLEY_DOUBLE_ELEMENTS';
|
|
|
|
const DICTIONARY_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'DICTIONARY_ELEMENTS';
|
2018-06-22 08:26:19 +00:00
|
|
|
|
|
|
|
const UINT8_ELEMENTS: constexpr ElementsKind generates 'UINT8_ELEMENTS';
|
|
|
|
const INT8_ELEMENTS: constexpr ElementsKind generates 'INT8_ELEMENTS';
|
2018-09-25 10:59:03 +00:00
|
|
|
const UINT16_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'UINT16_ELEMENTS';
|
2018-06-22 08:26:19 +00:00
|
|
|
const INT16_ELEMENTS: constexpr ElementsKind generates 'INT16_ELEMENTS';
|
2018-09-25 10:59:03 +00:00
|
|
|
const UINT32_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'UINT32_ELEMENTS';
|
2018-06-22 08:26:19 +00:00
|
|
|
const INT32_ELEMENTS: constexpr ElementsKind generates 'INT32_ELEMENTS';
|
2018-09-25 10:59:03 +00:00
|
|
|
const FLOAT32_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'FLOAT32_ELEMENTS';
|
|
|
|
const FLOAT64_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'FLOAT64_ELEMENTS';
|
2018-09-24 09:28:48 +00:00
|
|
|
const UINT8_CLAMPED_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'UINT8_CLAMPED_ELEMENTS';
|
|
|
|
const BIGUINT64_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'BIGUINT64_ELEMENTS';
|
|
|
|
const BIGINT64_ELEMENTS:
|
|
|
|
constexpr ElementsKind generates 'BIGINT64_ELEMENTS';
|
2018-05-04 15:04:42 +00:00
|
|
|
|
2018-10-16 12:52:25 +00:00
|
|
|
const kNone: constexpr AllocationFlags generates 'kNone';
|
|
|
|
const kDoubleAlignment:
|
|
|
|
constexpr AllocationFlags generates 'kDoubleAlignment';
|
|
|
|
const kPretenured: constexpr AllocationFlags generates 'kPretenured';
|
|
|
|
const kAllowLargeObjectAllocation:
|
|
|
|
constexpr AllocationFlags generates 'kAllowLargeObjectAllocation';
|
|
|
|
|
2018-05-24 09:25:58 +00:00
|
|
|
type FixedUint8Array extends FixedTypedArray;
|
|
|
|
type FixedInt8Array extends FixedTypedArray;
|
|
|
|
type FixedUint16Array extends FixedTypedArray;
|
|
|
|
type FixedInt16Array extends FixedTypedArray;
|
|
|
|
type FixedUint32Array extends FixedTypedArray;
|
|
|
|
type FixedInt32Array extends FixedTypedArray;
|
|
|
|
type FixedFloat32Array extends FixedTypedArray;
|
|
|
|
type FixedFloat64Array extends FixedTypedArray;
|
|
|
|
type FixedUint8ClampedArray extends FixedTypedArray;
|
|
|
|
type FixedBigUint64Array extends FixedTypedArray;
|
|
|
|
type FixedBigInt64Array extends FixedTypedArray;
|
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
const kFixedDoubleArrays: constexpr ExtractFixedArrayFlags
|
|
|
|
generates 'ExtractFixedArrayFlag::kFixedDoubleArrays';
|
|
|
|
const kAllFixedArrays: constexpr ExtractFixedArrayFlags
|
|
|
|
generates 'ExtractFixedArrayFlag::kAllFixedArrays';
|
|
|
|
const kFixedArrays: constexpr ExtractFixedArrayFlags
|
|
|
|
generates 'ExtractFixedArrayFlag::kFixedArrays';
|
|
|
|
|
|
|
|
const kFixedCOWArrayMapRootIndex:
|
|
|
|
constexpr RootIndex generates 'RootIndex::kFixedCOWArrayMap';
|
|
|
|
const kEmptyFixedArrayRootIndex:
|
|
|
|
constexpr RootIndex generates 'RootIndex::kEmptyFixedArray';
|
2018-10-16 12:52:25 +00:00
|
|
|
const kTheHoleValueRootIndex:
|
|
|
|
constexpr RootIndex generates 'RootIndex::kTheHoleValue';
|
2018-09-24 09:28:48 +00:00
|
|
|
|
|
|
|
const kInvalidArrayLength: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kInvalidArrayLength';
|
|
|
|
const kCalledNonCallable: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kCalledNonCallable';
|
|
|
|
const kCalledOnNullOrUndefined: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kCalledOnNullOrUndefined';
|
2018-06-22 08:26:19 +00:00
|
|
|
|
|
|
|
const kMaxSafeInteger: constexpr float64 generates 'kMaxSafeInteger';
|
2018-10-16 12:52:25 +00:00
|
|
|
const kStringMaxLength: constexpr int31 generates 'String::kMaxLength';
|
|
|
|
const kFixedArrayMaxLength:
|
|
|
|
constexpr int31 generates 'FixedArray::kMaxLength';
|
2018-06-22 08:26:19 +00:00
|
|
|
|
2018-10-19 16:00:14 +00:00
|
|
|
const kMaxRegularHeapObjectSize: constexpr int31
|
|
|
|
generates 'kMaxRegularHeapObjectSize';
|
|
|
|
|
|
|
|
const kMaxNewSpaceFixedArrayElements: constexpr int31
|
|
|
|
generates 'FixedArray::kMaxRegularLength';
|
|
|
|
const kSloppyArgumentsArgumentsIndex: constexpr int31
|
|
|
|
generates 'SloppyArgumentsElements::kArgumentsIndex';
|
|
|
|
const kSloppyArgumentsContextIndex: constexpr int31
|
|
|
|
generates 'SloppyArgumentsElements::kContextIndex';
|
|
|
|
const kSloppyArgumentsParameterMapStart: constexpr int31
|
|
|
|
generates 'SloppyArgumentsElements::kParameterMapStart';
|
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
const kTruncateMinusZero: constexpr ToIntegerTruncationMode
|
|
|
|
generates 'ToIntegerTruncationMode::kTruncateMinusZero';
|
|
|
|
|
2018-09-25 10:59:03 +00:00
|
|
|
const kNotTypedArray: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kNotTypedArray';
|
2018-09-24 09:28:48 +00:00
|
|
|
const kDetachedOperation: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kDetachedOperation';
|
|
|
|
const kBadSortComparisonFunction: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kBadSortComparisonFunction';
|
|
|
|
const kIncompatibleMethodReceiver: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kIncompatibleMethodReceiver';
|
|
|
|
const kInvalidDataViewAccessorOffset: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kInvalidDataViewAccessorOffset';
|
|
|
|
const kStrictReadOnlyProperty: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kStrictReadOnlyProperty';
|
2018-06-22 08:26:19 +00:00
|
|
|
|
2018-07-13 11:09:17 +00:00
|
|
|
extern macro TheHoleConstant(): Oddball;
|
|
|
|
extern macro NullConstant(): Oddball;
|
|
|
|
extern macro UndefinedConstant(): Oddball;
|
|
|
|
extern macro TrueConstant(): Boolean;
|
|
|
|
extern macro FalseConstant(): Boolean;
|
2018-08-22 13:17:38 +00:00
|
|
|
extern macro Int32TrueConstant(): bool;
|
|
|
|
extern macro Int32FalseConstant(): bool;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro EmptyStringConstant(): String;
|
2018-09-03 05:40:21 +00:00
|
|
|
extern macro LengthStringConstant(): String;
|
2018-07-13 11:09:17 +00:00
|
|
|
|
|
|
|
const Hole: Oddball = TheHoleConstant();
|
|
|
|
const Null: Oddball = NullConstant();
|
|
|
|
const Undefined: Oddball = UndefinedConstant();
|
|
|
|
const True: Boolean = TrueConstant();
|
|
|
|
const False: Boolean = FalseConstant();
|
2018-10-16 12:52:25 +00:00
|
|
|
const kEmptyString: String = EmptyStringConstant();
|
2018-09-03 05:40:21 +00:00
|
|
|
const kLengthString: String = LengthStringConstant();
|
2018-07-13 11:09:17 +00:00
|
|
|
|
2018-06-22 08:26:19 +00:00
|
|
|
const true: constexpr bool generates 'true';
|
|
|
|
const false: constexpr bool generates 'false';
|
|
|
|
|
|
|
|
const kStrict: constexpr LanguageMode generates 'LanguageMode::kStrict';
|
|
|
|
const kSloppy: constexpr LanguageMode generates 'LanguageMode::kSloppy';
|
|
|
|
|
|
|
|
const SMI_PARAMETERS: constexpr ParameterMode generates 'SMI_PARAMETERS';
|
2018-09-24 09:28:48 +00:00
|
|
|
const INTPTR_PARAMETERS:
|
|
|
|
constexpr ParameterMode generates 'INTPTR_PARAMETERS';
|
2018-06-05 07:54:49 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
const SKIP_WRITE_BARRIER:
|
|
|
|
constexpr WriteBarrierMode generates 'SKIP_WRITE_BARRIER';
|
2018-08-13 08:43:56 +00:00
|
|
|
|
2018-06-15 12:23:58 +00:00
|
|
|
extern macro Is64(): constexpr bool;
|
|
|
|
|
2018-08-22 13:17:38 +00:00
|
|
|
extern macro SelectBooleanConstant(bool): Boolean;
|
|
|
|
|
2018-07-03 12:02:05 +00:00
|
|
|
extern macro Print(constexpr string);
|
|
|
|
extern macro Print(constexpr string, Object);
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro Comment(constexpr string);
|
2018-04-16 09:24:22 +00:00
|
|
|
extern macro Print(Object);
|
|
|
|
extern macro DebugBreak();
|
|
|
|
extern macro ToInteger_Inline(Context, Object): Number;
|
2018-08-02 14:41:58 +00:00
|
|
|
extern macro ToInteger_Inline(
|
|
|
|
Context, Object, constexpr ToIntegerTruncationMode): Number;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern macro ToLength_Inline(Context, Object): Number;
|
2018-04-25 08:14:09 +00:00
|
|
|
extern macro ToNumber_Inline(Context, Object): Number;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern macro ToString_Inline(Context, Object): String;
|
2018-10-27 11:56:57 +00:00
|
|
|
extern transitioning macro GetProperty(implicit context: Context)(
|
|
|
|
Object, Object): Object;
|
|
|
|
extern transitioning builtin SetProperty(implicit context: Context)(
|
|
|
|
Object, Object, Object);
|
|
|
|
extern transitioning builtin DeleteProperty(implicit context: Context)(
|
2018-10-11 08:52:36 +00:00
|
|
|
Object, Object, LanguageMode);
|
2018-10-27 11:56:57 +00:00
|
|
|
extern transitioning builtin HasProperty(implicit context: Context)(
|
2018-10-11 08:52:36 +00:00
|
|
|
JSReceiver, Object): Boolean;
|
2018-10-27 11:56:57 +00:00
|
|
|
extern transitioning macro HasProperty_Inline(implicit context: Context)(
|
2018-10-11 08:52:36 +00:00
|
|
|
JSReceiver, Object): Boolean;
|
2018-08-07 15:49:03 +00:00
|
|
|
|
2018-05-29 08:34:01 +00:00
|
|
|
extern macro ThrowRangeError(Context, constexpr MessageTemplate): never;
|
|
|
|
extern macro ThrowTypeError(Context, constexpr MessageTemplate): never;
|
|
|
|
extern macro ThrowTypeError(Context, constexpr MessageTemplate, Object): never;
|
2018-08-07 15:49:03 +00:00
|
|
|
extern macro ThrowTypeError(
|
|
|
|
Context, constexpr MessageTemplate, Object, Object, Object): never;
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro ArraySpeciesCreate(Context, Object, Number): JSReceiver;
|
2018-10-24 09:31:21 +00:00
|
|
|
extern macro ArrayCreate(implicit context: Context)(Number): JSArray;
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro InternalArrayCreate(Context, Number): JSArray;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro EnsureArrayPushable(Map): ElementsKind
|
|
|
|
labels Bailout;
|
2018-09-06 05:47:23 +00:00
|
|
|
extern macro EnsureArrayLengthWritable(Map) labels Bailout;
|
2018-10-24 09:31:21 +00:00
|
|
|
// TODO: Reduce duplication once varargs are supported in macros.
|
|
|
|
extern macro Construct(implicit context: Context)(
|
|
|
|
Constructor, Object): JSReceiver;
|
|
|
|
extern macro Construct(implicit context: Context)(
|
|
|
|
Constructor, Object, Object): JSReceiver;
|
|
|
|
extern macro Construct(implicit context: Context)(
|
|
|
|
Constructor, Object, Object, Object): JSReceiver;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-06-07 11:48:26 +00:00
|
|
|
extern builtin ToObject(Context, Object): JSReceiver;
|
2018-08-10 08:35:23 +00:00
|
|
|
extern macro ToObject_Inline(Context, Object): JSReceiver;
|
2018-05-09 08:16:07 +00:00
|
|
|
extern macro IsNullOrUndefined(Object): bool;
|
2018-06-05 07:54:49 +00:00
|
|
|
extern macro IsTheHole(Object): bool;
|
|
|
|
extern macro IsString(HeapObject): bool;
|
|
|
|
extern builtin ToString(Context, Object): String;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-10-27 11:56:57 +00:00
|
|
|
extern transitioning runtime NormalizeElements(Context, JSObject);
|
|
|
|
extern transitioning runtime TransitionElementsKindWithKind(
|
|
|
|
Context, JSObject, Smi);
|
|
|
|
extern transitioning runtime CreateDataProperty(implicit context: Context)(
|
2018-10-11 08:52:36 +00:00
|
|
|
JSReceiver, Object, Object);
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-20 10:14:46 +00:00
|
|
|
extern macro LoadRoot(constexpr RootIndex): Object;
|
|
|
|
extern macro StoreRoot(constexpr RootIndex, Object): Object;
|
|
|
|
extern macro LoadAndUntagToWord32Root(constexpr RootIndex): int32;
|
2018-06-07 11:48:26 +00:00
|
|
|
|
2018-04-16 09:24:22 +00:00
|
|
|
extern runtime StringEqual(Context, String, String): Oddball;
|
2018-06-05 07:54:49 +00:00
|
|
|
extern builtin StringLessThan(Context, String, String): Boolean;
|
|
|
|
|
|
|
|
extern macro StrictEqual(Object, Object): Boolean;
|
2018-09-05 09:28:55 +00:00
|
|
|
extern macro SmiLexicographicCompare(Smi, Smi): Smi;
|
2018-10-16 21:14:05 +00:00
|
|
|
extern runtime ReThrow(Context, Object): never;
|
2018-11-07 07:28:15 +00:00
|
|
|
extern runtime ThrowInvalidStringLength(Context): never;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '<' macro Int32LessThan(int32, int32): bool;
|
|
|
|
extern operator '>' macro Int32GreaterThan(int32, int32): bool;
|
|
|
|
extern operator '<=' macro Int32LessThanOrEqual(int32, int32): bool;
|
|
|
|
extern operator '>=' macro Int32GreaterThanOrEqual(int32, int32): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '==' macro SmiEqual(Smi, Smi): bool;
|
|
|
|
extern operator '!=' macro SmiNotEqual(Smi, Smi): bool;
|
|
|
|
extern operator '<' macro SmiLessThan(Smi, Smi): bool;
|
|
|
|
extern operator '<=' macro SmiLessThanOrEqual(Smi, Smi): bool;
|
|
|
|
extern operator '>' macro SmiGreaterThan(Smi, Smi): bool;
|
|
|
|
extern operator '>=' macro SmiGreaterThanOrEqual(Smi, Smi): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-13 10:10:44 +00:00
|
|
|
extern operator '==' macro ElementsKindEqual(
|
|
|
|
constexpr ElementsKind, constexpr ElementsKind): constexpr bool;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern operator '==' macro ElementsKindEqual(ElementsKind, ElementsKind): bool;
|
2018-09-04 12:30:33 +00:00
|
|
|
operator '!=' macro ElementsKindNotEqual(
|
|
|
|
k1: ElementsKind, k2: ElementsKind): bool {
|
|
|
|
return !ElementsKindEqual(k1, k2);
|
|
|
|
}
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro IsElementsKindLessThanOrEqual(
|
|
|
|
ElementsKind, constexpr ElementsKind): bool;
|
|
|
|
extern macro IsElementsKindGreaterThan(
|
|
|
|
ElementsKind, constexpr ElementsKind): bool;
|
2018-05-13 10:10:44 +00:00
|
|
|
extern macro IsFastElementsKind(constexpr ElementsKind): constexpr bool;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro IsDoubleElementsKind(constexpr ElementsKind): constexpr bool;
|
2018-05-13 10:10:44 +00:00
|
|
|
|
2018-10-19 16:00:14 +00:00
|
|
|
extern macro IsFastAliasedArgumentsMap(implicit context: Context)(Map): bool;
|
|
|
|
extern macro IsSlowAliasedArgumentsMap(implicit context: Context)(Map): bool;
|
|
|
|
extern macro IsSloppyArgumentsMap(implicit context: Context)(Map): bool;
|
|
|
|
extern macro IsStrictArgumentsMap(implicit context: Context)(Map): bool;
|
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro SmiAbove(Smi, Smi): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '==' macro WordEqual(intptr, intptr): bool;
|
2018-06-18 14:16:44 +00:00
|
|
|
extern operator '==' macro WordEqual(uintptr, uintptr): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '!=' macro WordNotEqual(intptr, intptr): bool;
|
2018-06-18 14:16:44 +00:00
|
|
|
extern operator '!=' macro WordNotEqual(uintptr, uintptr): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '<' macro IntPtrLessThan(intptr, intptr): bool;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '<' macro UintPtrLessThan(uintptr, uintptr): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '>' macro IntPtrGreaterThan(intptr, intptr): bool;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '>' macro UintPtrGreaterThan(uintptr, uintptr): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '<=' macro IntPtrLessThanOrEqual(intptr, intptr): bool;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '<=' macro UintPtrLessThanOrEqual(uintptr, uintptr): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '>=' macro IntPtrGreaterThanOrEqual(intptr, intptr): bool;
|
2018-06-18 14:16:44 +00:00
|
|
|
extern operator '>=' macro UintPtrGreaterThanOrEqual(uintptr, uintptr): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '==' macro Float64Equal(float64, float64): bool;
|
2018-06-08 11:12:59 +00:00
|
|
|
extern operator '!=' macro Float64NotEqual(float64, float64): bool;
|
2018-09-18 17:47:28 +00:00
|
|
|
extern operator '>' macro Float64GreaterThan(float64, float64): bool;
|
2018-04-25 08:14:09 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '==' macro BranchIfNumberEqual(Number, Number): never
|
|
|
|
labels Taken, NotTaken;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '!=' macro BranchIfNumberNotEqual(Number, Number): never
|
|
|
|
labels Taken, NotTaken;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '<' macro BranchIfNumberLessThan(Number, Number): never
|
|
|
|
labels Taken, NotTaken;
|
|
|
|
extern operator '<=' macro BranchIfNumberLessThanOrEqual(Number, Number): never
|
|
|
|
labels Taken, NotTaken;
|
|
|
|
|
|
|
|
extern operator '>' macro BranchIfNumberGreaterThan(Number, Number): never
|
|
|
|
labels Taken, NotTaken;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern operator '>=' macro BranchIfNumberGreaterThanOrEqual(Number, Number):
|
2018-09-24 09:28:48 +00:00
|
|
|
never
|
|
|
|
labels Taken, NotTaken;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '==' macro WordEqual(Object, Object): bool;
|
|
|
|
extern operator '!=' macro WordNotEqual(Object, Object): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
|
|
|
extern operator '+' macro SmiAdd(Smi, Smi): Smi;
|
|
|
|
extern operator '-' macro SmiSub(Smi, Smi): Smi;
|
2018-06-06 12:30:08 +00:00
|
|
|
extern operator '&' macro SmiAnd(Smi, Smi): Smi;
|
2018-08-22 13:17:38 +00:00
|
|
|
extern operator '|' macro SmiOr(Smi, Smi): Smi;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '>>>' macro SmiShr(Smi, constexpr int31): Smi;
|
2018-08-22 13:17:38 +00:00
|
|
|
extern operator '<<' macro SmiShl(Smi, constexpr int31): Smi;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
|
|
|
extern operator '+' macro IntPtrAdd(intptr, intptr): intptr;
|
|
|
|
extern operator '-' macro IntPtrSub(intptr, intptr): intptr;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '*' macro IntPtrMul(intptr, intptr): intptr;
|
2018-10-18 12:53:22 +00:00
|
|
|
extern operator '/' macro IntPtrDiv(intptr, intptr): intptr;
|
2018-06-15 12:23:58 +00:00
|
|
|
extern operator '<<' macro WordShl(intptr, intptr): intptr;
|
|
|
|
extern operator '&' macro WordAnd(intptr, intptr): intptr;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '|' macro WordOr(intptr, intptr): intptr;
|
|
|
|
|
|
|
|
extern operator '+' macro UintPtrAdd(uintptr, uintptr): uintptr;
|
|
|
|
extern operator '-' macro UintPtrSub(uintptr, uintptr): uintptr;
|
|
|
|
extern operator '>>>' macro WordShr(uintptr, uintptr): uintptr;
|
|
|
|
extern operator '<<' macro WordShl(uintptr, uintptr): uintptr;
|
2018-06-25 13:28:25 +00:00
|
|
|
extern operator '&' macro WordAnd(uintptr, uintptr): uintptr;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '|' macro WordOr(uintptr, uintptr): uintptr;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-06-06 12:30:08 +00:00
|
|
|
extern operator '+' macro Int32Add(int32, int32): int32;
|
2018-06-15 12:23:58 +00:00
|
|
|
extern operator '-' macro Int32Sub(int32, int32): int32;
|
2018-06-06 12:30:08 +00:00
|
|
|
extern operator '*' macro Int32Mul(int32, int32): int32;
|
|
|
|
extern operator '%' macro Int32Mod(int32, int32): int32;
|
2018-06-25 13:28:25 +00:00
|
|
|
extern operator '&' macro Word32And(int32, int32): int32;
|
|
|
|
extern operator '&' macro Word32And(uint32, uint32): uint32;
|
2018-06-19 15:58:56 +00:00
|
|
|
extern operator '==' macro
|
2018-06-22 08:26:19 +00:00
|
|
|
ConstexprInt31Equal(constexpr int31, constexpr int31): constexpr bool;
|
2018-06-15 12:23:58 +00:00
|
|
|
|
2018-06-25 13:28:25 +00:00
|
|
|
extern operator '==' macro Word32Equal(int32, int32): bool;
|
|
|
|
extern operator '==' macro Word32Equal(uint32, uint32): bool;
|
|
|
|
extern operator '!=' macro Word32NotEqual(int32, int32): bool;
|
|
|
|
extern operator '!=' macro Word32NotEqual(uint32, uint32): bool;
|
|
|
|
extern operator '>>>' macro Word32Shr(uint32, uint32): uint32;
|
|
|
|
extern operator '<<' macro Word32Shl(int32, int32): int32;
|
|
|
|
extern operator '<<' macro Word32Shl(uint32, uint32): uint32;
|
|
|
|
extern operator '|' macro Word32Or(int32, int32): int32;
|
|
|
|
extern operator '|' macro Word32Or(uint32, uint32): uint32;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '&' macro Word32And(bool, bool): bool;
|
|
|
|
extern operator '|' macro Word32Or(bool, bool): bool;
|
2018-06-06 12:30:08 +00:00
|
|
|
|
2018-09-18 17:47:28 +00:00
|
|
|
extern operator '+' macro Float64Add(float64, float64): float64;
|
|
|
|
|
2018-04-16 09:24:22 +00:00
|
|
|
extern operator '+' macro NumberAdd(Number, Number): Number;
|
|
|
|
extern operator '-' macro NumberSub(Number, Number): Number;
|
2018-07-18 18:03:45 +00:00
|
|
|
extern macro NumberMin(Number, Number): Number;
|
|
|
|
extern macro NumberMax(Number, Number): Number;
|
2018-09-11 13:15:02 +00:00
|
|
|
macro Min(x: Number, y: Number): Number {
|
2018-08-07 15:49:03 +00:00
|
|
|
return NumberMin(x, y);
|
2018-07-18 18:03:45 +00:00
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
macro Max(x: Number, y: Number): Number {
|
2018-08-07 15:49:03 +00:00
|
|
|
return NumberMax(x, y);
|
2018-07-18 18:03:45 +00:00
|
|
|
}
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-08-22 13:17:38 +00:00
|
|
|
extern macro SmiMax(Smi, Smi): Smi;
|
|
|
|
extern macro SmiMin(Smi, Smi): Smi;
|
|
|
|
|
2018-05-13 10:10:44 +00:00
|
|
|
extern operator '!' macro ConstexprBoolNot(constexpr bool): constexpr bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '!' macro Word32BinaryNot(bool): bool;
|
2018-08-22 13:17:38 +00:00
|
|
|
extern operator '!' macro IsFalse(Boolean): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-09 08:16:07 +00:00
|
|
|
extern operator '.map' macro LoadMap(HeapObject): Map;
|
2018-10-27 11:56:57 +00:00
|
|
|
extern transitioning operator '.map=' macro StoreMap(HeapObject, Map);
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '.instanceType' macro LoadInstanceType(HeapObject):
|
|
|
|
InstanceType;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
|
|
|
extern operator '.length' macro LoadStringLengthAsWord(String): intptr;
|
|
|
|
|
2018-05-29 08:34:01 +00:00
|
|
|
extern operator '.length' macro GetArgumentsLength(constexpr Arguments): intptr;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '[]' macro GetArgumentValue(
|
|
|
|
constexpr Arguments, intptr): Object;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro TaggedIsSmi(Object): bool;
|
|
|
|
extern macro TaggedIsNotSmi(Object): bool;
|
2018-06-07 11:48:26 +00:00
|
|
|
extern macro TaggedIsPositiveSmi(Object): bool;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro IsValidPositiveSmi(intptr): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro HeapObjectToJSDataView(HeapObject): JSDataView
|
|
|
|
labels CastError;
|
|
|
|
extern macro TaggedToHeapObject(Object): HeapObject
|
|
|
|
labels CastError;
|
|
|
|
extern macro TaggedToSmi(Object): Smi
|
|
|
|
labels CastError;
|
|
|
|
extern macro HeapObjectToJSArray(HeapObject): JSArray
|
|
|
|
labels CastError;
|
|
|
|
extern macro HeapObjectToCallable(HeapObject): Callable
|
|
|
|
labels CastError;
|
|
|
|
extern macro HeapObjectToFixedArray(HeapObject): FixedArray
|
|
|
|
labels CastError;
|
|
|
|
extern macro HeapObjectToFixedDoubleArray(HeapObject): FixedDoubleArray
|
|
|
|
labels CastError;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro HeapObjectToString(HeapObject): String
|
|
|
|
labels CastError;
|
2018-10-24 09:31:21 +00:00
|
|
|
extern macro HeapObjectToConstructor(HeapObject): Constructor
|
|
|
|
labels CastError;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro HeapObjectToHeapNumber(HeapObject): HeapNumber
|
|
|
|
labels CastError;
|
2018-10-19 16:00:14 +00:00
|
|
|
extern macro HeapObjectToSloppyArgumentsElements(HeapObject):
|
|
|
|
SloppyArgumentsElements
|
|
|
|
labels CastError;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro TaggedToNumber(Object): Number
|
|
|
|
labels CastError;
|
|
|
|
|
|
|
|
macro CastHeapObject<A: type>(o: HeapObject): A
|
|
|
|
labels CastError;
|
|
|
|
CastHeapObject<HeapObject>(o: HeapObject): HeapObject
|
|
|
|
labels CastError {
|
2018-09-04 12:30:33 +00:00
|
|
|
return o;
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
CastHeapObject<FixedArray>(o: HeapObject): FixedArray
|
|
|
|
labels CastError {
|
2018-08-07 21:57:19 +00:00
|
|
|
return HeapObjectToFixedArray(o) otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
CastHeapObject<FixedDoubleArray>(o: HeapObject): FixedDoubleArray
|
|
|
|
labels CastError {
|
2018-08-07 21:57:19 +00:00
|
|
|
return HeapObjectToFixedDoubleArray(o) otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-10-19 16:00:14 +00:00
|
|
|
CastHeapObject<SloppyArgumentsElements>(o: HeapObject): SloppyArgumentsElements
|
|
|
|
labels CastError {
|
|
|
|
return HeapObjectToSloppyArgumentsElements(o) otherwise CastError;
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
CastHeapObject<JSDataView>(o: HeapObject): JSDataView
|
|
|
|
labels CastError {
|
2018-08-07 21:57:19 +00:00
|
|
|
return HeapObjectToJSDataView(o) otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
CastHeapObject<Callable>(o: HeapObject): Callable
|
|
|
|
labels CastError {
|
2018-08-07 21:57:19 +00:00
|
|
|
return HeapObjectToCallable(o) otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
CastHeapObject<JSArray>(o: HeapObject): JSArray
|
|
|
|
labels CastError {
|
2018-08-07 21:57:19 +00:00
|
|
|
return HeapObjectToJSArray(o) otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-10-16 12:52:25 +00:00
|
|
|
CastHeapObject<String>(o: HeapObject): String
|
|
|
|
labels CastError {
|
|
|
|
return HeapObjectToString(o) otherwise CastError;
|
|
|
|
}
|
2018-10-24 09:31:21 +00:00
|
|
|
CastHeapObject<Constructor>(o: HeapObject): Constructor
|
|
|
|
labels CastError {
|
|
|
|
return HeapObjectToConstructor(o) otherwise CastError;
|
|
|
|
}
|
2018-08-07 21:57:19 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Cast<A: type>(o: HeapObject): A
|
|
|
|
labels CastError {
|
2018-09-11 13:15:02 +00:00
|
|
|
return CastHeapObject<A>(o) otherwise CastError;
|
2018-08-07 21:57:19 +00:00
|
|
|
}
|
|
|
|
|
2018-09-11 13:15:02 +00:00
|
|
|
// CastHeapObject allows this default-implementation to be non-recursive.
|
2018-08-07 21:57:19 +00:00
|
|
|
// Otherwise the generated CSA code might run into infinite recursion.
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Cast<A: type>(o: Object): A
|
|
|
|
labels CastError {
|
2018-09-11 13:15:02 +00:00
|
|
|
return CastHeapObject<A>(TaggedToHeapObject(o) otherwise CastError)
|
2018-09-24 09:28:48 +00:00
|
|
|
otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
Cast<Smi>(o: Object): Smi
|
|
|
|
labels CastError {
|
2018-08-07 21:57:19 +00:00
|
|
|
return TaggedToSmi(o) otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
Cast<Number>(o: Object): Number
|
|
|
|
labels CastError {
|
2018-08-07 21:57:19 +00:00
|
|
|
return TaggedToNumber(o) otherwise CastError;
|
2018-06-06 15:35:39 +00:00
|
|
|
}
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-09 08:16:07 +00:00
|
|
|
extern macro AllocateHeapNumberWithValue(float64): HeapNumber;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro ChangeInt32ToTagged(int32): Number;
|
|
|
|
extern macro ChangeUint32ToTagged(uint32): Number;
|
2018-09-18 17:47:28 +00:00
|
|
|
extern macro ChangeUintPtrToFloat64(uintptr): float64;
|
|
|
|
extern macro ChangeUintPtrToTagged(uintptr): Number;
|
2018-06-25 13:28:25 +00:00
|
|
|
extern macro Unsigned(int32): uint32;
|
2018-06-15 12:23:58 +00:00
|
|
|
extern macro Unsigned(intptr): uintptr;
|
2018-06-25 13:28:25 +00:00
|
|
|
extern macro Unsigned(RawPtr): uintptr;
|
|
|
|
extern macro Signed(uint32): int32;
|
2018-06-15 12:23:58 +00:00
|
|
|
extern macro Signed(uintptr): intptr;
|
2018-06-25 13:28:25 +00:00
|
|
|
extern macro Signed(RawPtr): intptr;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro TruncateIntPtrToInt32(intptr): int32;
|
|
|
|
extern macro SmiTag(intptr): Smi;
|
|
|
|
extern macro SmiFromInt32(int32): Smi;
|
|
|
|
extern macro SmiUntag(Smi): intptr;
|
|
|
|
extern macro SmiToInt32(Smi): int32;
|
2018-08-02 14:41:58 +00:00
|
|
|
extern macro RoundIntPtrToFloat64(intptr): float64;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro LoadHeapNumberValue(HeapNumber): float64;
|
|
|
|
extern macro ChangeFloat32ToFloat64(float32): float64;
|
|
|
|
extern macro ChangeNumberToFloat64(Number): float64;
|
2018-08-02 14:41:58 +00:00
|
|
|
extern macro ChangeFloat64ToUintPtr(float64): uintptr;
|
2018-08-07 15:49:03 +00:00
|
|
|
extern macro ChangeInt32ToIntPtr(int32): intptr; // Sign-extends.
|
2018-06-25 13:28:25 +00:00
|
|
|
extern macro ChangeUint32ToWord(uint32): uintptr; // Doesn't sign-extend.
|
2018-09-28 11:28:29 +00:00
|
|
|
extern macro LoadNativeContext(Context): NativeContext;
|
|
|
|
extern macro LoadJSArrayElementsMap(constexpr ElementsKind, Context): Map;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro ChangeNonnegativeNumberToUintPtr(Number): uintptr;
|
2018-06-12 11:11:44 +00:00
|
|
|
|
|
|
|
extern macro NumberConstant(constexpr float64): Number;
|
|
|
|
extern macro NumberConstant(constexpr int32): Number;
|
|
|
|
extern macro IntPtrConstant(constexpr int31): intptr;
|
|
|
|
extern macro IntPtrConstant(constexpr int32): intptr;
|
2018-07-03 12:02:05 +00:00
|
|
|
extern macro Int32Constant(constexpr int31): int31;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro Int32Constant(constexpr int32): int32;
|
2018-06-26 13:55:16 +00:00
|
|
|
extern macro Float64Constant(constexpr int31): float64;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro SmiConstant(constexpr int31): Smi;
|
|
|
|
extern macro BoolConstant(constexpr bool): bool;
|
2018-07-03 12:02:05 +00:00
|
|
|
extern macro StringConstant(constexpr string): String;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro LanguageModeConstant(constexpr LanguageMode): LanguageMode;
|
|
|
|
extern macro Int32Constant(constexpr ElementsKind): ElementsKind;
|
2018-09-28 11:28:29 +00:00
|
|
|
extern macro IntPtrConstant(constexpr NativeContextSlot): NativeContextSlot;
|
2018-06-12 11:11:44 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
macro FromConstexpr<A: type>(o: constexpr int31): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<intptr>(i: constexpr int31): intptr {
|
2018-06-12 11:11:44 +00:00
|
|
|
return IntPtrConstant(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<int31>(i: constexpr int31): int31 {
|
2018-07-03 12:02:05 +00:00
|
|
|
return Int32Constant(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<int32>(i: constexpr int31): int32 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return Int32Constant(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<uint32>(i: constexpr int31): uint32 {
|
2018-06-25 13:28:25 +00:00
|
|
|
return Unsigned(Int32Constant(i));
|
2018-06-15 12:23:58 +00:00
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<uintptr>(i: constexpr int31): uintptr {
|
2018-06-18 14:16:44 +00:00
|
|
|
return ChangeUint32ToWord(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<Smi>(i: constexpr int31): Smi {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiConstant(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<Number>(i: constexpr int31): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiConstant(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<float64>(i: constexpr int31): float64 {
|
2018-06-26 13:55:16 +00:00
|
|
|
return Float64Constant(i);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro FromConstexpr<A: type>(o: constexpr int32): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<intptr>(i: constexpr int32): intptr {
|
2018-06-12 11:11:44 +00:00
|
|
|
return IntPtrConstant(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<int32>(i: constexpr int32): int32 {
|
2018-06-15 12:30:38 +00:00
|
|
|
return Int32Constant(i);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<Number>(i: constexpr int32): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return NumberConstant(i);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro FromConstexpr<A: type>(o: constexpr float64): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<Number>(f: constexpr float64): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return NumberConstant(f);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro FromConstexpr<A: type>(b: constexpr bool): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<bool>(b: constexpr bool): bool {
|
2018-06-12 11:11:44 +00:00
|
|
|
return BoolConstant(b);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro FromConstexpr<A: type>(l: constexpr LanguageMode): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<LanguageMode>(b: constexpr LanguageMode): LanguageMode {
|
2018-06-12 11:11:44 +00:00
|
|
|
return LanguageModeConstant(b);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro FromConstexpr<A: type>(e: constexpr ElementsKind): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<ElementsKind>(e: constexpr ElementsKind): ElementsKind {
|
2018-06-12 11:11:44 +00:00
|
|
|
return Int32Constant(e);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro FromConstexpr<A: type>(s: constexpr string): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<String>(s: constexpr string): String {
|
2018-06-18 15:50:59 +00:00
|
|
|
return StringConstant(s);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
FromConstexpr<Object>(s: constexpr string): Object {
|
2018-06-18 15:50:59 +00:00
|
|
|
return StringConstant(s);
|
|
|
|
}
|
2018-09-28 11:28:29 +00:00
|
|
|
macro FromConstexpr<A: type>(e: constexpr NativeContextSlot): A;
|
|
|
|
FromConstexpr<NativeContextSlot>(c: constexpr NativeContextSlot):
|
|
|
|
NativeContextSlot {
|
|
|
|
return IntPtrConstant(c);
|
|
|
|
}
|
2018-05-09 08:16:07 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(i: constexpr int31): A {
|
2018-07-03 12:02:05 +00:00
|
|
|
return i;
|
|
|
|
}
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro ConvertElementsKindToInt(ElementsKind): int32;
|
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(elementsKind: ElementsKind): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<int32>(elementsKind: ElementsKind): int32 {
|
|
|
|
return ConvertElementsKindToInt(elementsKind);
|
2018-09-04 12:30:33 +00:00
|
|
|
}
|
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(i: int32): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<Number>(i: int32): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeInt32ToTagged(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<intptr>(i: int32): intptr {
|
2018-06-15 12:23:58 +00:00
|
|
|
return ChangeInt32ToIntPtr(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<Smi>(i: int32): Smi {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiFromInt32(i);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(ui: uint32): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<Number>(ui: uint32): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeUint32ToTagged(ui);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<Smi>(ui: uint32): Smi {
|
2018-06-25 13:28:25 +00:00
|
|
|
return SmiFromInt32(Signed(ui));
|
2018-06-15 12:23:58 +00:00
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<uintptr>(ui: uint32): uintptr {
|
2018-06-25 13:28:25 +00:00
|
|
|
return ChangeUint32ToWord(ui);
|
2018-06-15 12:23:58 +00:00
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(i: intptr): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<int32>(i: intptr): int32 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return TruncateIntPtrToInt32(i);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<Smi>(i: intptr): Smi {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiTag(i);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(ui: uintptr): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<uint32>(ui: uintptr): uint32 {
|
2018-06-25 13:28:25 +00:00
|
|
|
return Unsigned(TruncateIntPtrToInt32(Signed(ui)));
|
2018-06-18 14:16:44 +00:00
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(s: Smi): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<intptr>(s: Smi): intptr {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiUntag(s);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<int32>(s: Smi): int32 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiToInt32(s);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(h: HeapNumber): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<float64>(h: HeapNumber): float64 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return LoadHeapNumberValue(h);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(n: Number): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<float64>(n: Number): float64 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeNumberToFloat64(n);
|
|
|
|
}
|
2018-10-16 12:52:25 +00:00
|
|
|
Convert<uintptr>(n: Number): uintptr {
|
|
|
|
return ChangeNonnegativeNumberToUintPtr(n);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(f: float32): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<float64>(f: float32): float64 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeFloat32ToFloat64(f);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(d: float64): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<Number>(d: float64): Number {
|
2018-06-25 13:28:25 +00:00
|
|
|
return AllocateHeapNumberWithValue(d);
|
|
|
|
}
|
2018-09-18 17:47:28 +00:00
|
|
|
Convert<float64>(ui: uintptr): float64 {
|
|
|
|
return ChangeUintPtrToFloat64(ui);
|
|
|
|
}
|
|
|
|
Convert<Number>(ui: uintptr): Number {
|
|
|
|
return ChangeUintPtrToTagged(ui);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<uintptr>(d: float64): uintptr {
|
2018-08-02 14:41:58 +00:00
|
|
|
return ChangeFloat64ToUintPtr(d);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro Convert<A: type>(r: RawPtr): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<uintptr>(r: RawPtr): uintptr {
|
2018-06-25 13:28:25 +00:00
|
|
|
return Unsigned(r);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
Convert<intptr>(r: RawPtr): intptr {
|
2018-06-25 13:28:25 +00:00
|
|
|
return Signed(r);
|
|
|
|
}
|
2018-06-12 11:11:44 +00:00
|
|
|
|
|
|
|
extern macro UnsafeCastNumberToHeapNumber(Number): HeapNumber;
|
2018-07-13 11:09:17 +00:00
|
|
|
extern macro UnsafeCastObjectToFixedArrayBase(Object): FixedArrayBase;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro UnsafeCastObjectToFixedArray(Object): FixedArray;
|
2018-09-28 11:28:29 +00:00
|
|
|
extern macro UnsafeCastObjectToContext(Object): Context;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro UnsafeCastObjectToFixedDoubleArray(Object): FixedDoubleArray;
|
|
|
|
extern macro UnsafeCastObjectToHeapNumber(Object): HeapNumber;
|
|
|
|
extern macro UnsafeCastObjectToCallable(Object): Callable;
|
|
|
|
extern macro UnsafeCastObjectToSmi(Object): Smi;
|
|
|
|
extern macro UnsafeCastObjectToNumber(Object): Number;
|
|
|
|
extern macro UnsafeCastObjectToHeapObject(Object): HeapObject;
|
|
|
|
extern macro UnsafeCastObjectToJSArray(Object): JSArray;
|
|
|
|
extern macro UnsafeCastObjectToFixedTypedArrayBase(Object): FixedTypedArrayBase;
|
2018-06-18 09:33:18 +00:00
|
|
|
extern macro UnsafeCastObjectToNumberDictionary(Object): NumberDictionary;
|
|
|
|
extern macro UnsafeCastObjectToJSReceiver(Object): JSReceiver;
|
|
|
|
extern macro UnsafeCastObjectToJSObject(Object): JSObject;
|
2018-07-13 11:09:17 +00:00
|
|
|
extern macro UnsafeCastObjectToMap(Object): Map;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro UnsafeCastObjectToString(Object): String;
|
2018-06-12 11:11:44 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
macro UnsafeCast<A: type>(n: Number): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<HeapNumber>(n: Number): HeapNumber {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastNumberToHeapNumber(n);
|
|
|
|
}
|
2018-11-05 10:37:49 +00:00
|
|
|
UnsafeCast<Smi>(o: Number): Smi {
|
|
|
|
return UnsafeCastObjectToSmi(o);
|
|
|
|
}
|
2018-09-24 09:28:48 +00:00
|
|
|
macro UnsafeCast<A: type>(o: Object): A;
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<Object>(o: Object): Object {
|
2018-09-04 12:30:33 +00:00
|
|
|
return o;
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<FixedArray>(o: Object): FixedArray {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToFixedArray(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<FixedDoubleArray>(o: Object): FixedDoubleArray {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToFixedDoubleArray(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<HeapNumber>(o: Object): HeapNumber {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToHeapNumber(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<Callable>(o: Object): Callable {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToCallable(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<Smi>(o: Object): Smi {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToSmi(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<Number>(o: Object): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToNumber(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<HeapObject>(o: Object): HeapObject {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToHeapObject(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<JSArray>(o: Object): JSArray {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToJSArray(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<FixedTypedArrayBase>(o: Object): FixedTypedArrayBase {
|
2018-06-12 11:11:44 +00:00
|
|
|
return UnsafeCastObjectToFixedTypedArrayBase(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<NumberDictionary>(o: Object): NumberDictionary {
|
2018-06-18 09:33:18 +00:00
|
|
|
return UnsafeCastObjectToNumberDictionary(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<JSReceiver>(o: Object): JSReceiver {
|
2018-06-18 09:33:18 +00:00
|
|
|
return UnsafeCastObjectToJSReceiver(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<JSObject>(o: Object): JSObject {
|
2018-06-18 09:33:18 +00:00
|
|
|
return UnsafeCastObjectToJSObject(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<Map>(o: Object): Map {
|
2018-07-13 11:09:17 +00:00
|
|
|
return UnsafeCastObjectToMap(o);
|
|
|
|
}
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<FixedArrayBase>(o: Object): FixedArrayBase {
|
2018-07-13 11:09:17 +00:00
|
|
|
return UnsafeCastObjectToFixedArrayBase(o);
|
|
|
|
}
|
2018-09-28 11:28:29 +00:00
|
|
|
UnsafeCast<Context>(o: Object): Context {
|
|
|
|
return UnsafeCastObjectToContext(o);
|
|
|
|
}
|
2018-10-16 12:52:25 +00:00
|
|
|
UnsafeCast<String>(o: Object): String {
|
|
|
|
return UnsafeCastObjectToString(o);
|
|
|
|
}
|
2018-09-28 11:28:29 +00:00
|
|
|
|
|
|
|
// RawCasts should *never* be used anywhere in Torque code except for
|
|
|
|
// in Torque-based UnsafeCast operators preceeded by an appropriate
|
|
|
|
// type check().
|
|
|
|
extern macro RawCastObjectToJSArgumentsObjectWithLength(Object):
|
|
|
|
JSArgumentsObjectWithLength;
|
2018-10-19 16:00:14 +00:00
|
|
|
extern macro RawCastObjectToFastJSArray(Object): FastJSArray;
|
|
|
|
extern macro RawCastObjectToFastJSArrayForCopy(Object): FastJSArrayForCopy;
|
2018-09-28 11:28:29 +00:00
|
|
|
|
2018-10-11 08:52:36 +00:00
|
|
|
macro BranchIfJSArgumentsObjectWithLength(implicit context: Context)(o: Object):
|
|
|
|
never
|
2018-09-28 11:28:29 +00:00
|
|
|
labels True, False {
|
|
|
|
const heapObject: HeapObject = Cast<HeapObject>(o) otherwise False;
|
|
|
|
const map: Map = heapObject.map;
|
2018-10-19 16:00:14 +00:00
|
|
|
if (IsFastAliasedArgumentsMap(map)) goto True;
|
|
|
|
if (IsSloppyArgumentsMap(map)) goto True;
|
|
|
|
if (IsStrictArgumentsMap(map)) goto True;
|
|
|
|
if (!IsSlowAliasedArgumentsMap(map)) goto False;
|
2018-09-28 11:28:29 +00:00
|
|
|
goto True;
|
|
|
|
}
|
|
|
|
|
2018-10-11 08:52:36 +00:00
|
|
|
UnsafeCast<JSArgumentsObjectWithLength>(implicit context: Context)(o: Object):
|
|
|
|
JSArgumentsObjectWithLength {
|
|
|
|
assert(BranchIfJSArgumentsObjectWithLength(o));
|
2018-09-28 11:28:29 +00:00
|
|
|
return RawCastObjectToJSArgumentsObjectWithLength(o);
|
|
|
|
}
|
|
|
|
|
2018-10-11 08:52:36 +00:00
|
|
|
Cast<JSArgumentsObjectWithLength>(implicit context: Context)(o: Object):
|
2018-09-28 11:28:29 +00:00
|
|
|
JSArgumentsObjectWithLength
|
|
|
|
labels CastError {
|
2018-10-11 08:52:36 +00:00
|
|
|
if (BranchIfJSArgumentsObjectWithLength(o)) {
|
|
|
|
return UnsafeCast<JSArgumentsObjectWithLength>(o);
|
2018-09-28 11:28:29 +00:00
|
|
|
} else {
|
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
}
|
2018-07-13 11:09:17 +00:00
|
|
|
|
2018-10-19 16:00:14 +00:00
|
|
|
UnsafeCast<FastJSArray>(implicit context: Context)(o: Object): FastJSArray {
|
|
|
|
assert(BranchIfFastJSArray(o, context));
|
|
|
|
return RawCastObjectToFastJSArray(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
Cast<FastJSArray>(implicit context: Context)(o: Object): FastJSArray
|
|
|
|
labels CastError {
|
|
|
|
if (BranchIfFastJSArray(o, context)) {
|
|
|
|
return UnsafeCast<FastJSArray>(o);
|
|
|
|
} else {
|
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Cast<FastJSArray>(implicit context: Context)(ho: HeapObject): FastJSArray
|
|
|
|
labels CastError {
|
|
|
|
if (BranchIfFastJSArray(ho, context)) {
|
|
|
|
return UnsafeCast<FastJSArray>(ho);
|
|
|
|
} else {
|
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UnsafeCast<FastJSArrayForCopy>(implicit context: Context)(o: Object):
|
|
|
|
FastJSArrayForCopy {
|
|
|
|
assert(BranchIfFastJSArrayForCopy(o, context));
|
|
|
|
return RawCastObjectToFastJSArrayForCopy(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
Cast<FastJSArrayForCopy>(implicit context: Context)(o: Object):
|
|
|
|
FastJSArrayForCopy
|
|
|
|
labels CastError {
|
|
|
|
if (BranchIfFastJSArrayForCopy(o, context)) {
|
|
|
|
return UnsafeCast<FastJSArrayForCopy>(o);
|
|
|
|
} else {
|
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-11 13:15:02 +00:00
|
|
|
const kCOWMap: Map = UnsafeCast<Map>(LoadRoot(kFixedCOWArrayMapRootIndex));
|
2018-08-07 15:49:03 +00:00
|
|
|
const kEmptyFixedArray: FixedArrayBase =
|
2018-09-11 13:15:02 +00:00
|
|
|
UnsafeCast<FixedArrayBase>(LoadRoot(kEmptyFixedArrayRootIndex));
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro BranchIfFastJSArray(Object, Context): never
|
|
|
|
labels Taken, NotTaken;
|
2018-10-19 16:00:14 +00:00
|
|
|
extern macro BranchIfFastJSArrayForCopy(Object, Context): never
|
|
|
|
labels Taken, NotTaken;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro BranchIfNotFastJSArray(Object, Context): never
|
|
|
|
labels Taken, NotTaken;
|
2018-10-19 16:00:14 +00:00
|
|
|
macro BranchIfNotFastJSArrayForCopy(implicit context: Context)(o: Object):
|
|
|
|
never
|
|
|
|
labels Taken, NotTaken {
|
|
|
|
BranchIfFastJSArrayForCopy(o, context) otherwise NotTaken, Taken;
|
2018-08-28 09:14:58 +00:00
|
|
|
}
|
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro IsPrototypeInitialArrayPrototype(Context, Map): bool;
|
|
|
|
extern macro IsNoElementsProtectorCellInvalid(): bool;
|
|
|
|
extern macro IsArraySpeciesProtectorCellInvalid(): bool;
|
|
|
|
extern macro IsTypedArraySpeciesProtectorCellInvalid(): bool;
|
|
|
|
extern macro IsPromiseSpeciesProtectorCellInvalid(): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-11-05 11:59:29 +00:00
|
|
|
extern operator '.buffer' macro
|
|
|
|
TypedArrayBuiltinsAssembler::LoadTypedArrayBuffer(JSTypedArray): JSArrayBuffer;
|
2018-04-25 08:14:09 +00:00
|
|
|
|
2018-11-05 11:59:29 +00:00
|
|
|
extern operator '.data_ptr' macro TypedArrayBuiltinsAssembler::LoadDataPtr(
|
|
|
|
JSTypedArray): RawPtr;
|
2018-04-25 08:14:09 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '.elements_kind' macro LoadMapElementsKind(Map): ElementsKind;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '.elements_kind' macro LoadElementsKind(JSTypedArray):
|
|
|
|
ElementsKind;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-29 08:34:01 +00:00
|
|
|
extern operator '.elements' macro LoadElements(JSObject): FixedArrayBase;
|
|
|
|
extern operator '.elements=' macro StoreElements(JSObject, FixedArrayBase);
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-18 17:47:28 +00:00
|
|
|
extern operator '.length' macro LoadJSTypedArrayLength(JSTypedArray): Smi;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern operator '.length' macro LoadJSArrayLength(JSArray): Number;
|
2018-09-28 11:28:29 +00:00
|
|
|
extern operator '.length' macro LoadJSArgumentsObjectWithLength(
|
|
|
|
JSArgumentsObjectWithLength): Object;
|
2018-10-19 16:00:14 +00:00
|
|
|
extern operator '.length' macro LoadFastJSArrayLength(FastJSArray): Smi;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern operator '.length=' macro StoreJSArrayLength(JSArray, Smi);
|
|
|
|
|
|
|
|
extern operator '.length' macro LoadFixedArrayBaseLength(FixedArrayBase): Smi;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern operator '.length_intptr' macro LoadAndUntagFixedArrayBaseLength(
|
|
|
|
FixedArrayBase): intptr;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern operator '[]' macro LoadFixedArrayElement(FixedArray, intptr): Object;
|
|
|
|
extern operator '[]' macro LoadFixedArrayElement(FixedArray, Smi): Object;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '[]' macro LoadFixedArrayElement(
|
|
|
|
FixedArray, constexpr int31): Object;
|
|
|
|
extern operator '[]=' macro StoreFixedArrayElement(
|
2018-10-16 12:52:25 +00:00
|
|
|
FixedArray, intptr, Smi): void;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '[]=' macro StoreFixedArrayElement(
|
2018-10-16 12:52:25 +00:00
|
|
|
FixedArray, intptr, HeapObject): void;
|
|
|
|
extern operator '[]=' macro StoreFixedArrayElement(
|
|
|
|
FixedArray, constexpr int31, Smi): void;
|
|
|
|
extern operator '[]=' macro StoreFixedArrayElement(
|
|
|
|
FixedArray, constexpr int31, HeapObject): void;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '[]=' macro StoreFixedArrayElementSmi(
|
|
|
|
FixedArray, Smi, Object): void;
|
2018-09-04 12:30:33 +00:00
|
|
|
operator '[]=' macro StoreFixedDoubleArrayNumber(
|
|
|
|
a: FixedDoubleArray, index: Smi, value: Number): void {
|
2018-09-11 13:15:02 +00:00
|
|
|
a[index] = Convert<float64>(value);
|
2018-09-04 12:30:33 +00:00
|
|
|
}
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro StoreFixedArrayElementSmi(
|
|
|
|
FixedArray, Smi, Object, constexpr WriteBarrierMode): void;
|
2018-08-13 08:43:56 +00:00
|
|
|
|
2018-06-18 09:33:18 +00:00
|
|
|
extern operator '.instance_type' macro LoadMapInstanceType(Map): int32;
|
|
|
|
|
2018-06-05 07:54:49 +00:00
|
|
|
extern macro LoadFixedDoubleArrayElement(FixedDoubleArray, Smi): float64;
|
|
|
|
extern macro Float64SilenceNaN(float64): float64;
|
|
|
|
|
|
|
|
extern macro StoreFixedDoubleArrayElement(
|
|
|
|
FixedDoubleArray, Object, float64, constexpr ParameterMode);
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro StoreFixedArrayElement(
|
|
|
|
FixedArray, intptr, Object, constexpr WriteBarrierMode): void;
|
|
|
|
|
2018-06-05 07:54:49 +00:00
|
|
|
macro StoreFixedDoubleArrayElementWithSmiIndex(
|
|
|
|
array: FixedDoubleArray, index: Smi, value: float64) {
|
|
|
|
StoreFixedDoubleArrayElement(array, index, value, SMI_PARAMETERS);
|
|
|
|
}
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro GetNumberDictionaryNumberOfElements(NumberDictionary): Smi;
|
2018-06-05 07:54:49 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro BasicLoadNumberDictionaryElement(NumberDictionary, intptr): Object
|
|
|
|
labels NotData, IfHole;
|
2018-06-18 09:33:18 +00:00
|
|
|
extern macro BasicStoreNumberDictionaryElement(NumberDictionary, intptr, Object)
|
[array] Throw TypeError for read-only properties on fast-path
This CL changes the NumberDictionary fast-path for Array.p.sort to
throw a TypeError when trying to write to a read-only property.
Previously, the fast-path simply bailed to the slow-path which could
swallow the TypeError by accident. I.e. because the fast-path could
leave the array in an inconsistent state that is already sorted.
Example:
let arr = new Array(10);
Object.defineProperty(arr, 0, {value: 2, writable: false});
Object.defineProperty(arr, 2, {value: 1, writable: false});
arr.sort();
The pre-processing step will move the value 1 to index 1: {0: 2, 1: 1}
When trying to swap those 2 values, the fast-path will write the 2 at
index 1, then try to write the 1 at index 0 and fail, bailing to the
slow-path. As the array looks like {0: 2, 1: 2} its already sorted
and the TypeError will not be thrown.
R=jgruber@chromium.org
Bug: v8:7382, v8:7907
Change-Id: I5d2f2d73478fdca066ce1048dcb2b8301751cb1f
Reviewed-on: https://chromium-review.googlesource.com/1122120
Commit-Queue: Simon Zünd <szuend@google.com>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54150}
2018-07-02 14:56:52 +00:00
|
|
|
labels NotData, IfHole, ReadOnly;
|
2018-06-18 09:33:18 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro IsFastElementsKind(ElementsKind): bool;
|
2018-06-12 11:11:44 +00:00
|
|
|
extern macro IsDoubleElementsKind(ElementsKind): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro IsFastSmiOrTaggedElementsKind(ElementsKind): bool;
|
|
|
|
extern macro IsFastSmiElementsKind(ElementsKind): bool;
|
2018-05-09 08:16:07 +00:00
|
|
|
extern macro IsHoleyFastElementsKind(ElementsKind): bool;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-09-04 12:30:33 +00:00
|
|
|
macro AllowDoubleElements(kind: ElementsKind): ElementsKind {
|
|
|
|
if (kind == PACKED_SMI_ELEMENTS) {
|
|
|
|
return PACKED_DOUBLE_ELEMENTS;
|
|
|
|
} else if (kind == HOLEY_SMI_ELEMENTS) {
|
|
|
|
return HOLEY_DOUBLE_ELEMENTS;
|
|
|
|
}
|
|
|
|
return kind;
|
|
|
|
}
|
|
|
|
|
|
|
|
macro AllowNonNumberElements(kind: ElementsKind): ElementsKind {
|
|
|
|
if (kind == PACKED_SMI_ELEMENTS) {
|
|
|
|
return PACKED_ELEMENTS;
|
|
|
|
} else if (kind == HOLEY_SMI_ELEMENTS) {
|
|
|
|
return HOLEY_ELEMENTS;
|
|
|
|
} else if (kind == PACKED_DOUBLE_ELEMENTS) {
|
|
|
|
return PACKED_ELEMENTS;
|
|
|
|
} else if (kind == HOLEY_DOUBLE_ELEMENTS) {
|
|
|
|
return HOLEY_ELEMENTS;
|
|
|
|
}
|
|
|
|
return kind;
|
|
|
|
}
|
|
|
|
|
2018-08-13 15:08:55 +00:00
|
|
|
extern macro AllocateZeroedFixedArray(intptr): FixedArray;
|
|
|
|
extern macro AllocateZeroedFixedDoubleArray(intptr): FixedDoubleArray;
|
2018-10-10 14:39:19 +00:00
|
|
|
extern macro CalculateNewElementsCapacity(Smi): Smi;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro CalculateNewElementsCapacity(intptr): intptr;
|
2018-10-10 14:39:19 +00:00
|
|
|
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro AllocateFixedArrayWithHoles(
|
|
|
|
intptr, constexpr AllocationFlags): FixedArray;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern macro CopyFixedArrayElements(
|
2018-05-04 15:04:42 +00:00
|
|
|
constexpr ElementsKind, FixedArray, constexpr ElementsKind, FixedArray,
|
|
|
|
intptr, intptr, intptr): void;
|
2018-04-16 09:24:22 +00:00
|
|
|
extern macro CopyFixedArrayElements(
|
2018-05-04 15:04:42 +00:00
|
|
|
constexpr ElementsKind, FixedArray, constexpr ElementsKind, FixedArray, Smi,
|
|
|
|
Smi, Smi): void;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro AllocateJSArray(constexpr ElementsKind, Map, intptr, Smi): JSArray;
|
|
|
|
extern macro AllocateJSArray(constexpr ElementsKind, Map, Smi, Smi): JSArray;
|
2018-05-09 08:16:07 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
extern operator '[]=' macro StoreFixedDoubleArrayElementSmi(
|
2018-09-04 12:30:33 +00:00
|
|
|
FixedDoubleArray, Smi, float64): void;
|
|
|
|
|
2018-05-09 08:16:07 +00:00
|
|
|
extern macro LoadDoubleWithHoleCheck(FixedDoubleArray, Smi): float64
|
2018-09-24 09:28:48 +00:00
|
|
|
labels IfHole;
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro LoadDoubleWithHoleCheck(FixedDoubleArray, intptr): float64
|
|
|
|
labels IfHole;
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro StoreFixedDoubleArrayHoleSmi(FixedDoubleArray, Smi): void;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-10-27 11:56:57 +00:00
|
|
|
extern transitioning macro Call(Context, Callable, Object): Object;
|
|
|
|
extern transitioning macro Call(Context, Callable, Object, Object): Object;
|
|
|
|
extern transitioning macro Call(
|
|
|
|
Context, Callable, Object, Object, Object): Object;
|
|
|
|
extern transitioning macro Call(
|
|
|
|
Context, Callable, Object, Object, Object, Object): Object;
|
|
|
|
extern transitioning macro Call(
|
2018-08-07 15:49:03 +00:00
|
|
|
Context, Callable, Object, Object, Object, Object, Object): Object;
|
2018-10-27 11:56:57 +00:00
|
|
|
extern transitioning macro Call(
|
2018-08-07 15:49:03 +00:00
|
|
|
Context, Callable, Object, Object, Object, Object, Object, Object): Object;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-10-19 16:00:14 +00:00
|
|
|
extern builtin CloneFastJSArray(Context, FastJSArrayForCopy): JSArray;
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro ExtractFixedArray(FixedArrayBase, Smi, Smi, Smi): FixedArrayBase;
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro ExtractFixedArray(
|
|
|
|
FixedArrayBase, Smi, Smi, Smi,
|
2018-09-06 05:47:23 +00:00
|
|
|
constexpr ExtractFixedArrayFlags): FixedArrayBase;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-10-16 12:52:25 +00:00
|
|
|
extern macro ExtractFixedArray(
|
|
|
|
FixedArray, intptr, intptr, intptr,
|
|
|
|
constexpr ExtractFixedArrayFlags): FixedArray;
|
|
|
|
|
2018-04-16 09:24:22 +00:00
|
|
|
extern builtin ExtractFastJSArray(Context, JSArray, Smi, Smi): JSArray;
|
|
|
|
|
2018-10-10 14:39:19 +00:00
|
|
|
extern macro MoveElements(
|
|
|
|
constexpr ElementsKind, FixedArrayBase, intptr, intptr, intptr): void;
|
|
|
|
macro TorqueMoveElements(
|
|
|
|
elements: FixedArray, dstIndex: intptr, srcIndex: intptr,
|
|
|
|
count: intptr): void {
|
|
|
|
MoveElements(HOLEY_ELEMENTS, elements, dstIndex, srcIndex, count);
|
|
|
|
}
|
|
|
|
macro TorqueMoveElements(
|
|
|
|
elements: FixedDoubleArray, dstIndex: intptr, srcIndex: intptr,
|
|
|
|
count: intptr): void {
|
|
|
|
MoveElements(HOLEY_DOUBLE_ELEMENTS, elements, dstIndex, srcIndex, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern macro CopyElements(
|
|
|
|
constexpr ElementsKind, FixedArrayBase, intptr, FixedArrayBase, intptr,
|
|
|
|
intptr): void;
|
|
|
|
macro TorqueCopyElements(
|
|
|
|
dstElements: FixedArray, dstIndex: intptr, srcElements: FixedArray,
|
|
|
|
srcIndex: intptr, count: intptr): void {
|
|
|
|
CopyElements(
|
|
|
|
HOLEY_ELEMENTS, dstElements, dstIndex, srcElements, srcIndex, count);
|
|
|
|
}
|
|
|
|
macro TorqueCopyElements(
|
|
|
|
dstElements: FixedDoubleArray, dstIndex: intptr,
|
|
|
|
srcElements: FixedDoubleArray, srcIndex: intptr, count: intptr): void {
|
|
|
|
CopyElements(
|
|
|
|
HOLEY_DOUBLE_ELEMENTS, dstElements, dstIndex, srcElements, srcIndex,
|
|
|
|
count);
|
|
|
|
}
|
|
|
|
|
2018-10-27 11:56:57 +00:00
|
|
|
transitioning macro LoadElementNoHole<T: type>(a: JSArray, index: Smi): Object
|
2018-09-24 09:28:48 +00:00
|
|
|
labels IfHole;
|
2018-05-18 08:23:25 +00:00
|
|
|
|
|
|
|
LoadElementNoHole<FixedArray>(a: JSArray, index: Smi): Object
|
2018-09-24 09:28:48 +00:00
|
|
|
labels IfHole {
|
2018-05-18 08:23:25 +00:00
|
|
|
try {
|
|
|
|
let elements: FixedArray =
|
2018-09-11 13:15:02 +00:00
|
|
|
Cast<FixedArray>(a.elements) otherwise Unexpected;
|
2018-05-18 08:23:25 +00:00
|
|
|
let e: Object = elements[index];
|
|
|
|
if (e == Hole) {
|
|
|
|
goto IfHole;
|
|
|
|
}
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
label Unexpected {
|
|
|
|
unreachable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LoadElementNoHole<FixedDoubleArray>(a: JSArray, index: Smi): Object
|
2018-09-24 09:28:48 +00:00
|
|
|
labels IfHole {
|
2018-05-18 08:23:25 +00:00
|
|
|
try {
|
|
|
|
let elements: FixedDoubleArray =
|
2018-09-11 13:15:02 +00:00
|
|
|
Cast<FixedDoubleArray>(a.elements) otherwise Unexpected;
|
2018-05-18 08:23:25 +00:00
|
|
|
let e: float64 = LoadDoubleWithHoleCheck(elements, index) otherwise IfHole;
|
|
|
|
return AllocateHeapNumberWithValue(e);
|
|
|
|
}
|
|
|
|
label Unexpected {
|
|
|
|
unreachable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro TransitionElementsKind(JSObject, Map, ElementsKind, ElementsKind):
|
|
|
|
void
|
|
|
|
labels Bailout;
|
2018-09-04 12:30:33 +00:00
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro IsCallable(HeapObject): bool;
|
2018-06-05 07:54:49 +00:00
|
|
|
extern macro IsJSArray(HeapObject): bool;
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro IsJSReceiver(HeapObject): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro TaggedIsCallable(Object): bool;
|
|
|
|
extern macro IsDetachedBuffer(JSArrayBuffer): bool;
|
2018-06-08 11:12:59 +00:00
|
|
|
extern macro IsHeapNumber(HeapObject): bool;
|
2018-08-22 13:17:38 +00:00
|
|
|
extern macro IsFixedArray(HeapObject): bool;
|
2018-09-04 12:30:33 +00:00
|
|
|
extern macro IsNumber(Object): bool;
|
2018-06-18 09:33:18 +00:00
|
|
|
extern macro IsExtensibleMap(Map): bool;
|
|
|
|
extern macro IsCustomElementsReceiverInstanceType(int32): bool;
|
2018-08-28 09:14:58 +00:00
|
|
|
extern macro IsFastJSArray(Object, Context): bool;
|
[array] Throw TypeError for read-only properties on fast-path
This CL changes the NumberDictionary fast-path for Array.p.sort to
throw a TypeError when trying to write to a read-only property.
Previously, the fast-path simply bailed to the slow-path which could
swallow the TypeError by accident. I.e. because the fast-path could
leave the array in an inconsistent state that is already sorted.
Example:
let arr = new Array(10);
Object.defineProperty(arr, 0, {value: 2, writable: false});
Object.defineProperty(arr, 2, {value: 1, writable: false});
arr.sort();
The pre-processing step will move the value 1 to index 1: {0: 2, 1: 1}
When trying to swap those 2 values, the fast-path will write the 2 at
index 1, then try to write the 1 at index 0 and fail, bailing to the
slow-path. As the array looks like {0: 2, 1: 2} its already sorted
and the TypeError will not be thrown.
R=jgruber@chromium.org
Bug: v8:7382, v8:7907
Change-Id: I5d2f2d73478fdca066ce1048dcb2b8301751cb1f
Reviewed-on: https://chromium-review.googlesource.com/1122120
Commit-Queue: Simon Zünd <szuend@google.com>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54150}
2018-07-02 14:56:52 +00:00
|
|
|
extern macro Typeof(Object): Object;
|
2018-09-06 05:47:23 +00:00
|
|
|
extern macro LoadTargetFromFrame(): JSFunction;
|
2018-06-05 07:54:49 +00:00
|
|
|
|
2018-06-08 11:12:59 +00:00
|
|
|
// Return true iff number is NaN.
|
|
|
|
macro NumberIsNaN(number: Number): bool {
|
2018-09-24 09:28:48 +00:00
|
|
|
typeswitch (number) {
|
|
|
|
case (Smi): {
|
2018-08-07 21:57:19 +00:00
|
|
|
return false;
|
2018-09-24 09:28:48 +00:00
|
|
|
}
|
|
|
|
case (hn: HeapNumber): {
|
|
|
|
let value: float64 = Convert<float64>(hn);
|
|
|
|
return value != value;
|
|
|
|
}
|
2018-07-18 18:03:45 +00:00
|
|
|
}
|
2018-06-08 11:12:59 +00:00
|
|
|
}
|
2018-06-18 16:06:22 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
extern macro BranchIfToBooleanIsTrue(Object): never
|
|
|
|
labels Taken, NotTaken;
|
2018-06-18 16:06:22 +00:00
|
|
|
|
|
|
|
macro ToBoolean(obj: Object): bool {
|
2018-07-02 10:45:24 +00:00
|
|
|
if (BranchIfToBooleanIsTrue(obj)) {
|
2018-06-22 08:26:19 +00:00
|
|
|
return true;
|
2018-07-02 10:45:24 +00:00
|
|
|
} else {
|
2018-06-22 08:26:19 +00:00
|
|
|
return false;
|
2018-06-18 16:06:22 +00:00
|
|
|
}
|
|
|
|
}
|
2018-08-02 14:41:58 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
macro ToIndex(input: Object, context: Context): Number
|
|
|
|
labels RangeError {
|
2018-08-02 14:41:58 +00:00
|
|
|
if (input == Undefined) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
let value: Number = ToInteger_Inline(context, input, kTruncateMinusZero);
|
|
|
|
if (value < 0 || value > kMaxSafeInteger) {
|
|
|
|
goto RangeError;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
2018-09-28 11:28:29 +00:00
|
|
|
|
2018-10-27 11:56:57 +00:00
|
|
|
transitioning macro GetLengthProperty(implicit context: Context)(o: Object):
|
|
|
|
Number {
|
2018-09-28 11:28:29 +00:00
|
|
|
try {
|
2018-10-11 08:52:36 +00:00
|
|
|
typeswitch (o) {
|
|
|
|
case (a: JSArray): {
|
|
|
|
return a.length;
|
|
|
|
}
|
|
|
|
case (a: JSArgumentsObjectWithLength): {
|
2018-10-19 16:00:14 +00:00
|
|
|
goto ToLength(a.length);
|
2018-10-11 08:52:36 +00:00
|
|
|
}
|
|
|
|
case (Object): deferred {
|
|
|
|
goto ToLength(GetProperty(o, kLengthString));
|
|
|
|
}
|
|
|
|
}
|
2018-09-28 11:28:29 +00:00
|
|
|
}
|
2018-10-08 13:50:46 +00:00
|
|
|
label ToLength(length: Object) deferred {
|
2018-09-28 11:28:29 +00:00
|
|
|
return ToLength_Inline(context, length);
|
|
|
|
}
|
|
|
|
}
|
2018-10-16 12:52:25 +00:00
|
|
|
|
|
|
|
extern macro NumberToString(Number): String;
|
|
|
|
extern macro HasOnlyOneByteChars(InstanceType): bool;
|
|
|
|
extern macro AllocateSeqOneByteString(implicit context: Context)(uint32):
|
|
|
|
String;
|
|
|
|
extern macro AllocateSeqTwoByteString(implicit context: Context)(uint32):
|
|
|
|
String;
|
|
|
|
extern macro TryIntPtrAdd(intptr, intptr): intptr
|
|
|
|
labels IfOverflow;
|
|
|
|
|
|
|
|
extern builtin ObjectToString(Context, Object): Object;
|
2018-10-24 12:25:09 +00:00
|
|
|
extern builtin StringRepeat(Context, String, Number): String;
|
2018-10-31 14:59:13 +00:00
|
|
|
|
|
|
|
// Returned from IteratorBuiltinsAssembler::GetIterator(). Struct is declared
|
|
|
|
// here to simplify use in other generated builtins.
|
|
|
|
struct IteratorRecord {
|
|
|
|
// iteratorRecord.[[Iterator]]
|
|
|
|
object: JSReceiver;
|
|
|
|
|
|
|
|
// iteratorRecord.[[NextMethod]]
|
|
|
|
next: Object;
|
|
|
|
}
|