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-12-05 16:34:57 +00:00
|
|
|
#include 'src/builtins/builtins-utils-gen.h'
|
|
|
|
#include 'src/builtins/builtins.h'
|
|
|
|
#include 'src/code-factory.h'
|
|
|
|
#include 'src/elements-kind.h'
|
|
|
|
#include 'src/heap/factory-inl.h'
|
|
|
|
#include 'src/objects.h'
|
|
|
|
#include 'src/objects/arguments.h'
|
|
|
|
#include 'src/objects/bigint.h'
|
|
|
|
|
2018-05-29 08:34:01 +00:00
|
|
|
type Arguments constexpr 'CodeStubArguments*';
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
type void;
|
|
|
|
type never;
|
2018-04-16 09:24:22 +00:00
|
|
|
|
2018-12-07 16:29:49 +00:00
|
|
|
type Tagged generates 'TNode<Object>' constexpr 'ObjectPtr';
|
|
|
|
type Smi extends Tagged generates 'TNode<Smi>' constexpr 'Smi';
|
2018-05-29 13:31:56 +00:00
|
|
|
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-12-14 19:35:34 +00:00
|
|
|
type bint generates 'TNode<BInt>' constexpr 'BInt';
|
2018-07-03 12:02:05 +00:00
|
|
|
type string constexpr 'const char*';
|
2018-04-16 09:24:22 +00:00
|
|
|
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +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-12-17 13:41:53 +00:00
|
|
|
type BuiltinPtr extends Smi generates 'TNode<BuiltinPtr>';
|
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-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-11-22 15:29:55 +00:00
|
|
|
|
|
|
|
// A HeapObject with a JSArray map, and either fast packed elements, or fast
|
|
|
|
// holey elements when the global NoElementsProtector is not invalidated.
|
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-11-22 15:29:55 +00:00
|
|
|
|
|
|
|
// A FastJSArray when the global ArraySpeciesProtector is not invalidated.
|
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-11-22 15:29:55 +00:00
|
|
|
|
|
|
|
// A FastJSArray when the global ArrayIteratorProtector is not invalidated.
|
|
|
|
transient type FastJSArrayWithNoCustomIteration extends FastJSArray
|
|
|
|
generates 'TNode<JSArray>';
|
|
|
|
|
2018-12-14 19:35:34 +00:00
|
|
|
type SharedFunctionInfo extends HeapObject
|
|
|
|
generates 'TNode<SharedFunctionInfo>';
|
|
|
|
|
2018-05-29 13:31:56 +00:00
|
|
|
type JSFunction extends JSObject generates 'TNode<JSFunction>';
|
2018-12-14 19:35:34 +00:00
|
|
|
extern operator '.shared_function_info'
|
|
|
|
macro LoadJSFunctionSharedFunctionInfo(JSFunction): SharedFunctionInfo;
|
|
|
|
extern operator '.formal_parameter_count'
|
|
|
|
macro LoadSharedFunctionInfoFormalParameterCount(SharedFunctionInfo): int32;
|
|
|
|
|
2018-05-29 13:31:56 +00:00
|
|
|
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-12-05 18:23:55 +00:00
|
|
|
// RawObjectCasts should *never* be used anywhere in Torque code except for
|
2018-11-21 15:20:40 +00:00
|
|
|
// in Torque-based UnsafeCast operators preceeded by an appropriate
|
|
|
|
// type assert()
|
2018-12-05 18:23:55 +00:00
|
|
|
intrinsic %RawObjectCast<A: type>(o: Object): A;
|
|
|
|
intrinsic %RawPointerCast<A: type>(p: RawPtr): A;
|
|
|
|
intrinsic %RawConstexprCast<To: type, From: type>(f: From): To;
|
2018-11-21 15:20:40 +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-11-12 09:27:20 +00:00
|
|
|
const OBJECT_FUNCTION_INDEX: constexpr NativeContextSlot
|
|
|
|
generates 'Context::OBJECT_FUNCTION_INDEX';
|
2018-11-22 15:29:55 +00:00
|
|
|
const ITERATOR_RESULT_MAP_INDEX: constexpr NativeContextSlot
|
|
|
|
generates 'Context::ITERATOR_RESULT_MAP_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';
|
2018-12-05 18:23:55 +00:00
|
|
|
type LanguageMode extends Tagged
|
|
|
|
generates 'TNode<Smi>' constexpr 'LanguageMode';
|
2018-09-24 09:28:48 +00:00
|
|
|
type ExtractFixedArrayFlags
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
generates 'TNode<Smi>'
|
|
|
|
constexpr 'CodeStubAssembler::ExtractFixedArrayFlags';
|
|
|
|
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';
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
type ToIntegerTruncationMode
|
|
|
|
constexpr 'CodeStubAssembler::ToIntegerTruncationMode';
|
2018-10-16 12:52:25 +00:00
|
|
|
type AllocationFlags constexpr 'AllocationFlags';
|
2018-08-02 14:41:58 +00:00
|
|
|
|
2018-12-07 16:29:49 +00:00
|
|
|
const kSmiTagSize: constexpr int31 generates 'kSmiTagSize';
|
|
|
|
|
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
|
|
|
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
const kNone:
|
|
|
|
constexpr AllocationFlags generates 'CodeStubAssembler::kNone';
|
2018-10-16 12:52:25 +00:00
|
|
|
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
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
generates 'CodeStubAssembler::ExtractFixedArrayFlag::kFixedDoubleArrays';
|
2018-09-24 09:28:48 +00:00
|
|
|
const kAllFixedArrays: constexpr ExtractFixedArrayFlags
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
generates 'CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays';
|
2018-09-24 09:28:48 +00:00
|
|
|
const kFixedArrays: constexpr ExtractFixedArrayFlags
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
generates 'CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays';
|
2018-09-24 09:28:48 +00:00
|
|
|
|
|
|
|
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-11-12 09:27:20 +00:00
|
|
|
const kIteratorValueNotAnObject: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kIteratorValueNotAnObject';
|
|
|
|
const kNotIterable: constexpr MessageTemplate
|
|
|
|
generates 'MessageTemplate::kNotIterable';
|
2018-06-22 08:26:19 +00:00
|
|
|
|
2018-11-13 08:58:09 +00:00
|
|
|
const kMaxArrayIndex:
|
|
|
|
constexpr uint32 generates 'JSArray::kMaxArrayIndex';
|
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
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
generates 'CodeStubAssembler::ToIntegerTruncationMode::kTruncateMinusZero'
|
|
|
|
;
|
2018-09-24 09:28:48 +00:00
|
|
|
|
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-11-20 13:18:31 +00:00
|
|
|
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;
|
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
|
|
|
|
2018-11-20 13:18:31 +00:00
|
|
|
const Hole: Hole = TheHoleConstant();
|
|
|
|
const Null: Null = NullConstant();
|
|
|
|
const Undefined: Undefined = UndefinedConstant();
|
|
|
|
const True: True = TrueConstant();
|
|
|
|
const False: False = 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';
|
|
|
|
|
[torque] enable multiple inheritance from Torque-generated assemblers
This enables more seamless interop between Torque and CSA:
Since CodeStubAssembler can now inherit from the Torque base namespace,
macros defined in the base namespace can be used in CodeStubAssembler
macros, even without qualification.
At the same time, macros in the base namespace can refer to
CodeStubAssembler macros. The only new limitation is that types defined
in code-stub-assembler.h cannot be referenced in the signature of macros
defined in the base namespace, since this would produce a cyclic header
dependency. A work-around for this woud be to put such types (like int31
in this CL) into a separate header included by both. I (mis-)used
code-assembler.h for that.
Another side-effec is that types and enums defined in CodeStubAssembler
have to be accessed in a qualified way from Torque.
Other assemblers can now inherit from their Torque equivalent, so
porting macros into the corresponding Torque namespace doesn't require
any change to the existing use-sites.
To avoid C++ ambiguities, the Torque-generated assemblers must not define
anything also defined in Code(Stub)Assembler. This includes the type
aliases for TNode, PLabel, ...
My workaround is to qualify everything in the generated C++.
As a drive-by fix, I had to change the formatter to avoid a situation
where it doesn't compute a fixed point: putting a keyword at the
beginning of a line removes the '\s' in front of it, so I replaced that
with '\b'.
Bug: v8:7793
Change-Id: If3b9e9ad967a181b380a10d5673615606abd1041
Reviewed-on: https://chromium-review.googlesource.com/c/1341955
Reviewed-by: Daniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57645}
2018-11-20 10:17:24 +00:00
|
|
|
const SMI_PARAMETERS: constexpr ParameterMode
|
|
|
|
generates 'CodeStubAssembler::SMI_PARAMETERS';
|
|
|
|
const INTPTR_PARAMETERS: constexpr ParameterMode
|
|
|
|
generates 'CodeStubAssembler::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);
|
2018-11-12 09:27:20 +00:00
|
|
|
extern transitioning builtin SetPropertyInLiteral(implicit context: Context)(
|
|
|
|
Object, Object, Object);
|
2018-10-27 11:56:57 +00:00
|
|
|
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;
|
2019-01-08 14:49:43 +00:00
|
|
|
extern macro BuildAppendJSArray(
|
|
|
|
constexpr ElementsKind, FastJSArray, Object): void labels Bailout;
|
|
|
|
|
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-12-07 16:29:49 +00:00
|
|
|
extern macro LoadBufferObject(RawPtr, constexpr int32): Object;
|
|
|
|
extern macro LoadBufferPointer(RawPtr, constexpr int32): RawPtr;
|
|
|
|
extern macro LoadBufferSmi(RawPtr, constexpr int32): Smi;
|
|
|
|
|
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-12-07 16:29:49 +00:00
|
|
|
extern operator '==' macro WordEqual(RawPtr, RawPtr): bool;
|
|
|
|
extern operator '!=' macro WordNotEqual(RawPtr, RawPtr): bool;
|
|
|
|
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '<' macro Int32LessThan(int32, int32): bool;
|
2018-12-03 15:56:57 +00:00
|
|
|
extern operator '<' macro Uint32LessThan(uint32, uint32): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '>' macro Int32GreaterThan(int32, int32): bool;
|
2018-12-03 15:56:57 +00:00
|
|
|
extern operator '>' macro Uint32GreaterThan(uint32, uint32): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '<=' macro Int32LessThanOrEqual(int32, int32): bool;
|
2018-12-03 15:56:57 +00:00
|
|
|
extern operator '<=' macro Uint32LessThanOrEqual(uint32, uint32): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern operator '>=' macro Int32GreaterThanOrEqual(int32, int32): bool;
|
2018-12-03 15:56:57 +00:00
|
|
|
extern operator '>=' macro Uint32GreaterThanOrEqual(uint32, uint32): 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-11-13 13:00:34 +00:00
|
|
|
extern operator '>=' macro BranchIfNumberGreaterThanOrEqual(
|
|
|
|
Number, Number): never
|
2018-09-24 09:28:48 +00:00
|
|
|
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;
|
|
|
|
extern operator '<<' macro SmiShl(Smi, constexpr int31): Smi;
|
2018-12-07 16:29:49 +00:00
|
|
|
extern operator '>>' macro SmiSar(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;
|
2018-12-07 16:29:49 +00:00
|
|
|
extern operator '>>' macro WordSar(intptr, intptr): intptr;
|
2018-06-15 12:23:58 +00:00
|
|
|
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;
|
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-11-13 08:58:09 +00:00
|
|
|
extern operator '+' macro ConstexprUint32Add(
|
|
|
|
constexpr uint32, constexpr int32): constexpr uint32;
|
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-12-07 16:29:49 +00:00
|
|
|
extern operator '<<' macro ConstexprUintPtrShl(
|
|
|
|
constexpr uintptr, constexpr int31): constexpr uintptr;
|
|
|
|
extern operator '>>>' macro ConstexprUintPtrShr(
|
|
|
|
constexpr uintptr, constexpr int31): constexpr uintptr;
|
|
|
|
|
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;
|
2018-12-11 15:27:31 +00:00
|
|
|
extern macro HeapObjectToJSTypedArray(HeapObject): JSTypedArray
|
|
|
|
labels CastError;
|
2018-09-24 09:28:48 +00:00
|
|
|
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;
|
2018-11-26 15:14:25 +00:00
|
|
|
|
2018-09-24 09:28:48 +00:00
|
|
|
CastHeapObject<HeapObject>(o: HeapObject): HeapObject
|
|
|
|
labels CastError {
|
2018-09-04 12:30:33 +00:00
|
|
|
return o;
|
|
|
|
}
|
2018-11-26 15:14:25 +00:00
|
|
|
|
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-11-26 15:14:25 +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-11-26 15:14:25 +00:00
|
|
|
|
2018-10-19 16:00:14 +00:00
|
|
|
CastHeapObject<SloppyArgumentsElements>(o: HeapObject): SloppyArgumentsElements
|
|
|
|
labels CastError {
|
|
|
|
return HeapObjectToSloppyArgumentsElements(o) otherwise CastError;
|
|
|
|
}
|
2018-11-26 15:14:25 +00:00
|
|
|
|
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-11-26 15:14:25 +00:00
|
|
|
|
2018-12-11 15:27:31 +00:00
|
|
|
CastHeapObject<JSTypedArray>(o: HeapObject): JSTypedArray
|
|
|
|
labels CastError {
|
|
|
|
if (IsJSTypedArray(o)) return %RawObjectCast<JSTypedArray>(o);
|
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
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-11-26 15:14:25 +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-11-26 15:14:25 +00:00
|
|
|
|
|
|
|
CastHeapObject<Context>(o: HeapObject): Context
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsContext(o)) return %RawObjectCast<Context>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<JSObject>(o: HeapObject): JSObject
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsJSObject(o)) return %RawObjectCast<JSObject>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<NumberDictionary>(o: HeapObject): NumberDictionary
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsNumberDictionary(o)) return %RawObjectCast<NumberDictionary>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<FixedTypedArrayBase>(o: HeapObject): FixedTypedArrayBase
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsFixedTypedArray(o)) return %RawObjectCast<FixedTypedArrayBase>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
2018-10-16 12:52:25 +00:00
|
|
|
CastHeapObject<String>(o: HeapObject): String
|
|
|
|
labels CastError {
|
|
|
|
return HeapObjectToString(o) otherwise CastError;
|
|
|
|
}
|
2018-11-26 15:14:25 +00:00
|
|
|
|
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-11-26 15:14:25 +00:00
|
|
|
CastHeapObject<HeapNumber>(o: HeapObject): HeapNumber
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsHeapNumber(o)) return %RawObjectCast<HeapNumber>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<Map>(implicit context: Context)(o: HeapObject): Map
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsMap(o)) return %RawObjectCast<Map>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<JSArgumentsObjectWithLength>(implicit context: Context)(
|
|
|
|
o: HeapObject): JSArgumentsObjectWithLength
|
|
|
|
labels CastError {
|
|
|
|
const map: Map = o.map;
|
|
|
|
try {
|
|
|
|
if (IsFastAliasedArgumentsMap(map)) goto True;
|
|
|
|
if (IsSloppyArgumentsMap(map)) goto True;
|
|
|
|
if (IsStrictArgumentsMap(map)) goto True;
|
|
|
|
if (IsSlowAliasedArgumentsMap(map)) goto True;
|
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
label True {
|
2018-12-05 18:23:55 +00:00
|
|
|
return %RawObjectCast<JSArgumentsObjectWithLength>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<FastJSArray>(implicit context: Context)(o: HeapObject):
|
|
|
|
FastJSArray
|
|
|
|
labels CastError {
|
|
|
|
const map: Map = o.map;
|
|
|
|
if (!IsJSArrayMap(map)) goto CastError;
|
|
|
|
|
|
|
|
// Bailout if receiver has slow elements.
|
|
|
|
const elementsKind: ElementsKind = LoadMapElementsKind(map);
|
|
|
|
if (!IsFastElementsKind(elementsKind)) goto CastError;
|
|
|
|
|
|
|
|
// Verify that our prototype is the initial array prototype.
|
|
|
|
if (!IsPrototypeInitialArrayPrototype(map)) goto CastError;
|
|
|
|
|
|
|
|
if (IsNoElementsProtectorCellInvalid()) goto CastError;
|
2018-12-05 18:23:55 +00:00
|
|
|
return %RawObjectCast<FastJSArray>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
}
|
|
|
|
|
2019-01-08 14:49:43 +00:00
|
|
|
struct FastJSArrayWitness {
|
|
|
|
array: HeapObject;
|
|
|
|
map: Map;
|
|
|
|
}
|
|
|
|
|
|
|
|
macro MakeWitness(array: FastJSArray): FastJSArrayWitness {
|
|
|
|
return FastJSArrayWitness{array, array.map};
|
|
|
|
}
|
|
|
|
|
|
|
|
macro Testify(witness: FastJSArrayWitness): FastJSArray labels CastError {
|
|
|
|
if (witness.array.map != witness.map) goto CastError;
|
|
|
|
// We don't need to check elements kind or whether the prototype
|
|
|
|
// has changed away from the default JSArray prototype, because
|
|
|
|
// if the map remains the same then those properties hold.
|
|
|
|
//
|
|
|
|
// However, we have to make sure there are no elements in the
|
|
|
|
// prototype chain.
|
|
|
|
if (IsNoElementsProtectorCellInvalid()) goto CastError;
|
|
|
|
return %RawObjectCast<FastJSArray>(witness.array);
|
|
|
|
}
|
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
CastHeapObject<FastJSArrayForCopy>(implicit context: Context)(o: HeapObject):
|
|
|
|
FastJSArrayForCopy
|
|
|
|
labels CastError {
|
|
|
|
if (IsArraySpeciesProtectorCellInvalid()) goto CastError;
|
|
|
|
const a: FastJSArray = Cast<FastJSArray>(o) otherwise CastError;
|
2018-12-05 18:23:55 +00:00
|
|
|
return %RawObjectCast<FastJSArrayForCopy>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<FastJSArrayWithNoCustomIteration>(implicit context: Context)(
|
|
|
|
o: HeapObject): FastJSArrayWithNoCustomIteration
|
|
|
|
labels CastError {
|
|
|
|
if (IsArrayIteratorProtectorCellInvalid()) goto CastError;
|
|
|
|
const a: FastJSArray = Cast<FastJSArray>(o) otherwise CastError;
|
2018-12-05 18:23:55 +00:00
|
|
|
return %RawObjectCast<FastJSArrayWithNoCustomIteration>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<JSReceiver>(implicit context: Context)(o: HeapObject): JSReceiver
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsJSReceiver(o)) return %RawObjectCast<JSReceiver>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
CastHeapObject<JSFunction>(implicit context: Context)(o: HeapObject): JSFunction
|
|
|
|
labels CastError {
|
2018-12-05 18:23:55 +00:00
|
|
|
if (IsJSFunction(o)) return %RawObjectCast<JSFunction>(o);
|
2018-11-26 15:14:25 +00:00
|
|
|
goto CastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
macro Cast<A: type>(implicit context: Context)(o: HeapObject): A
|
2018-09-24 09:28:48 +00:00
|
|
|
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-11-26 15:14:25 +00:00
|
|
|
macro Cast<A: type>(implicit context: Context)(o: Object): A
|
2018-09-24 09:28:48 +00:00
|
|
|
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-11-26 15:14:25 +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-11-26 15:14:25 +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;
|
2019-01-08 14:49:43 +00:00
|
|
|
extern macro LoadJSArrayElementsMap(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;
|
2018-11-13 08:58:09 +00:00
|
|
|
extern macro NumberConstant(constexpr uint32): Number;
|
2018-06-12 11:11:44 +00:00
|
|
|
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;
|
2018-12-07 16:29:49 +00:00
|
|
|
extern macro SmiConstant(constexpr Smi): Smi;
|
2018-06-12 11:11:44 +00:00
|
|
|
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-12-05 18:23:55 +00:00
|
|
|
extern macro IntPtrConstant(constexpr intptr): intptr;
|
2018-06-12 11:11:44 +00:00
|
|
|
|
2018-12-05 18:23:55 +00:00
|
|
|
extern macro BitcastWordToTaggedSigned(intptr): Smi;
|
2018-12-07 16:29:49 +00:00
|
|
|
extern macro BitcastWordToTaggedSigned(uintptr): Smi;
|
2018-12-05 18:23:55 +00:00
|
|
|
extern macro BitcastWordToTagged(intptr): Object;
|
2018-12-07 16:29:49 +00:00
|
|
|
extern macro BitcastWordToTagged(uintptr): Object;
|
|
|
|
extern macro BitcastTaggedToWord(Tagged): intptr;
|
2018-12-05 18:23:55 +00:00
|
|
|
|
|
|
|
intrinsic %FromConstexpr<To: type, From: type>(b: From): To;
|
|
|
|
macro FromConstexpr<To: type, From: type>(o: From): To;
|
|
|
|
FromConstexpr<int31, constexpr int31>(i: constexpr int31): int31 {
|
|
|
|
return %FromConstexpr<int31>(i);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<int32, constexpr int31>(i: constexpr int31): int32 {
|
|
|
|
return %FromConstexpr<int32>(i);
|
2018-07-03 12:02:05 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<int32, constexpr int32>(i: constexpr int32): int32 {
|
|
|
|
return %FromConstexpr<int32>(i);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<intptr, constexpr int31>(i: constexpr int31): intptr {
|
|
|
|
return %FromConstexpr<intptr>(i);
|
2018-06-15 12:23:58 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<intptr, constexpr int32>(i: constexpr int32): intptr {
|
|
|
|
return %FromConstexpr<intptr>(i);
|
2018-06-18 14:16:44 +00:00
|
|
|
}
|
2018-12-07 16:29:49 +00:00
|
|
|
FromConstexpr<intptr, constexpr intptr>(i: constexpr intptr): intptr {
|
|
|
|
return %FromConstexpr<intptr>(i);
|
|
|
|
}
|
|
|
|
FromConstexpr<uintptr, constexpr uintptr>(i: constexpr uintptr): uintptr {
|
|
|
|
return %FromConstexpr<uintptr>(i);
|
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<Smi, constexpr int31>(i: constexpr int31): Smi {
|
|
|
|
return %FromConstexpr<Smi>(i);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<String, constexpr string>(s: constexpr string): String {
|
|
|
|
return %FromConstexpr<String>(s);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<Number, constexpr uint32>(i: constexpr uint32): Number {
|
|
|
|
return %FromConstexpr<Number>(i);
|
2018-06-26 13:55:16 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<Number, constexpr int32>(i: constexpr int32): Number {
|
|
|
|
return %FromConstexpr<Number>(i);
|
2018-11-13 08:58:09 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<Number, constexpr float64>(f: constexpr float64): Number {
|
|
|
|
return %FromConstexpr<Number>(f);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<Number, constexpr int31>(i: constexpr int31): Number {
|
|
|
|
return %FromConstexpr<Number>(i);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-07 16:29:49 +00:00
|
|
|
FromConstexpr<Number, constexpr Smi>(s: constexpr Smi): Number {
|
|
|
|
return SmiConstant(s);
|
|
|
|
}
|
|
|
|
FromConstexpr<Smi, constexpr Smi>(s: constexpr Smi): Smi {
|
|
|
|
return SmiConstant(s);
|
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<uint32, constexpr int31>(i: constexpr int31): uint32 {
|
|
|
|
return Unsigned(Int32Constant(i));
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<uintptr, constexpr int31>(i: constexpr int31): uintptr {
|
|
|
|
return ChangeUint32ToWord(i);
|
|
|
|
}
|
|
|
|
FromConstexpr<float64, constexpr int31>(i: constexpr int31): float64 {
|
|
|
|
return Float64Constant(i);
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<bool, constexpr bool>(b: constexpr bool): bool {
|
2018-06-12 11:11:44 +00:00
|
|
|
return BoolConstant(b);
|
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<LanguageMode, constexpr LanguageMode>(m: constexpr LanguageMode):
|
|
|
|
LanguageMode {
|
|
|
|
return %RawObjectCast<LanguageMode>(%FromConstexpr<Smi>(m));
|
2018-06-12 11:11:44 +00:00
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<ElementsKind, constexpr ElementsKind>(e: constexpr ElementsKind):
|
|
|
|
ElementsKind {
|
2018-06-12 11:11:44 +00:00
|
|
|
return Int32Constant(e);
|
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<Object, constexpr string>(s: constexpr string): Object {
|
2018-06-18 15:50:59 +00:00
|
|
|
return StringConstant(s);
|
|
|
|
}
|
2018-12-05 18:23:55 +00:00
|
|
|
FromConstexpr<NativeContextSlot, constexpr NativeContextSlot>(
|
|
|
|
c: constexpr NativeContextSlot): NativeContextSlot {
|
2018-09-28 11:28:29 +00:00
|
|
|
return IntPtrConstant(c);
|
|
|
|
}
|
2018-05-09 08:16:07 +00:00
|
|
|
|
2018-12-09 21:12:45 +00:00
|
|
|
macro Convert<To: type, From: type>(i: From): To {
|
2018-07-03 12:02:05 +00:00
|
|
|
return i;
|
|
|
|
}
|
2018-09-04 12:30:33 +00:00
|
|
|
|
2018-12-09 21:12:45 +00:00
|
|
|
extern macro ConvertElementsKindToInt(ElementsKind): int32;
|
|
|
|
Convert<int32, ElementsKind>(elementsKind: ElementsKind): int32 {
|
2018-09-11 13:15:02 +00:00
|
|
|
return ConvertElementsKindToInt(elementsKind);
|
2018-09-04 12:30:33 +00:00
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<Number, int32>(i: int32): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeInt32ToTagged(i);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<intptr, int32>(i: int32): intptr {
|
2018-06-15 12:23:58 +00:00
|
|
|
return ChangeInt32ToIntPtr(i);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<Smi, int32>(i: int32): Smi {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiFromInt32(i);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<Number, uint32>(ui: uint32): Number {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeUint32ToTagged(ui);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<Smi, uint32>(ui: uint32): Smi {
|
2018-06-25 13:28:25 +00:00
|
|
|
return SmiFromInt32(Signed(ui));
|
2018-06-15 12:23:58 +00:00
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<uintptr, uint32>(ui: uint32): uintptr {
|
2018-06-25 13:28:25 +00:00
|
|
|
return ChangeUint32ToWord(ui);
|
2018-06-15 12:23:58 +00:00
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<int32, intptr>(i: intptr): int32 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return TruncateIntPtrToInt32(i);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<Smi, intptr>(i: intptr): Smi {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiTag(i);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<uint32, uintptr>(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-12-09 21:12:45 +00:00
|
|
|
Convert<intptr, Smi>(s: Smi): intptr {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiUntag(s);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<int32, Smi>(s: Smi): int32 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return SmiToInt32(s);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<float64, HeapNumber>(h: HeapNumber): float64 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return LoadHeapNumberValue(h);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<float64, Number>(n: Number): float64 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeNumberToFloat64(n);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<uintptr, Number>(n: Number): uintptr {
|
2018-10-16 12:52:25 +00:00
|
|
|
return ChangeNonnegativeNumberToUintPtr(n);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<float64, float32>(f: float32): float64 {
|
2018-06-12 11:11:44 +00:00
|
|
|
return ChangeFloat32ToFloat64(f);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<Number, float64>(d: float64): Number {
|
2018-06-25 13:28:25 +00:00
|
|
|
return AllocateHeapNumberWithValue(d);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<float64, uintptr>(ui: uintptr): float64 {
|
2018-09-18 17:47:28 +00:00
|
|
|
return ChangeUintPtrToFloat64(ui);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<Number, uintptr>(ui: uintptr): Number {
|
2018-09-18 17:47:28 +00:00
|
|
|
return ChangeUintPtrToTagged(ui);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<uintptr, float64>(d: float64): uintptr {
|
2018-08-02 14:41:58 +00:00
|
|
|
return ChangeFloat64ToUintPtr(d);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<uintptr, intptr>(i: intptr): uintptr {
|
2018-12-07 16:29:49 +00:00
|
|
|
return Unsigned(i);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<uintptr, RawPtr>(r: RawPtr): uintptr {
|
2018-06-25 13:28:25 +00:00
|
|
|
return Unsigned(r);
|
|
|
|
}
|
2018-12-09 21:12:45 +00:00
|
|
|
Convert<intptr, RawPtr>(r: RawPtr): intptr {
|
2018-06-25 13:28:25 +00:00
|
|
|
return Signed(r);
|
|
|
|
}
|
2018-12-14 19:35:34 +00:00
|
|
|
Convert<bint, int32>(v: int32): bint {
|
|
|
|
return IntPtrToBInt(Convert<intptr>(v));
|
|
|
|
}
|
|
|
|
extern macro IntPtrToBInt(intptr): bint;
|
|
|
|
Convert<bint, intptr>(v: intptr): bint {
|
|
|
|
return IntPtrToBInt(v);
|
|
|
|
}
|
|
|
|
extern macro SmiToBInt(Smi): bint;
|
|
|
|
Convert<bint, Smi>(v: Smi): bint {
|
|
|
|
return SmiToBInt(v);
|
|
|
|
}
|
2018-06-12 11:11:44 +00:00
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
macro BranchIf<A: type, B: type>(implicit context: Context)(o: B): never
|
2018-09-28 11:28:29 +00:00
|
|
|
labels True, False {
|
2018-11-26 15:14:25 +00:00
|
|
|
Cast<A>(o) otherwise False;
|
2018-09-28 11:28:29 +00:00
|
|
|
goto True;
|
|
|
|
}
|
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
macro BranchIfNot<A: type, B: type>(implicit context: Context)(o: B): never
|
|
|
|
labels True, False {
|
|
|
|
Cast<A>(o) otherwise True;
|
|
|
|
goto False;
|
2018-11-22 15:29:55 +00:00
|
|
|
}
|
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
macro Is<A: type, B: type>(implicit context: Context)(o: B): bool {
|
|
|
|
return (BranchIf<A, B>(o)) ? true : false;
|
2018-11-12 09:27:20 +00:00
|
|
|
}
|
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
macro UnsafeCast<A: type>(implicit context: Context)(o: Object): A {
|
|
|
|
assert(Is<A>(o));
|
2018-12-05 18:23:55 +00:00
|
|
|
return %RawObjectCast<A>(o);
|
2018-11-12 09:27:20 +00:00
|
|
|
}
|
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
UnsafeCast<Object>(o: Object): Object {
|
|
|
|
return o;
|
2018-11-12 09:27:20 +00:00
|
|
|
}
|
|
|
|
|
2018-12-05 18:23:55 +00:00
|
|
|
const kCOWMap: Map = %RawObjectCast<Map>(LoadRoot(kFixedCOWArrayMapRootIndex));
|
2018-08-07 15:49:03 +00:00
|
|
|
const kEmptyFixedArray: FixedArrayBase =
|
2018-12-05 18:23:55 +00:00
|
|
|
%RawObjectCast<FixedArrayBase>(LoadRoot(kEmptyFixedArrayRootIndex));
|
2018-08-28 09:14:58 +00:00
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
extern macro IsPrototypeInitialArrayPrototype(implicit context: Context)(Map):
|
|
|
|
bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
extern macro IsNoElementsProtectorCellInvalid(): bool;
|
2018-11-26 15:14:25 +00:00
|
|
|
extern macro IsArrayIteratorProtectorCellInvalid(): bool;
|
2018-05-04 15:04:42 +00:00
|
|
|
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-11-12 09:27:20 +00:00
|
|
|
extern operator '.prototype_or_initial_map' macro
|
|
|
|
LoadJSFunctionPrototypeOrInitialMap(JSFunction): Object;
|
|
|
|
|
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)
|
2018-11-13 13:00:34 +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-11-22 15:29:55 +00:00
|
|
|
extern macro AllocateJSObjectFromMap(Map): JSObject;
|
2018-11-12 09:27:20 +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-11-12 09:27:20 +00:00
|
|
|
macro GetObjectFunction(implicit context: Context)(): JSFunction {
|
|
|
|
return UnsafeCast<JSFunction>(
|
|
|
|
LoadNativeContext(context)[OBJECT_FUNCTION_INDEX]);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-01-08 14:49:43 +00:00
|
|
|
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
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
LoadElementNoHole<FixedArray>(implicit context: Context)(
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-26 15:14:25 +00:00
|
|
|
LoadElementNoHole<FixedDoubleArray>(implicit context: Context)(
|
|
|
|
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-11-13 13:00:34 +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-11-12 09:27:20 +00:00
|
|
|
extern macro IsMap(HeapObject): bool;
|
|
|
|
extern macro IsJSFunction(HeapObject): bool;
|
2018-11-26 15:14:25 +00:00
|
|
|
extern macro IsJSObject(HeapObject): bool;
|
2018-12-11 15:27:31 +00:00
|
|
|
extern macro IsJSTypedArray(HeapObject): bool;
|
2018-11-26 15:14:25 +00:00
|
|
|
extern macro IsNumberDictionary(HeapObject): bool;
|
|
|
|
extern macro IsFixedTypedArray(HeapObject): bool;
|
|
|
|
extern macro IsContext(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-11-26 15:14:25 +00:00
|
|
|
extern macro IsJSArrayMap(Map): bool;
|
2018-06-18 09:33:18 +00:00
|
|
|
extern macro IsExtensibleMap(Map): bool;
|
|
|
|
extern macro IsCustomElementsReceiverInstanceType(int32): bool;
|
2018-11-22 15:29:55 +00:00
|
|
|
extern macro IsFastJSArrayWithNoCustomIteration(implicit context: Context)(
|
|
|
|
Object): 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-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-11-26 15:14:25 +00:00
|
|
|
extern macro GotoIfForceSlowPath() labels Taken;
|
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
|
|
|
|
2018-11-15 08:55:27 +00:00
|
|
|
struct KeyValuePair {
|
|
|
|
key: Object;
|
|
|
|
value: Object;
|
|
|
|
}
|
2018-11-26 15:14:25 +00:00
|
|
|
|
|
|
|
// Macro definitions for compatibility that expose functionality to the CSA
|
|
|
|
// using "legacy" APIs. In Torque code, these should not be used.
|
|
|
|
macro IsFastJSArray(o: Object, context: Context): bool {
|
|
|
|
try {
|
|
|
|
// Long-term, it's likely not a good idea to have this slow-path test here,
|
|
|
|
// since it fundamentally breaks the type system.
|
|
|
|
GotoIfForceSlowPath() otherwise ForceSlow;
|
|
|
|
}
|
|
|
|
label ForceSlow {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Is<FastJSArray>(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
macro BranchIfFastJSArray(o: Object, context: Context): never
|
|
|
|
labels True, False {
|
|
|
|
// Long-term, it's likely not a good idea to have this slow-path test here,
|
|
|
|
// since it fundamentally breaks the type system.
|
|
|
|
GotoIfForceSlowPath() otherwise False;
|
|
|
|
BranchIf<FastJSArray>(o) otherwise True, False;
|
|
|
|
}
|
|
|
|
|
|
|
|
macro BranchIfNotFastJSArray(o: Object, context: Context): never
|
|
|
|
labels True, False {
|
|
|
|
BranchIfNot<FastJSArray>(o) otherwise True, False;
|
|
|
|
}
|
|
|
|
|
|
|
|
macro BranchIfFastJSArrayForCopy(o: Object, context: Context): never
|
|
|
|
labels True, False {
|
|
|
|
// Long-term, it's likely not a good idea to have this slow-path test here,
|
|
|
|
// since it fundamentally breaks the type system.
|
|
|
|
GotoIfForceSlowPath() otherwise False;
|
|
|
|
BranchIf<FastJSArrayForCopy>(o) otherwise True, False;
|
|
|
|
}
|
|
|
|
|
|
|
|
macro IsFastJSArrayWithNoCustomIteration(context: Context, o: Object): bool {
|
|
|
|
return Is<FastJSArrayWithNoCustomIteration>(o);
|
|
|
|
}
|