[torque] Make more classes eligible for direct map Cast<> checks

Also should address minor performance regressions for instance types
that should (and used to) use map compare rather than instance_type
comparison.

In the process, convert a bunch of IsXXX methods from the CSA into
exported Torque methods that call through to the Cast<> to ensure
there is only a single implementation of the type checkers. Also clean
up and remove duplicate/redundant code and unused Torque imports.

Bug: v8:7793, chromium:1098481
Change-Id: I3cd5146d913bb75bab4f73415b1b94bc30924725
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2270545
Commit-Queue: Daniel Clifford <danno@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68621}
This commit is contained in:
Daniel Clifford 2020-06-30 21:02:30 +02:00 committed by Commit Bot
parent 26626f8731
commit c0e2479106
9 changed files with 263 additions and 291 deletions

View File

@ -4,24 +4,114 @@
extern macro IsBigInt(HeapObject): bool;
extern macro IsConstructor(HeapObject): bool;
extern macro IsContext(HeapObject): bool;
extern macro IsCustomElementsReceiverInstanceType(int32): bool;
extern macro IsExtensibleMap(Map): bool;
extern macro IsFixedArray(HeapObject): bool;
extern macro IsHeapNumber(HeapObject): bool;
extern macro IsJSArrayMap(Map): bool;
extern macro IsJSProxy(HeapObject): bool;
extern macro IsName(HeapObject): bool;
extern macro IsNativeContext(HeapObject): bool;
extern macro IsNumberNormalized(Number): bool;
extern macro IsNumber(Object): bool;
extern macro IsPrivateSymbol(HeapObject): bool;
extern macro IsSafeInteger(Object): bool;
@export
macro IsAccessorInfo(o: HeapObject): bool {
return Is<AccessorInfo>(o);
}
@export
macro IsAccessorPair(o: HeapObject): bool {
return Is<AccessorPair>(o);
}
@export
macro IsAllocationSite(o: HeapObject): bool {
Cast<AllocationSite>(o) otherwise return false;
return true;
return Is<AllocationSite>(o);
}
@export
macro IsCell(o: HeapObject): bool {
return Is<Cell>(o);
}
@export
macro IsCode(o: HeapObject): bool {
return Is<Code>(o);
}
@export
macro IsContext(o: HeapObject): bool {
return Is<Context>(o);
}
@export
macro IsCoverageInfo(o: HeapObject): bool {
return Is<CoverageInfo>(o);
}
@export
macro IsDebugInfo(o: HeapObject): bool {
return Is<DebugInfo>(o);
}
@export
macro IsFixedDoubleArray(o: HeapObject): bool {
return Is<FixedDoubleArray>(o);
}
@export
macro IsFeedbackCell(o: HeapObject): bool {
return Is<FeedbackCell>(o);
}
@export
macro IsFeedbackVector(o: HeapObject): bool {
return Is<FeedbackVector>(o);
}
@export
macro IsHeapNumber(o: HeapObject): bool {
return Is<HeapNumber>(o);
}
@export
macro IsNativeContext(o: HeapObject): bool {
return Is<NativeContext>(o);
}
@export
macro IsNumber(o: Object): bool {
return Is<Number>(o);
}
@export
macro IsPrivateSymbol(o: HeapObject): bool {
return Is<PrivateSymbol>(o);
}
@export
macro IsPromiseCapability(o: HeapObject): bool {
return Is<PromiseCapability>(o);
}
@export
macro IsPromiseFulfillReactionJobTask(o: HeapObject): bool {
return Is<PromiseFulfillReactionJobTask>(o);
}
@export
macro IsPromiseReaction(o: HeapObject): bool {
return Is<PromiseReaction>(o);
}
@export
macro IsPromiseRejectReactionJobTask(o: HeapObject): bool {
return Is<PromiseRejectReactionJobTask>(o);
}
@export
macro IsSharedFunctionInfo(o: HeapObject): bool {
return Is<SharedFunctionInfo>(o);
}
@export
macro IsSymbol(o: HeapObject): bool {
return Is<Symbol>(o);
}
extern macro TaggedToHeapObject(Object): HeapObject
@ -39,8 +129,6 @@ extern macro HeapObjectToConstructor(HeapObject): Constructor
extern macro HeapObjectToJSFunctionWithPrototypeSlot(HeapObject):
JSFunctionWithPrototypeSlot
labels CastError;
extern macro TaggedToNumber(Object): Number
labels CastError;
macro Cast<A : type extends WeakHeapObject>(o: A|Object): A labels CastError {
if (!IsWeakOrCleared(o)) goto CastError;
@ -87,7 +175,17 @@ Cast<Zero>(o: Object): Zero labels CastError {
Cast<Number>(o: Object): Number
labels CastError {
return TaggedToNumber(o) otherwise CastError;
typeswitch (o) {
case (s: Smi): {
return s;
}
case (n: HeapNumber): {
return n;
}
case (Object): {
goto CastError;
}
}
}
Cast<Undefined>(o: Object): Undefined
@ -288,24 +386,21 @@ Cast<Undefined|Callable>(o: HeapObject): Undefined|Callable
}
macro Cast<T : type extends Symbol>(o: Symbol): T labels CastError;
Cast<PublicSymbol>(o: Symbol): PublicSymbol labels CastError {
if (IsPrivateSymbol(o)) goto CastError;
return %RawDownCast<PublicSymbol>(o);
Cast<PublicSymbol>(s: Symbol): PublicSymbol labels CastError {
if (s.flags.is_private) goto CastError;
return %RawDownCast<PublicSymbol>(s);
}
Cast<PrivateSymbol>(o: Symbol): PrivateSymbol labels CastError {
if (IsPrivateSymbol(o)) {
return %RawDownCast<PrivateSymbol>(o);
}
Cast<PrivateSymbol>(s: Symbol): PrivateSymbol labels CastError {
if (s.flags.is_private) return %RawDownCast<PrivateSymbol>(s);
goto CastError;
}
Cast<PublicSymbol>(o: HeapObject): PublicSymbol labels CastError {
const o = Cast<Symbol>(o) otherwise CastError;
return Cast<PublicSymbol>(o) otherwise CastError;
const s = Cast<Symbol>(o) otherwise CastError;
return Cast<PublicSymbol>(s) otherwise CastError;
}
Cast<PrivateSymbol>(o: HeapObject): PrivateSymbol labels CastError {
const o = Cast<Symbol>(o) otherwise CastError;
return Cast<PrivateSymbol>(o) otherwise CastError;
const s = Cast<Symbol>(o) otherwise CastError;
return Cast<PrivateSymbol>(s) otherwise CastError;
}
Cast<DirectString>(o: HeapObject): DirectString
@ -385,10 +480,10 @@ Cast<FastJSArray>(implicit context: Context)(o: HeapObject): FastJSArray
labels CastError {
if (IsForceSlowPath()) goto CastError;
const map: Map = o.map;
if (!IsJSArrayMap(map)) goto CastError;
if (!Is<JSArray>(o)) goto CastError;
// Bailout if receiver has slow elements.
const map: Map = o.map;
const elementsKind: ElementsKind = LoadMapElementsKind(map);
if (!IsFastElementsKind(elementsKind)) goto CastError;
@ -402,10 +497,10 @@ Cast<FastJSArray>(implicit context: Context)(o: HeapObject): FastJSArray
Cast<FastJSArrayForRead>(implicit context: Context)(o: HeapObject):
FastJSArrayForRead
labels CastError {
const map: Map = o.map;
if (!IsJSArrayMap(map)) goto CastError;
if (!Is<JSArray>(o)) goto CastError;
// Bailout if receiver has slow elements.
const map: Map = o.map;
const elementsKind: ElementsKind = LoadMapElementsKind(map);
if (!IsElementsKindLessThanOrEqual(
elementsKind, ElementsKind::LAST_ANY_NONEXTENSIBLE_ELEMENTS_KIND))

View File

@ -16,7 +16,7 @@ ProxyDeleteProperty(implicit context: Context)(
PerformStackCheck();
// 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name));
assert(IsName(name));
assert(Is<Name>(name));
assert(!IsPrivateSymbol(name));
try {

View File

@ -18,7 +18,7 @@ ProxyGetProperty(implicit context: Context)(
PerformStackCheck();
// 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name));
assert(IsName(name));
assert(Is<Name>(name));
assert(!IsPrivateSymbol(name));
// 2. Let handler be O.[[ProxyHandler]].

View File

@ -10,12 +10,12 @@ namespace proxy {
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p
transitioning builtin ProxyHasProperty(implicit context: Context)(
proxy: JSProxy, name: PropertyKey): JSAny {
assert(IsJSProxy(proxy));
assert(Is<JSProxy>(proxy));
PerformStackCheck();
// 1. Assert: IsPropertyKey(P) is true.
assert(IsName(name));
assert(Is<Name>(name));
assert(!IsPrivateSymbol(name));
try {

View File

@ -23,7 +23,7 @@ ProxySetProperty(implicit context: Context)(
receiverValue: JSAny): JSAny {
// 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name));
assert(IsName(name));
assert(Is<Name>(name));
let key: PropertyKey;
typeswitch (name) {

View File

@ -5635,14 +5635,6 @@ TNode<BoolT> CodeStubAssembler::IsCallableMap(SloppyTNode<Map> map) {
return IsSetWord32<Map::Bits1::IsCallableBit>(LoadMapBitField(map));
}
TNode<BoolT> CodeStubAssembler::IsCoverageInfo(TNode<HeapObject> object) {
return IsCoverageInfoMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsDebugInfo(TNode<HeapObject> object) {
return HasInstanceType(object, DEBUG_INFO_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsDeprecatedMap(SloppyTNode<Map> map) {
CSA_ASSERT(this, IsMap(map));
return IsSetWord32<Map::Bits3::IsDeprecatedBit>(LoadMapBitField3(map));
@ -5774,14 +5766,6 @@ TNode<BoolT> CodeStubAssembler::IsCallable(SloppyTNode<HeapObject> object) {
return IsCallableMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsCell(SloppyTNode<HeapObject> object) {
return TaggedEqual(LoadMap(object), CellMapConstant());
}
TNode<BoolT> CodeStubAssembler::IsCode(SloppyTNode<HeapObject> object) {
return HasInstanceType(object, CODE_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsConstructorMap(SloppyTNode<Map> map) {
CSA_ASSERT(this, IsMap(map));
return IsSetWord32<Map::Bits1::IsConstructorBit>(LoadMapBitField(map));
@ -5996,13 +5980,6 @@ TNode<BoolT> CodeStubAssembler::IsJSAsyncGeneratorObject(
return HasInstanceType(object, JS_ASYNC_GENERATOR_OBJECT_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsContext(SloppyTNode<HeapObject> object) {
TNode<Uint16T> instance_type = LoadInstanceType(object);
return UncheckedCast<BoolT>(Word32And(
Int32GreaterThanOrEqual(instance_type, Int32Constant(FIRST_CONTEXT_TYPE)),
Int32LessThanOrEqual(instance_type, Int32Constant(LAST_CONTEXT_TYPE))));
}
TNode<BoolT> CodeStubAssembler::IsFixedArray(SloppyTNode<HeapObject> object) {
return HasInstanceType(object, FIXED_ARRAY_TYPE);
}
@ -6026,21 +6003,11 @@ TNode<BoolT> CodeStubAssembler::IsNotWeakFixedArraySubclass(
Int32Constant(LAST_WEAK_FIXED_ARRAY_TYPE))));
}
TNode<BoolT> CodeStubAssembler::IsPromiseCapability(
SloppyTNode<HeapObject> object) {
return HasInstanceType(object, PROMISE_CAPABILITY_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsPropertyArray(
SloppyTNode<HeapObject> object) {
return HasInstanceType(object, PROPERTY_ARRAY_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsPromiseReaction(
SloppyTNode<HeapObject> object) {
return HasInstanceType(object, PROMISE_REACTION_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsPromiseReactionJobTask(
TNode<HeapObject> object) {
TNode<Uint16T> instance_type = LoadInstanceType(object);
@ -6048,16 +6015,6 @@ TNode<BoolT> CodeStubAssembler::IsPromiseReactionJobTask(
LAST_PROMISE_REACTION_JOB_TASK_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsPromiseRejectReactionJobTask(
SloppyTNode<HeapObject> object) {
return HasInstanceType(object, PROMISE_REJECT_REACTION_JOB_TASK_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsPromiseFulfillReactionJobTask(
SloppyTNode<HeapObject> object) {
return HasInstanceType(object, PROMISE_FULFILL_REACTION_JOB_TASK_TYPE);
}
// This complicated check is due to elements oddities. If a smi array is empty
// after Array.p.shift, it is replaced by the empty array constant. If it is
// later filled with a double element, we try to grow it but pass in a double
@ -6103,18 +6060,6 @@ TNode<BoolT> CodeStubAssembler::IsPropertyCell(SloppyTNode<HeapObject> object) {
return IsPropertyCellMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsAccessorInfo(SloppyTNode<HeapObject> object) {
return IsAccessorInfoMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsAccessorPair(SloppyTNode<HeapObject> object) {
return IsAccessorPairMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsHeapNumber(SloppyTNode<HeapObject> object) {
return IsHeapNumberMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsHeapNumberInstanceType(
SloppyTNode<Int32T> instance_type) {
return InstanceTypeEqual(instance_type, HEAP_NUMBER_TYPE);
@ -6129,15 +6074,6 @@ TNode<BoolT> CodeStubAssembler::IsOddballInstanceType(
return InstanceTypeEqual(instance_type, ODDBALL_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsFeedbackCell(SloppyTNode<HeapObject> object) {
return HasInstanceType(object, FEEDBACK_CELL_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsFeedbackVector(
SloppyTNode<HeapObject> object) {
return IsFeedbackVectorMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsName(SloppyTNode<HeapObject> object) {
return IsNameInstanceType(LoadInstanceType(object));
}
@ -6156,10 +6092,6 @@ TNode<BoolT> CodeStubAssembler::IsSymbolInstanceType(
return InstanceTypeEqual(instance_type, SYMBOL_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsSymbol(SloppyTNode<HeapObject> object) {
return IsSymbolMap(LoadMap(object));
}
TNode<BoolT> CodeStubAssembler::IsInternalizedStringInstanceType(
TNode<Int32T> instance_type) {
STATIC_ASSERT(kNotInternalizedTag != 0);
@ -6225,34 +6157,11 @@ TNode<BoolT> CodeStubAssembler::IsPrimitiveInstanceType(
Int32Constant(LAST_PRIMITIVE_HEAP_OBJECT_TYPE));
}
TNode<BoolT> CodeStubAssembler::IsPrivateSymbol(
SloppyTNode<HeapObject> object) {
return Select<BoolT>(
IsSymbol(object),
[=] {
TNode<Symbol> symbol = CAST(object);
TNode<Uint32T> flags =
LoadObjectField<Uint32T>(symbol, Symbol::kFlagsOffset);
return IsSetWord32<Symbol::IsPrivateBit>(flags);
},
[=] { return Int32FalseConstant(); });
}
TNode<BoolT> CodeStubAssembler::IsPrivateName(SloppyTNode<Symbol> symbol) {
TNode<Uint32T> flags = LoadObjectField<Uint32T>(symbol, Symbol::kFlagsOffset);
return IsSetWord32<Symbol::IsPrivateNameBit>(flags);
}
TNode<BoolT> CodeStubAssembler::IsNativeContext(
SloppyTNode<HeapObject> object) {
return HasInstanceType(object, NATIVE_CONTEXT_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsFixedDoubleArray(
SloppyTNode<HeapObject> object) {
return TaggedEqual(LoadMap(object), FixedDoubleArrayMapConstant());
}
TNode<BoolT> CodeStubAssembler::IsHashTable(SloppyTNode<HeapObject> object) {
TNode<Uint16T> instance_type = LoadInstanceType(object);
return UncheckedCast<BoolT>(
@ -6330,12 +6239,6 @@ TNode<BoolT> CodeStubAssembler::IsJSRegExp(SloppyTNode<HeapObject> object) {
return HasInstanceType(object, JS_REG_EXP_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsNumber(SloppyTNode<Object> object) {
return Select<BoolT>(
TaggedIsSmi(object), [=] { return Int32TrueConstant(); },
[=] { return IsHeapNumber(CAST(object)); });
}
TNode<BoolT> CodeStubAssembler::IsNumeric(SloppyTNode<Object> object) {
return Select<BoolT>(
TaggedIsSmi(object), [=] { return Int32TrueConstant(); },
@ -9663,7 +9566,7 @@ Node* CodeStubAssembler::PrepareValueForWriteToTypedArray(
// We can handle both HeapNumber and Oddball here, since Oddball has the
// same layout as the HeapNumber for the HeapNumber::value field. This
// way we can also properly optimize stores of oddballs to typed arrays.
GotoIf(IsHeapNumber(var_input.value()), &if_heapnumber_or_oddball);
GotoIf(IsHeapNumber(CAST(var_input.value())), &if_heapnumber_or_oddball);
STATIC_ASSERT_FIELD_OFFSETS_EQUAL(HeapNumber::kValueOffset,
Oddball::kToNumberRawOffset);
Branch(HasInstanceType(var_input.value(), ODDBALL_TYPE),

View File

@ -111,132 +111,96 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
V, rootIndexName, rootAccessorName, class_name) \
V(rootIndexName, rootAccessorName, class_name##Map)
#define HEAP_IMMUTABLE_IMMOVABLE_OBJECT_LIST(V) \
V(AccessorInfoMap, accessor_info_map, AccessorInfoMap) \
V(AccessorPairMap, accessor_pair_map, AccessorPairMap) \
V(AllocationMementoMap, allocation_memento_map, AllocationMementoMap) \
V(AllocationSiteWithoutWeakNextMap, allocation_site_without_weaknext_map, \
AllocationSiteWithoutWeakNextMap) \
V(AllocationSiteWithWeakNextMap, allocation_site_map, AllocationSiteMap) \
V(arguments_to_string, arguments_to_string, ArgumentsToString) \
V(ArrayBoilerplateDescriptionMap, array_boilerplate_description_map, \
ArrayBoilerplateDescriptionMap) \
V(Array_string, Array_string, ArrayString) \
V(array_to_string, array_to_string, ArrayToString) \
V(BooleanMap, boolean_map, BooleanMap) \
V(boolean_to_string, boolean_to_string, BooleanToString) \
V(CellMap, cell_map, CellMap) \
V(CodeMap, code_map, CodeMap) \
V(ConsOneByteStringMap, cons_one_byte_string_map, ConsOneByteStringMap) \
V(ConsStringMap, cons_string_map, ConsStringMap) \
V(constructor_string, constructor_string, ConstructorString) \
V(CoverageInfoMap, coverage_info_map, CoverageInfoMap) \
V(date_to_string, date_to_string, DateToString) \
V(default_string, default_string, DefaultString) \
V(EmptyByteArray, empty_byte_array, EmptyByteArray) \
V(EmptyFixedArray, empty_fixed_array, EmptyFixedArray) \
V(EmptyPropertyDictionary, empty_property_dictionary, \
EmptyPropertyDictionary) \
V(EmptySlowElementDictionary, empty_slow_element_dictionary, \
EmptySlowElementDictionary) \
V(empty_string, empty_string, EmptyString) \
V(error_to_string, error_to_string, ErrorToString) \
V(errors_string, errors_string, ErrorsString) \
V(FalseValue, false_value, False) \
V(FeedbackVectorMap, feedback_vector_map, FeedbackVectorMap) \
V(FixedArrayMap, fixed_array_map, FixedArrayMap) \
V(FixedCOWArrayMap, fixed_cow_array_map, FixedCOWArrayMap) \
V(FixedDoubleArrayMap, fixed_double_array_map, FixedDoubleArrayMap) \
V(Function_string, function_string, FunctionString) \
V(FunctionTemplateInfoMap, function_template_info_map, \
FunctionTemplateInfoMap) \
V(function_to_string, function_to_string, FunctionToString) \
V(GlobalPropertyCellMap, global_property_cell_map, PropertyCellMap) \
V(has_instance_symbol, has_instance_symbol, HasInstanceSymbol) \
V(HeapNumberMap, heap_number_map, HeapNumberMap) \
V(Infinity_string, Infinity_string, InfinityString) \
V(is_concat_spreadable_symbol, is_concat_spreadable_symbol, \
IsConcatSpreadableSymbol) \
V(iterator_symbol, iterator_symbol, IteratorSymbol) \
V(length_string, length_string, LengthString) \
V(ManyClosuresCellMap, many_closures_cell_map, ManyClosuresCellMap) \
V(match_symbol, match_symbol, MatchSymbol) \
V(megamorphic_symbol, megamorphic_symbol, MegamorphicSymbol) \
V(message_string, message_string, MessageString) \
V(MetaMap, meta_map, MetaMap) \
V(minus_Infinity_string, minus_Infinity_string, MinusInfinityString) \
V(MinusZeroValue, minus_zero_value, MinusZero) \
V(name_string, name_string, NameString) \
V(NanValue, nan_value, Nan) \
V(NaN_string, NaN_string, NaNString) \
V(next_string, next_string, NextString) \
V(NoClosuresCellMap, no_closures_cell_map, NoClosuresCellMap) \
V(null_to_string, null_to_string, NullToString) \
V(NullValue, null_value, Null) \
V(number_string, number_string, NumberString) \
V(number_to_string, number_to_string, NumberToString) \
V(Object_string, Object_string, ObjectString) \
V(object_to_string, object_to_string, ObjectToString) \
V(OneByteStringMap, one_byte_string_map, OneByteStringMap) \
V(OneClosureCellMap, one_closure_cell_map, OneClosureCellMap) \
V(OnePointerFillerMap, one_pointer_filler_map, OnePointerFillerMap) \
V(PreparseDataMap, preparse_data_map, PreparseDataMap) \
V(PromiseCapabilityMap, promise_capability_map, PromiseCapabilityMap) \
V(promise_forwarding_handler_symbol, promise_forwarding_handler_symbol, \
PromiseForwardingHandlerSymbol) \
V(PromiseFulfillReactionJobTaskMap, promise_fulfill_reaction_job_task_map, \
PromiseFulfillReactionJobTaskMap) \
V(promise_handled_by_symbol, promise_handled_by_symbol, \
PromiseHandledBySymbol) \
V(PromiseReactionMap, promise_reaction_map, PromiseReactionMap) \
V(PromiseRejectReactionJobTaskMap, promise_reject_reaction_job_task_map, \
PromiseRejectReactionJobTaskMap) \
V(PromiseResolveThenableJobTaskMap, promise_resolve_thenable_job_task_map, \
PromiseResolveThenableJobTaskMap) \
V(prototype_string, prototype_string, PrototypeString) \
V(PrototypeInfoMap, prototype_info_map, PrototypeInfoMap) \
V(replace_symbol, replace_symbol, ReplaceSymbol) \
V(regexp_to_string, regexp_to_string, RegexpToString) \
V(resolve_string, resolve_string, ResolveString) \
V(return_string, return_string, ReturnString) \
V(SharedFunctionInfoMap, shared_function_info_map, SharedFunctionInfoMap) \
V(SmallOrderedHashSetMap, small_ordered_hash_set_map, \
SmallOrderedHashSetMap) \
V(SmallOrderedHashMapMap, small_ordered_hash_map_map, \
SmallOrderedHashMapMap) \
V(SmallOrderedNameDictionaryMap, small_ordered_name_dictionary_map, \
SmallOrderedNameDictionaryMap) \
V(species_symbol, species_symbol, SpeciesSymbol) \
V(StaleRegister, stale_register, StaleRegister) \
V(StoreHandler0Map, store_handler0_map, StoreHandler0Map) \
V(string_string, string_string, StringString) \
V(string_to_string, string_to_string, StringToString) \
V(StringMap, string_map, StringMap) \
V(SymbolMap, symbol_map, SymbolMap) \
V(TheHoleValue, the_hole_value, TheHole) \
V(then_string, then_string, ThenString) \
V(toString_string, toString_string, ToStringString) \
V(to_primitive_symbol, to_primitive_symbol, ToPrimitiveSymbol) \
V(to_string_tag_symbol, to_string_tag_symbol, ToStringTagSymbol) \
V(TransitionArrayMap, transition_array_map, TransitionArrayMap) \
V(TrueValue, true_value, True) \
V(Tuple2Map, tuple2_map, Tuple2Map) \
V(BreakPointMap, break_point_map, BreakPointMap) \
V(BreakPointInfoMap, break_point_info_map, BreakPointInfoMap) \
V(CachedTemplateObjectMap, cached_template_object_map, \
CachedTemplateObjectMap) \
V(UncompiledDataWithoutPreparseDataMap, \
uncompiled_data_without_preparse_data_map, \
UncompiledDataWithoutPreparseDataMap) \
V(UncompiledDataWithPreparseDataMap, uncompiled_data_with_preparse_data_map, \
UncompiledDataWithPreparseDataMap) \
V(undefined_to_string, undefined_to_string, UndefinedToString) \
V(UndefinedValue, undefined_value, Undefined) \
V(uninitialized_symbol, uninitialized_symbol, UninitializedSymbol) \
V(valueOf_string, valueOf_string, ValueOfString) \
V(WeakFixedArrayMap, weak_fixed_array_map, WeakFixedArrayMap) \
V(zero_string, zero_string, ZeroString) \
UNIQUE_INSTANCE_TYPE_MAP_LIST_GENERATOR( \
#define HEAP_IMMUTABLE_IMMOVABLE_OBJECT_LIST(V) \
V(AllocationSiteWithoutWeakNextMap, allocation_site_without_weaknext_map, \
AllocationSiteWithoutWeakNextMap) \
V(AllocationSiteWithWeakNextMap, allocation_site_map, AllocationSiteMap) \
V(arguments_to_string, arguments_to_string, ArgumentsToString) \
V(Array_string, Array_string, ArrayString) \
V(array_to_string, array_to_string, ArrayToString) \
V(BooleanMap, boolean_map, BooleanMap) \
V(boolean_to_string, boolean_to_string, BooleanToString) \
V(ConsOneByteStringMap, cons_one_byte_string_map, ConsOneByteStringMap) \
V(ConsStringMap, cons_string_map, ConsStringMap) \
V(constructor_string, constructor_string, ConstructorString) \
V(date_to_string, date_to_string, DateToString) \
V(default_string, default_string, DefaultString) \
V(EmptyByteArray, empty_byte_array, EmptyByteArray) \
V(EmptyFixedArray, empty_fixed_array, EmptyFixedArray) \
V(EmptyPropertyDictionary, empty_property_dictionary, \
EmptyPropertyDictionary) \
V(EmptySlowElementDictionary, empty_slow_element_dictionary, \
EmptySlowElementDictionary) \
V(empty_string, empty_string, EmptyString) \
V(error_to_string, error_to_string, ErrorToString) \
V(errors_string, errors_string, ErrorsString) \
V(FalseValue, false_value, False) \
V(FixedArrayMap, fixed_array_map, FixedArrayMap) \
V(FixedCOWArrayMap, fixed_cow_array_map, FixedCOWArrayMap) \
V(Function_string, function_string, FunctionString) \
V(function_to_string, function_to_string, FunctionToString) \
V(GlobalPropertyCellMap, global_property_cell_map, PropertyCellMap) \
V(has_instance_symbol, has_instance_symbol, HasInstanceSymbol) \
V(Infinity_string, Infinity_string, InfinityString) \
V(is_concat_spreadable_symbol, is_concat_spreadable_symbol, \
IsConcatSpreadableSymbol) \
V(iterator_symbol, iterator_symbol, IteratorSymbol) \
V(length_string, length_string, LengthString) \
V(ManyClosuresCellMap, many_closures_cell_map, ManyClosuresCellMap) \
V(match_symbol, match_symbol, MatchSymbol) \
V(megamorphic_symbol, megamorphic_symbol, MegamorphicSymbol) \
V(message_string, message_string, MessageString) \
V(minus_Infinity_string, minus_Infinity_string, MinusInfinityString) \
V(MinusZeroValue, minus_zero_value, MinusZero) \
V(name_string, name_string, NameString) \
V(NanValue, nan_value, Nan) \
V(NaN_string, NaN_string, NaNString) \
V(next_string, next_string, NextString) \
V(NoClosuresCellMap, no_closures_cell_map, NoClosuresCellMap) \
V(null_to_string, null_to_string, NullToString) \
V(NullValue, null_value, Null) \
V(number_string, number_string, NumberString) \
V(number_to_string, number_to_string, NumberToString) \
V(Object_string, Object_string, ObjectString) \
V(object_to_string, object_to_string, ObjectToString) \
V(OneByteStringMap, one_byte_string_map, OneByteStringMap) \
V(OneClosureCellMap, one_closure_cell_map, OneClosureCellMap) \
V(OnePointerFillerMap, one_pointer_filler_map, OnePointerFillerMap) \
V(PromiseCapabilityMap, promise_capability_map, PromiseCapabilityMap) \
V(promise_forwarding_handler_symbol, promise_forwarding_handler_symbol, \
PromiseForwardingHandlerSymbol) \
V(PromiseFulfillReactionJobTaskMap, promise_fulfill_reaction_job_task_map, \
PromiseFulfillReactionJobTaskMap) \
V(promise_handled_by_symbol, promise_handled_by_symbol, \
PromiseHandledBySymbol) \
V(PromiseReactionMap, promise_reaction_map, PromiseReactionMap) \
V(PromiseRejectReactionJobTaskMap, promise_reject_reaction_job_task_map, \
PromiseRejectReactionJobTaskMap) \
V(PromiseResolveThenableJobTaskMap, promise_resolve_thenable_job_task_map, \
PromiseResolveThenableJobTaskMap) \
V(prototype_string, prototype_string, PrototypeString) \
V(replace_symbol, replace_symbol, ReplaceSymbol) \
V(regexp_to_string, regexp_to_string, RegexpToString) \
V(resolve_string, resolve_string, ResolveString) \
V(return_string, return_string, ReturnString) \
V(species_symbol, species_symbol, SpeciesSymbol) \
V(StaleRegister, stale_register, StaleRegister) \
V(StoreHandler0Map, store_handler0_map, StoreHandler0Map) \
V(string_string, string_string, StringString) \
V(string_to_string, string_to_string, StringToString) \
V(StringMap, string_map, StringMap) \
V(TheHoleValue, the_hole_value, TheHole) \
V(then_string, then_string, ThenString) \
V(toString_string, toString_string, ToStringString) \
V(to_primitive_symbol, to_primitive_symbol, ToPrimitiveSymbol) \
V(to_string_tag_symbol, to_string_tag_symbol, ToStringTagSymbol) \
V(TrueValue, true_value, True) \
V(undefined_to_string, undefined_to_string, UndefinedToString) \
V(UndefinedValue, undefined_value, Undefined) \
V(uninitialized_symbol, uninitialized_symbol, UninitializedSymbol) \
V(valueOf_string, valueOf_string, ValueOfString) \
V(zero_string, zero_string, ZeroString) \
UNIQUE_INSTANCE_TYPE_MAP_LIST_GENERATOR( \
UNIQUE_INSTANCE_TYPE_IMMUTABLE_IMMOVABLE_MAP_ADAPTER, V)
#define HEAP_IMMOVABLE_OBJECT_LIST(V) \
@ -465,11 +429,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<String> TaggedToDirectString(TNode<Object> value, Label* fail);
TNode<Number> TaggedToNumber(TNode<Object> value, Label* fail) {
GotoIfNot(IsNumber(value), fail);
return UncheckedCast<Number>(value);
}
TNode<HeapObject> TaggedToHeapObject(TNode<Object> value, Label* fail) {
GotoIf(TaggedIsSmi(value), fail);
return UncheckedCast<HeapObject>(value);
@ -2524,8 +2483,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Check whether the map is for an object with special properties, such as a
// JSProxy or an object with interceptors.
TNode<BoolT> InstanceTypeEqual(SloppyTNode<Int32T> instance_type, int type);
TNode<BoolT> IsAccessorInfo(SloppyTNode<HeapObject> object);
TNode<BoolT> IsAccessorPair(SloppyTNode<HeapObject> object);
TNode<BoolT> IsNoElementsProtectorCellInvalid();
TNode<BoolT> IsArrayIteratorProtectorCellInvalid();
TNode<BoolT> IsBigIntInstanceType(SloppyTNode<Int32T> instance_type);
@ -2534,33 +2491,24 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> IsCallableMap(SloppyTNode<Map> map);
TNode<BoolT> IsCallable(SloppyTNode<HeapObject> object);
TNode<BoolT> TaggedIsCallable(TNode<Object> object);
TNode<BoolT> IsCell(SloppyTNode<HeapObject> object);
TNode<BoolT> IsCode(SloppyTNode<HeapObject> object);
TNode<BoolT> IsConsStringInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsConstructorMap(SloppyTNode<Map> map);
TNode<BoolT> IsConstructor(SloppyTNode<HeapObject> object);
TNode<BoolT> IsCoverageInfo(TNode<HeapObject> object);
TNode<BoolT> IsDebugInfo(TNode<HeapObject> object);
TNode<BoolT> IsDeprecatedMap(SloppyTNode<Map> map);
TNode<BoolT> IsNameDictionary(SloppyTNode<HeapObject> object);
TNode<BoolT> IsGlobalDictionary(SloppyTNode<HeapObject> object);
TNode<BoolT> IsExtensibleMap(SloppyTNode<Map> map);
TNode<BoolT> IsExtensibleNonPrototypeMap(TNode<Map> map);
TNode<BoolT> IsExternalStringInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsFeedbackCell(SloppyTNode<HeapObject> object);
TNode<BoolT> IsFeedbackVector(SloppyTNode<HeapObject> object);
TNode<BoolT> IsContext(SloppyTNode<HeapObject> object);
TNode<BoolT> IsFixedArray(SloppyTNode<HeapObject> object);
TNode<BoolT> IsFixedArraySubclass(SloppyTNode<HeapObject> object);
TNode<BoolT> IsFixedArrayWithKind(SloppyTNode<HeapObject> object,
ElementsKind kind);
TNode<BoolT> IsFixedArrayWithKindOrEmpty(SloppyTNode<FixedArrayBase> object,
ElementsKind kind);
TNode<BoolT> IsFixedDoubleArray(SloppyTNode<HeapObject> object);
TNode<BoolT> IsFunctionWithPrototypeSlotMap(SloppyTNode<Map> map);
TNode<BoolT> IsHashTable(SloppyTNode<HeapObject> object);
TNode<BoolT> IsEphemeronHashTable(SloppyTNode<HeapObject> object);
TNode<BoolT> IsHeapNumber(SloppyTNode<HeapObject> object);
TNode<BoolT> IsHeapNumberInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsOddball(SloppyTNode<HeapObject> object);
TNode<BoolT> IsOddballInstanceType(SloppyTNode<Int32T> instance_type);
@ -2605,21 +2553,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> IsMap(SloppyTNode<HeapObject> object);
TNode<BoolT> IsName(SloppyTNode<HeapObject> object);
TNode<BoolT> IsNameInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsNativeContext(SloppyTNode<HeapObject> object);
TNode<BoolT> IsNullOrJSReceiver(SloppyTNode<HeapObject> object);
TNode<BoolT> IsNullOrUndefined(SloppyTNode<Object> object);
TNode<BoolT> IsNumberDictionary(SloppyTNode<HeapObject> object);
TNode<BoolT> IsOneByteStringInstanceType(TNode<Int32T> instance_type);
TNode<BoolT> IsPrimitiveInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsPrivateSymbol(SloppyTNode<HeapObject> object);
TNode<BoolT> IsPrivateName(SloppyTNode<Symbol> symbol);
TNode<BoolT> IsPromiseCapability(SloppyTNode<HeapObject> object);
TNode<BoolT> IsPropertyArray(SloppyTNode<HeapObject> object);
TNode<BoolT> IsPropertyCell(SloppyTNode<HeapObject> object);
TNode<BoolT> IsPromiseReaction(SloppyTNode<HeapObject> object);
TNode<BoolT> IsPromiseReactionJobTask(TNode<HeapObject> object);
TNode<BoolT> IsPromiseRejectReactionJobTask(SloppyTNode<HeapObject> object);
TNode<BoolT> IsPromiseFulfillReactionJobTask(SloppyTNode<HeapObject> object);
TNode<BoolT> IsPrototypeInitialArrayPrototype(SloppyTNode<Context> context,
SloppyTNode<Map> map);
TNode<BoolT> IsPrototypeTypedArrayPrototype(SloppyTNode<Context> context,
@ -2643,7 +2585,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> IsStringInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsString(SloppyTNode<HeapObject> object);
TNode<BoolT> IsSymbolInstanceType(SloppyTNode<Int32T> instance_type);
TNode<BoolT> IsSymbol(SloppyTNode<HeapObject> object);
TNode<BoolT> IsInternalizedStringInstanceType(TNode<Int32T> instance_type);
TNode<BoolT> IsUniqueName(TNode<HeapObject> object);
TNode<BoolT> IsUniqueNameNoIndex(TNode<HeapObject> object);
@ -2652,10 +2593,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> IsNotWeakFixedArraySubclass(SloppyTNode<HeapObject> object);
TNode<BoolT> IsZeroOrContext(SloppyTNode<Object> object);
inline TNode<BoolT> IsSharedFunctionInfo(TNode<HeapObject> object) {
return IsSharedFunctionInfoMap(LoadMap(object));
}
TNode<BoolT> IsPromiseResolveProtectorCellInvalid();
TNode<BoolT> IsPromiseThenProtectorCellInvalid();
TNode<BoolT> IsArraySpeciesProtectorCellInvalid();
@ -2672,8 +2609,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Int32Constant(0));
}
// True iff |object| is a Smi or a HeapNumber.
TNode<BoolT> IsNumber(SloppyTNode<Object> object);
// True iff |object| is a Smi or a HeapNumber or a BigInt.
TNode<BoolT> IsNumeric(SloppyTNode<Object> object);
@ -2705,6 +2640,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Node* element_count, int base_size = FixedArray::kHeaderSize,
ParameterMode mode = INTPTR_PARAMETERS);
TNode<BoolT> IsMetaMap(TNode<HeapObject> o) { return IsMapMap(o); }
// ElementsKind helpers:
TNode<BoolT> ElementsKindEqual(TNode<Int32T> a, TNode<Int32T> b) {
return Word32Equal(a, b);

View File

@ -245,7 +245,44 @@ TYPED_ARRAYS(TYPED_ARRAY_IS_TYPE_FUNCTION_DECL)
// This list must contain only maps that are shared by all objects of their
// instance type.
#define UNIQUE_INSTANCE_TYPE_MAP_LIST_GENERATOR(V, _) \
#define UNIQUE_INSTANCE_TYPE_MAP_LIST_GENERATOR(V, _) \
V(_, AccessorInfoMap, accessor_info_map, AccessorInfo) \
V(_, AccessorPairMap, accessor_pair_map, AccessorPair) \
V(_, AllocationMementoMap, allocation_memento_map, AllocationMemento) \
V(_, ArrayBoilerplateDescriptionMap, array_boilerplate_description_map, \
ArrayBoilerplateDescription) \
V(_, BreakPointMap, break_point_map, BreakPoint) \
V(_, BreakPointInfoMap, break_point_info_map, BreakPointInfo) \
V(_, CachedTemplateObjectMap, cached_template_object_map, \
CachedTemplateObject) \
V(_, CellMap, cell_map, Cell) \
V(_, CodeMap, code_map, Code) \
V(_, CoverageInfoMap, coverage_info_map, CoverageInfo) \
V(_, DebugInfoMap, debug_info_map, DebugInfo) \
V(_, FeedbackVectorMap, feedback_vector_map, FeedbackVector) \
V(_, FixedDoubleArrayMap, fixed_double_array_map, FixedDoubleArray) \
V(_, FunctionTemplateInfoMap, function_template_info_map, \
FunctionTemplateInfo) \
V(_, HeapNumberMap, heap_number_map, HeapNumber) \
V(_, MetaMap, meta_map, Map) \
V(_, PreparseDataMap, preparse_data_map, PreparseData) \
V(_, PrototypeInfoMap, prototype_info_map, PrototypeInfo) \
V(_, SharedFunctionInfoMap, shared_function_info_map, SharedFunctionInfo) \
V(_, SmallOrderedHashSetMap, small_ordered_hash_set_map, \
SmallOrderedHashSet) \
V(_, SmallOrderedHashMapMap, small_ordered_hash_map_map, \
SmallOrderedHashMap) \
V(_, SmallOrderedNameDictionaryMap, small_ordered_name_dictionary_map, \
SmallOrderedNameDictionary) \
V(_, SymbolMap, symbol_map, Symbol) \
V(_, TransitionArrayMap, transition_array_map, TransitionArray) \
V(_, Tuple2Map, tuple2_map, Tuple2) \
V(_, UncompiledDataWithoutPreparseDataMap, \
uncompiled_data_without_preparse_data_map, \
UncompiledDataWithoutPreparseData) \
V(_, UncompiledDataWithPreparseDataMap, \
uncompiled_data_with_preparse_data_map, UncompiledDataWithPreparseData) \
V(_, WeakFixedArrayMap, weak_fixed_array_map, WeakFixedArray) \
TORQUE_DEFINED_MAP_CSA_LIST_GENERATOR(V, _)
} // namespace internal

View File

@ -2418,7 +2418,7 @@ TEST(IsSymbol) {
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeStubAssembler m(asm_tester.state());
Node* const symbol = m.Parameter(0);
TNode<HeapObject> const symbol = m.CAST(m.Parameter(0));
m.Return(m.SelectBooleanConstant(m.IsSymbol(symbol)));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -2437,7 +2437,7 @@ TEST(IsPrivateSymbol) {
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeStubAssembler m(asm_tester.state());
Node* const symbol = m.Parameter(0);
TNode<HeapObject> const symbol = m.CAST(m.Parameter(0));
m.Return(m.SelectBooleanConstant(m.IsPrivateSymbol(symbol)));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);