[CSA] remove typing for ParameterMode-dependant CodeStubArguments

The types of the arguments length was wrong because it didn't include
the case of SMI_PARAMETERS. Fixing this by reverting to untyped nodes.

Bug: 
Change-Id: Iebc2f1f4530f4f04418a0e200b7bb46938cb456f
Reviewed-on: https://chromium-review.googlesource.com/856981
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50466}
This commit is contained in:
Tobias Tebbi 2018-01-09 14:28:50 +01:00 committed by Commit Bot
parent 6955512d6d
commit cbb2801977
4 changed files with 18 additions and 11 deletions

View File

@ -161,7 +161,7 @@ void MathBuiltinsAssembler::MathMaxMin(
SloppyTNode<Float64T>),
double default_val) {
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc));
argc = arguments.GetLength();
argc = arguments.GetLength(INTPTR_PARAMETERS);
VARIABLE(result, MachineRepresentation::kFloat64);
result.Bind(Float64Constant(default_val));

View File

@ -563,7 +563,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
Node* context = Parameter(BuiltinDescriptor::kContext);
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc));
TNode<Smi> smi_argc = SmiTag(arguments.GetLength());
TNode<Smi> smi_argc = SmiTag(arguments.GetLength(INTPTR_PARAMETERS));
// Check if we have exactly one argument (plus the implicit receiver), i.e.
// if the parent frame is not an arguments adaptor frame.
Label if_oneargument(this), if_notoneargument(this);
@ -1003,7 +1003,7 @@ void StringIncludesIndexOfAssembler::Generate(SearchVariant variant) {
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc));
Node* const receiver = arguments.GetReceiver();
// From now on use word-size argc value.
argc = arguments.GetLength();
argc = arguments.GetLength(INTPTR_PARAMETERS);
VARIABLE(var_search_string, MachineRepresentation::kTagged);
VARIABLE(var_position, MachineRepresentation::kTagged);

View File

@ -1996,7 +1996,10 @@ TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind,
// Resize the capacity of the fixed array if it doesn't fit.
TNode<IntPtrT> first = *arg_index;
Node* growth = WordToParameter(IntPtrSub(args->GetLength(), first), mode);
Node* growth = WordToParameter(
IntPtrSub(UncheckedCast<IntPtrT>(args->GetLength(INTPTR_PARAMETERS)),
first),
mode);
PossiblyGrowElementsCapacity(mode, kind, array, var_length.value(),
&var_elements, growth, &pre_bailout);
@ -10361,7 +10364,7 @@ Node* CodeStubAssembler::IsDetachedBuffer(Node* buffer) {
}
CodeStubArguments::CodeStubArguments(
CodeStubAssembler* assembler, SloppyTNode<IntPtrT> argc, Node* fp,
CodeStubAssembler* assembler, Node* argc, Node* fp,
CodeStubAssembler::ParameterMode param_mode, ReceiverMode receiver_mode)
: assembler_(assembler),
argc_mode_(param_mode),
@ -10398,7 +10401,7 @@ TNode<Object> CodeStubArguments::AtIndex(
Node* index, CodeStubAssembler::ParameterMode mode) const {
DCHECK_EQ(argc_mode_, mode);
CSA_ASSERT(assembler_,
assembler_->UintPtrOrSmiLessThan(index, GetLength(), mode));
assembler_->UintPtrOrSmiLessThan(index, GetLength(mode), mode));
return assembler_->UncheckedCast<Object>(
assembler_->Load(MachineType::AnyTagged(), AtIndexPtr(index, mode)));
}

View File

@ -1990,15 +1990,16 @@ class CodeStubArguments {
// |argc| is an intptr value which 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, SloppyTNode<IntPtrT> argc,
CodeStubArguments(CodeStubAssembler* assembler, Node* argc,
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
: CodeStubArguments(assembler, argc, nullptr,
CodeStubAssembler::INTPTR_PARAMETERS, receiver_mode) {
}
// |argc| is either a smi or intptr depending on |param_mode|. The arguments
// include a receiver iff |receiver_mode| is kHasReceiver.
CodeStubArguments(CodeStubAssembler* assembler, SloppyTNode<IntPtrT> argc,
Node* fp, CodeStubAssembler::ParameterMode param_mode,
CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp,
CodeStubAssembler::ParameterMode param_mode,
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver);
TNode<Object> GetReceiver() const;
@ -2020,7 +2021,10 @@ class CodeStubArguments {
TNode<Object> GetOptionalArgumentValue(int index,
SloppyTNode<Object> default_value);
TNode<IntPtrT> GetLength() const { return argc_; }
Node* GetLength(CodeStubAssembler::ParameterMode mode) const {
DCHECK_EQ(mode, argc_mode_);
return argc_;
}
typedef std::function<void(Node* arg)> ForEachBodyFunction;
@ -2046,7 +2050,7 @@ class CodeStubArguments {
CodeStubAssembler* assembler_;
CodeStubAssembler::ParameterMode argc_mode_;
ReceiverMode receiver_mode_;
TNode<IntPtrT> argc_;
Node* argc_;
TNode<RawPtr<Object>> arguments_;
Node* fp_;
};