From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- chromium/v8/src/codegen/code-stub-assembler.h | 350 ++++++++++---------------- 1 file changed, 134 insertions(+), 216 deletions(-) (limited to 'chromium/v8/src/codegen/code-stub-assembler.h') diff --git a/chromium/v8/src/codegen/code-stub-assembler.h b/chromium/v8/src/codegen/code-stub-assembler.h index b01729c73db..a1369993994 100644 --- a/chromium/v8/src/codegen/code-stub-assembler.h +++ b/chromium/v8/src/codegen/code-stub-assembler.h @@ -107,6 +107,10 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; V(TypedArraySpeciesProtector, typed_array_species_protector, \ TypedArraySpeciesProtector) +#define UNIQUE_INSTANCE_TYPE_IMMUTABLE_IMMOVABLE_MAP_ADAPTER( \ + 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) \ @@ -137,6 +141,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; 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) \ @@ -168,7 +173,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; 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_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) \ @@ -195,8 +200,6 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; V(resolve_string, resolve_string, ResolveString) \ V(return_string, return_string, ReturnString) \ V(SharedFunctionInfoMap, shared_function_info_map, SharedFunctionInfoMap) \ - V(SloppyArgumentsElementsMap, sloppy_arguments_elements_map, \ - SloppyArgumentsElementsMap) \ V(SmallOrderedHashSetMap, small_ordered_hash_set_map, \ SmallOrderedHashSetMap) \ V(SmallOrderedHashMapMap, small_ordered_hash_map_map, \ @@ -212,6 +215,8 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; 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) \ @@ -228,9 +233,11 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; 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) \ - TORQUE_INTERNAL_MAP_CSA_LIST(V) + UNIQUE_INSTANCE_TYPE_MAP_LIST_GENERATOR( \ + UNIQUE_INSTANCE_TYPE_IMMUTABLE_IMMOVABLE_MAP_ADAPTER, V) #define HEAP_IMMOVABLE_OBJECT_LIST(V) \ HEAP_MUTABLE_IMMOVABLE_OBJECT_LIST(V) \ @@ -367,15 +374,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler #endif } - MachineRepresentation ParameterRepresentation(ParameterMode mode) const { - return mode == INTPTR_PARAMETERS ? MachineType::PointerRepresentation() - : MachineRepresentation::kTaggedSigned; - } - - MachineRepresentation OptimalParameterRepresentation() const { - return ParameterRepresentation(OptimalParameterMode()); - } - TNode ParameterToIntPtr(TNode value) { return SmiUntag(value); } TNode ParameterToIntPtr(TNode value) { return value; } // TODO(v8:9708): remove once all uses are ported. @@ -384,24 +382,20 @@ class V8_EXPORT_PRIVATE CodeStubAssembler return UncheckedCast(value); } - template - TNode IntPtrToParameter(TNode value); + TNode ParameterToTagged(TNode value) { return value; } - Node* IntPtrToParameter(SloppyTNode value, ParameterMode mode) { - if (mode == SMI_PARAMETERS) return SmiTag(value); - return value; - } - - Node* Int32ToParameter(SloppyTNode value, ParameterMode mode) { - return IntPtrToParameter(ChangeInt32ToIntPtr(value), mode); - } + TNode ParameterToTagged(TNode value) { return SmiTag(value); } TNode ParameterToTagged(Node* value, ParameterMode mode) { if (mode != SMI_PARAMETERS) return SmiTag(value); return UncheckedCast(value); } - Node* TaggedToParameter(SloppyTNode value, ParameterMode mode) { + template + TNode TaggedToParameter(TNode value); + + // TODO(v8:9708): remove once all uses are ported. + Node* TaggedToParameter(TNode value, ParameterMode mode) { if (mode != SMI_PARAMETERS) return SmiUntag(value); return value; } @@ -481,19 +475,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler return UncheckedCast(value); } - TNode HeapObjectToJSAggregateError( - TNode heap_object, Label* fail); - - TNode HeapObjectToJSArray(TNode heap_object, - Label* fail) { - GotoIfNot(IsJSArray(heap_object), fail); - return UncheckedCast(heap_object); - } - - TNode HeapObjectToJSArrayBuffer(TNode heap_object, - Label* fail) { - GotoIfNot(IsJSArrayBuffer(heap_object), fail); - return UncheckedCast(heap_object); + TNode Uint16Constant(uint16_t t) { + return UncheckedCast(Int32Constant(t)); } TNode TaggedToFastJSArray(TNode context, @@ -659,11 +642,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // TODO(v8:9708): remove once all uses are ported. Node* IntPtrOrSmiConstant(int value, ParameterMode mode); - bool IsIntPtrOrSmiConstantZero(TNode test); - bool IsIntPtrOrSmiConstantZero(TNode test); - // TODO(v8:9708): remove once all uses are ported. - bool IsIntPtrOrSmiConstantZero(Node* test, ParameterMode mode); - bool TryGetIntPtrOrSmiConstantValue(Node* maybe_constant, int* value, ParameterMode mode); @@ -777,15 +755,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler } } - Node* WordOrSmiShl(Node* a, int shift, ParameterMode mode) { - if (mode == SMI_PARAMETERS) { - return SmiShl(CAST(a), shift); - } else { - DCHECK_EQ(INTPTR_PARAMETERS, mode); - return WordShl(a, shift); - } - } - Node* WordOrSmiShr(Node* a, int shift, ParameterMode mode) { if (mode == SMI_PARAMETERS) { return SmiShr(CAST(a), shift); @@ -1437,11 +1406,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // This doesn't emit a bounds-check. As part of the security-performance // tradeoff, only use it if it is performance critical. TNode UnsafeLoadFixedArrayElement( - TNode object, Node* index, int additional_offset = 0, - ParameterMode parameter_mode = INTPTR_PARAMETERS, + TNode object, TNode index, int additional_offset = 0, LoadSensitivity needs_poisoning = LoadSensitivity::kSafe) { return LoadFixedArrayElement(object, index, additional_offset, - parameter_mode, needs_poisoning, + INTPTR_PARAMETERS, needs_poisoning, CheckBounds::kDebugOnly); } @@ -1452,14 +1420,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler return LoadFixedArrayElement(object, index, 0, INTPTR_PARAMETERS, needs_poisoning, check_bounds); } - // This doesn't emit a bounds-check. As part of the security-performance - // tradeoff, only use it if it is performance critical. - TNode UnsafeLoadFixedArrayElement(TNode object, - TNode index, - LoadSensitivity needs_poisoning) { - return LoadFixedArrayElement(object, index, needs_poisoning, - CheckBounds::kDebugOnly); - } TNode LoadFixedArrayElement( TNode object, TNode index, int additional_offset = 0, @@ -1514,18 +1474,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler } // Load an array element from a WeakFixedArray. - TNode LoadWeakFixedArrayElement( - TNode object, Node* index, int additional_offset = 0, - ParameterMode parameter_mode = INTPTR_PARAMETERS, - LoadSensitivity needs_poisoning = LoadSensitivity::kSafe); - - TNode LoadWeakFixedArrayElement( - TNode object, int index, int additional_offset = 0, - LoadSensitivity needs_poisoning = LoadSensitivity::kSafe) { - return LoadWeakFixedArrayElement(object, IntPtrConstant(index), - additional_offset, INTPTR_PARAMETERS, - needs_poisoning); - } + TNode LoadWeakFixedArrayElement(TNode object, + TNode index, + int additional_offset = 0); // Load an array element from a FixedDoubleArray. TNode LoadFixedDoubleArrayElement( @@ -1845,9 +1796,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode EnsureArrayPushable(TNode context, TNode map, Label* bailout); - void TryStoreArrayElement(ElementsKind kind, ParameterMode mode, - Label* bailout, TNode elements, - Node* index, TNode value); + void TryStoreArrayElement(ElementsKind kind, Label* bailout, + TNode elements, TNode index, + TNode value); // Consumes args into the array, and returns tagged new length. TNode BuildAppendJSArray(ElementsKind kind, TNode array, CodeStubArguments* args, @@ -1961,45 +1912,43 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // // Allocate and return a JSArray with initialized header fields and its // uninitialized elements. - // The ParameterMode argument is only used for the capacity parameter. std::pair, TNode> AllocateUninitializedJSArrayWithElements( ElementsKind kind, TNode array_map, TNode length, - TNode allocation_site, TNode capacity, - AllocationFlags allocation_flags = kNone, + base::Optional> allocation_site, + TNode capacity, AllocationFlags allocation_flags = kNone, int array_header_size = JSArray::kHeaderSize); // Allocate a JSArray and fill elements with the hole. - TNode AllocateJSArray(ElementsKind kind, TNode array_map, - TNode capacity, TNode length, - TNode allocation_site, - AllocationFlags allocation_flags = kNone); - TNode AllocateJSArray(ElementsKind kind, TNode array_map, - TNode capacity, TNode length, - TNode allocation_site, - AllocationFlags allocation_flags = kNone) { + TNode AllocateJSArray( + ElementsKind kind, TNode array_map, TNode capacity, + TNode length, base::Optional> allocation_site, + AllocationFlags allocation_flags = kNone); + TNode AllocateJSArray( + ElementsKind kind, TNode array_map, TNode capacity, + TNode length, base::Optional> allocation_site, + AllocationFlags allocation_flags = kNone) { return AllocateJSArray(kind, array_map, SmiUntag(capacity), length, allocation_site, allocation_flags); } TNode AllocateJSArray(ElementsKind kind, TNode array_map, TNode capacity, TNode length, AllocationFlags allocation_flags = kNone) { - return AllocateJSArray(kind, array_map, SmiUntag(capacity), length, {}, - allocation_flags); + return AllocateJSArray(kind, array_map, SmiUntag(capacity), length, + base::nullopt, allocation_flags); } TNode AllocateJSArray(ElementsKind kind, TNode array_map, TNode capacity, TNode length, AllocationFlags allocation_flags = kNone) { - return AllocateJSArray(kind, array_map, capacity, length, {}, + return AllocateJSArray(kind, array_map, capacity, length, base::nullopt, allocation_flags); } // Allocate a JSArray and initialize the header fields. - TNode AllocateJSArray(TNode array_map, - TNode elements, - TNode length, - TNode allocation_site = {}, - int array_header_size = JSArray::kHeaderSize); + TNode AllocateJSArray( + TNode array_map, TNode elements, TNode length, + base::Optional> allocation_site = base::nullopt, + int array_header_size = JSArray::kHeaderSize); enum class HoleConversionMode { kDontConvert, kConvertToUndefined }; // Clone a fast JSArray |array| into a new fast JSArray. @@ -2014,15 +1963,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // function generates significantly less code in this case. TNode CloneFastJSArray( TNode context, TNode array, - TNode allocation_site = {}, + base::Optional> allocation_site = base::nullopt, HoleConversionMode convert_holes = HoleConversionMode::kDontConvert); TNode ExtractFastJSArray(TNode context, - TNode array, Node* begin, - Node* count, - ParameterMode mode = INTPTR_PARAMETERS, - Node* capacity = nullptr, - TNode allocation_site = {}); + TNode array, TNode begin, + TNode count); TNode AllocateFixedArray( ElementsKind kind, Node* capacity, ParameterMode mode = INTPTR_PARAMETERS, @@ -2093,11 +2039,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler Node* capacity, ParameterMode mode = INTPTR_PARAMETERS, AllocationFlags flags = kNone); - // Perform CreateArrayIterator (ES #sec-createarrayiterator). - TNode CreateArrayIterator(TNode context, - TNode object, - IterationKind mode); - // TODO(v8:9722): Return type should be JSIteratorResult TNode AllocateJSIteratorResult(SloppyTNode context, SloppyTNode value, @@ -2234,17 +2175,21 @@ class V8_EXPORT_PRIVATE CodeStubAssembler return UncheckedCast(base); } - TNode HeapObjectToSloppyArgumentsElements( - TNode base, Label* cast_fail) { - GotoIf(TaggedNotEqual(LoadMap(base), SloppyArgumentsElementsMapConstant()), - cast_fail); - return UncheckedCast(base); - } - TNode ConvertElementsKindToInt(TNode elements_kind) { return UncheckedCast(elements_kind); } + template + bool ClassHasMapConstant() { + return false; + } + + template + TNode GetClassMapConstant() { + UNREACHABLE(); + return TNode(); + } + enum class ExtractFixedArrayFlag { kFixedArrays = 1, kFixedDoubleArrays = 2, @@ -2295,20 +2240,32 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode ExtractFixedArray( TNode source, TNode first, TNode count, - TNode capacity, + base::Optional> capacity, ExtractFixedArrayFlags extract_flags = - ExtractFixedArrayFlag::kAllFixedArrays) { - return ExtractFixedArray(source, first, count, capacity, extract_flags, - SMI_PARAMETERS); + ExtractFixedArrayFlag::kAllFixedArrays, + TVariable* var_holes_converted = nullptr, + base::Optional> source_elements_kind = base::nullopt) { + // TODO(solanes): just use capacity when ExtractFixedArray is fully + // converted. + Node* capacity_node = capacity ? static_cast(*capacity) : nullptr; + return ExtractFixedArray(source, first, count, capacity_node, extract_flags, + SMI_PARAMETERS, var_holes_converted, + source_elements_kind); } - TNode ExtractFixedArray( - TNode source, TNode first, TNode count, - TNode capacity, + TNode ExtractFixedArray( + TNode source, TNode first, TNode count, + base::Optional> capacity, ExtractFixedArrayFlags extract_flags = - ExtractFixedArrayFlag::kAllFixedArrays) { - return CAST(ExtractFixedArray(source, first, count, capacity, extract_flags, - INTPTR_PARAMETERS)); + ExtractFixedArrayFlag::kAllFixedArrays, + TVariable* var_holes_converted = nullptr, + base::Optional> source_elements_kind = base::nullopt) { + // TODO(solanes): just use capacity when ExtractFixedArray is fully + // converted. + Node* capacity_node = capacity ? static_cast(*capacity) : nullptr; + return ExtractFixedArray(source, first, count, capacity_node, extract_flags, + INTPTR_PARAMETERS, var_holes_converted, + source_elements_kind); } // Copy a portion of an existing FixedArray or FixedDoubleArray into a new @@ -2400,12 +2357,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // (NOTE: not index!), does a hole check if |if_hole| is provided and // converts the value so that it becomes ready for storing to array of // |to_kind| elements. - Node* LoadElementAndPrepareForStore(Node* array, Node* offset, + Node* LoadElementAndPrepareForStore(TNode array, + TNode offset, ElementsKind from_kind, ElementsKind to_kind, Label* if_hole); - Node* CalculateNewElementsCapacity(Node* old_capacity, - ParameterMode mode = INTPTR_PARAMETERS); + Node* CalculateNewElementsCapacity(Node* old_capacity, ParameterMode mode); TNode CalculateNewElementsCapacity(TNode old_capacity) { return CAST(CalculateNewElementsCapacity(old_capacity, SMI_PARAMETERS)); @@ -2425,11 +2382,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // Tries to grow the |capacity|-length |elements| array of given |object| // to store the |key| or bails out if the growing gap is too big. Returns // new elements. + template TNode TryGrowElementsCapacity(TNode object, TNode elements, - ElementsKind kind, Node* key, - Node* capacity, - ParameterMode mode, + ElementsKind kind, + TNode key, + TNode capacity, Label* bailout); // Grows elements capacity of given object. Returns new elements. @@ -2441,10 +2399,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // Given a need to grow by |growth|, allocate an appropriate new capacity // if necessary, and return a new elements FixedArray object. Label |bailout| // is followed for allocation failure. - void PossiblyGrowElementsCapacity(ParameterMode mode, ElementsKind kind, - TNode array, Node* length, + void PossiblyGrowElementsCapacity(ElementsKind kind, TNode array, + TNode length, TVariable* var_elements, - Node* growth, Label* bailout); + TNode growth, Label* bailout); // Allocation site manipulation void InitializeAllocationMemento(TNode base, @@ -2568,7 +2526,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode InstanceTypeEqual(SloppyTNode instance_type, int type); TNode IsAccessorInfo(SloppyTNode object); TNode IsAccessorPair(SloppyTNode object); - TNode IsAllocationSite(SloppyTNode object); TNode IsNoElementsProtectorCellInvalid(); TNode IsArrayIteratorProtectorCellInvalid(); TNode IsBigIntInstanceType(SloppyTNode instance_type); @@ -2608,7 +2565,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode IsOddball(SloppyTNode object); TNode IsOddballInstanceType(SloppyTNode instance_type); TNode IsIndirectStringInstanceType(SloppyTNode instance_type); - TNode IsJSAggregateError(TNode object); TNode IsJSArrayBuffer(SloppyTNode object); TNode IsJSDataView(TNode object); TNode IsJSArrayInstanceType(SloppyTNode instance_type); @@ -2617,7 +2573,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode IsJSArrayIterator(SloppyTNode object); TNode IsJSAsyncGeneratorObject(SloppyTNode object); TNode IsJSFunctionInstanceType(SloppyTNode instance_type); - TNode IsAllocationSiteInstanceType(SloppyTNode instance_type); TNode IsJSFunctionMap(SloppyTNode map); TNode IsJSFunction(SloppyTNode object); TNode IsJSBoundFunction(SloppyTNode object); @@ -2685,9 +2640,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode IsCustomElementsReceiverInstanceType( TNode instance_type); TNode IsSpecialReceiverMap(SloppyTNode map); - // Returns true if the map corresponds to non-special fast or dictionary - // object. - TNode IsSimpleObjectMap(TNode map); TNode IsStringInstanceType(SloppyTNode instance_type); TNode IsString(SloppyTNode object); TNode IsSymbolInstanceType(SloppyTNode instance_type); @@ -2844,6 +2796,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode ToLength_Inline(SloppyTNode context, SloppyTNode input); + TNode OrdinaryToPrimitive(TNode context, TNode input, + OrdinaryToPrimitiveHint hint); + // Returns a node that contains a decoded (unsigned!) value of a bit // field |BitField| in |word32|. Returns result as an uint32 node. template @@ -3512,24 +3467,24 @@ class V8_EXPORT_PRIVATE CodeStubAssembler enum class ForEachDirection { kForward, kReverse }; - using FastFixedArrayForEachBody = - std::function; + using FastArrayForEachBody = + std::function array, TNode offset)>; - void BuildFastFixedArrayForEach( - const CodeStubAssembler::VariableList& vars, Node* fixed_array, + void BuildFastArrayForEach( + const CodeStubAssembler::VariableList& vars, Node* array, ElementsKind kind, Node* first_element_inclusive, - Node* last_element_exclusive, const FastFixedArrayForEachBody& body, + Node* last_element_exclusive, const FastArrayForEachBody& body, ParameterMode mode = INTPTR_PARAMETERS, ForEachDirection direction = ForEachDirection::kReverse); - void BuildFastFixedArrayForEach( - Node* fixed_array, ElementsKind kind, Node* first_element_inclusive, - Node* last_element_exclusive, const FastFixedArrayForEachBody& body, + void BuildFastArrayForEach( + Node* array, ElementsKind kind, Node* first_element_inclusive, + Node* last_element_exclusive, const FastArrayForEachBody& body, ParameterMode mode = INTPTR_PARAMETERS, ForEachDirection direction = ForEachDirection::kReverse) { CodeStubAssembler::VariableList list(0, zone()); - BuildFastFixedArrayForEach(list, fixed_array, kind, first_element_inclusive, - last_element_exclusive, body, mode, direction); + BuildFastArrayForEach(list, array, kind, first_element_inclusive, + last_element_exclusive, body, mode, direction); } TNode GetArrayAllocationSize(TNode element_count, @@ -3764,6 +3719,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler bool ConstexprInt32NotEqual(int32_t a, int32_t b) { return a != b; } bool ConstexprInt32GreaterThanEqual(int32_t a, int32_t b) { return a >= b; } uint32_t ConstexprUint32Add(uint32_t a, uint32_t b) { return a + b; } + int32_t ConstexprUint32Sub(uint32_t a, uint32_t b) { return a - b; } int31_t ConstexprInt31Add(int31_t a, int31_t b) { int32_t val; CHECK(!base::bits::SignedAddOverflow32(a, b, &val)); @@ -3943,7 +3899,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // fields initialized. TNode AllocateUninitializedJSArray( TNode array_map, TNode length, - TNode allocation_site, TNode size_in_bytes); + base::Optional> allocation_site, + TNode size_in_bytes); TNode IsValidSmi(TNode smi); @@ -4017,49 +3974,24 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ParameterMode parameter_mode = INTPTR_PARAMETERS); }; -// template class V8_EXPORT_PRIVATE CodeStubArguments { public: using Node = compiler::Node; - enum ReceiverMode { kHasReceiver, kNoReceiver }; - - // |argc| specifies the number of arguments passed to the builtin excluding - // the receiver. The arguments will include a receiver iff |receiver_mode| - // is kHasReceiver. - CodeStubArguments(CodeStubAssembler* assembler, TNode argc, - ReceiverMode receiver_mode = ReceiverMode::kHasReceiver) - : CodeStubArguments(assembler, argc, TNode(), receiver_mode) {} - - CodeStubArguments(CodeStubAssembler* assembler, TNode argc, - ReceiverMode receiver_mode = ReceiverMode::kHasReceiver) - : CodeStubArguments(assembler, assembler->ChangeInt32ToIntPtr(argc), - TNode(), receiver_mode) {} - - // TODO(v8:9708): Consider removing this variant - CodeStubArguments(CodeStubAssembler* assembler, TNode argc, - ReceiverMode receiver_mode = ReceiverMode::kHasReceiver) - : CodeStubArguments(assembler, assembler->ParameterToIntPtr(argc), - TNode(), receiver_mode) {} // |argc| specifies the number of arguments passed to the builtin excluding - // the receiver. The arguments will include a receiver iff |receiver_mode| - // is kHasReceiver. + // the receiver. The arguments include the receiver. + CodeStubArguments(CodeStubAssembler* assembler, TNode argc) + : CodeStubArguments(assembler, argc, TNode()) {} + CodeStubArguments(CodeStubAssembler* assembler, TNode argc) + : CodeStubArguments(assembler, assembler->ChangeInt32ToIntPtr(argc)) {} CodeStubArguments(CodeStubAssembler* assembler, TNode argc, - TNode fp, - ReceiverMode receiver_mode = ReceiverMode::kHasReceiver); - - CodeStubArguments(CodeStubAssembler* assembler, TNode argc, - TNode fp, - ReceiverMode receiver_mode = ReceiverMode::kHasReceiver) - : CodeStubArguments(assembler, assembler->ParameterToIntPtr(argc), fp, - receiver_mode) {} + TNode fp); // Used by Torque to construct arguments based on a Torque-defined // struct of values. CodeStubArguments(CodeStubAssembler* assembler, TorqueStructArguments torque_arguments) : assembler_(assembler), - receiver_mode_(ReceiverMode::kHasReceiver), argc_(torque_arguments.length), base_(torque_arguments.base), fp_(torque_arguments.frame) {} @@ -4072,68 +4004,41 @@ class V8_EXPORT_PRIVATE CodeStubArguments { // Computes address of the index'th argument. TNode AtIndexPtr(TNode index) const; - TNode AtIndexPtr(TNode index) const { - return AtIndexPtr(assembler_->ParameterToIntPtr(index)); - } // |index| is zero-based and does not include the receiver TNode AtIndex(TNode index) const; - // TODO(v8:9708): Consider removing this variant - TNode AtIndex(TNode index) const { - return AtIndex(assembler_->ParameterToIntPtr(index)); - } - TNode AtIndex(int index) const; - TNode GetOptionalArgumentValue(int index) { - return GetOptionalArgumentValue(index, assembler_->UndefinedConstant()); - } - TNode GetOptionalArgumentValue(int index, - TNode default_value); - TNode GetLength() const { return argc_; } TorqueStructArguments GetTorqueArguments() const { return TorqueStructArguments{fp_, base_, argc_}; } + TNode GetOptionalArgumentValue(TNode index, + TNode default_value); TNode GetOptionalArgumentValue(TNode index) { return GetOptionalArgumentValue(index, assembler_->UndefinedConstant()); } - TNode GetOptionalArgumentValue(TNode index, - TNode default_value); - - using ForEachBodyFunction = std::function arg)>; + TNode GetOptionalArgumentValue(int index) { + return GetOptionalArgumentValue(assembler_->IntPtrConstant(index)); + } // Iteration doesn't include the receiver. |first| and |last| are zero-based. - template - void ForEach(const ForEachBodyFunction& body, TNode first = {}, - TNode last = {}) const { + using ForEachBodyFunction = std::function arg)>; + void ForEach(const ForEachBodyFunction& body, TNode first = {}, + TNode last = {}) const { CodeStubAssembler::VariableList list(0, assembler_->zone()); ForEach(list, body, first, last); } - - // Iteration doesn't include the receiver. |first| and |last| are zero-based. void ForEach(const CodeStubAssembler::VariableList& vars, const ForEachBodyFunction& body, TNode first = {}, TNode last = {}) const; - void ForEach(const CodeStubAssembler::VariableList& vars, - const ForEachBodyFunction& body, TNode first, - TNode last = {}) const { - TNode first_intptr = assembler_->ParameterToIntPtr(first); - TNode last_intptr; - if (last != nullptr) { - last_intptr = assembler_->ParameterToIntPtr(last); - } - return ForEach(vars, body, first_intptr, last_intptr); - } - void PopAndReturn(TNode value); private: CodeStubAssembler* assembler_; - ReceiverMode receiver_mode_; TNode argc_; TNode base_; TNode fp_; @@ -4226,6 +4131,19 @@ class PrototypeCheckAssembler : public CodeStubAssembler { DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags) +#define CLASS_MAP_CONSTANT_ADAPTER(V, rootIndexName, rootAccessorName, \ + class_name) \ + template <> \ + inline bool CodeStubAssembler::ClassHasMapConstant() { \ + return true; \ + } \ + template <> \ + inline TNode CodeStubAssembler::GetClassMapConstant() { \ + return class_name##MapConstant(); \ + } + +UNIQUE_INSTANCE_TYPE_MAP_LIST_GENERATOR(CLASS_MAP_CONSTANT_ADAPTER, _) + } // namespace internal } // namespace v8 #endif // V8_CODEGEN_CODE_STUB_ASSEMBLER_H_ -- cgit v1.2.1