[csa] Make argc parameter to CodeStubArguments constructor use ParameterMode
Review-Url: https://codereview.chromium.org/2661483002 Cr-Commit-Position: refs/heads/master@{#42733}
This commit is contained in:
parent
dbbd2da128
commit
7046c14d35
@ -201,7 +201,7 @@ void Builtins::Generate_FastArrayPush(compiler::CodeAssemblerState* state) {
|
||||
Node* context = assembler.Parameter(BuiltinDescriptor::kContext);
|
||||
Node* new_target = assembler.Parameter(BuiltinDescriptor::kNewTarget);
|
||||
|
||||
CodeStubArguments args(&assembler, argc);
|
||||
CodeStubArguments args(&assembler, assembler.ChangeInt32ToIntPtr(argc));
|
||||
Node* receiver = args.GetReceiver();
|
||||
Node* kind = nullptr;
|
||||
|
||||
|
@ -267,7 +267,7 @@ void Builtins::Generate_FastFunctionPrototypeBind(
|
||||
Node* context = assembler.Parameter(BuiltinDescriptor::kContext);
|
||||
Node* new_target = assembler.Parameter(BuiltinDescriptor::kNewTarget);
|
||||
|
||||
CodeStubArguments args(&assembler, argc);
|
||||
CodeStubArguments args(&assembler, assembler.ChangeInt32ToIntPtr(argc));
|
||||
|
||||
// Check that receiver has instance type of JS_FUNCTION_TYPE
|
||||
Node* receiver = args.GetReceiver();
|
||||
|
@ -420,7 +420,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
|
||||
Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount);
|
||||
Node* context = Parameter(BuiltinDescriptor::kContext);
|
||||
|
||||
CodeStubArguments arguments(this, argc);
|
||||
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc));
|
||||
// From now on use word-size argc value.
|
||||
argc = arguments.GetLength();
|
||||
|
||||
@ -886,7 +886,7 @@ TF_BUILTIN(StringPrototypeIndexOf, StringBuiltinsAssembler) {
|
||||
Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount);
|
||||
Node* context = Parameter(BuiltinDescriptor::kContext);
|
||||
|
||||
CodeStubArguments arguments(this, argc);
|
||||
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc));
|
||||
Node* receiver = arguments.GetReceiver();
|
||||
// From now on use word-size argc value.
|
||||
argc = arguments.GetLength();
|
||||
|
@ -8212,14 +8212,16 @@ Node* CodeStubAssembler::IsDetachedBuffer(Node* buffer) {
|
||||
return IsSetWord32<JSArrayBuffer::WasNeutered>(buffer_bit_field);
|
||||
}
|
||||
|
||||
CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, Node* argc)
|
||||
CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, Node* argc,
|
||||
Node* fp,
|
||||
CodeStubAssembler::ParameterMode mode)
|
||||
: assembler_(assembler),
|
||||
argc_mode_(mode),
|
||||
argc_(argc),
|
||||
arguments_(nullptr),
|
||||
fp_(assembler->LoadFramePointer()) {
|
||||
argc_ = assembler->ChangeUint32ToWord(argc_);
|
||||
fp_(fp != nullptr ? fp : assembler->LoadFramePointer()) {
|
||||
Node* offset = assembler->ElementOffsetFromIndex(
|
||||
argc_, FAST_ELEMENTS, CodeStubAssembler::INTPTR_PARAMETERS,
|
||||
argc_, FAST_ELEMENTS, mode,
|
||||
(StandardFrameConstants::kFixedSlotCountAboveFp - 1) * kPointerSize);
|
||||
arguments_ = assembler_->IntPtrAdd(fp_, offset);
|
||||
}
|
||||
@ -8229,19 +8231,22 @@ Node* CodeStubArguments::GetReceiver() const {
|
||||
assembler_->IntPtrConstant(kPointerSize));
|
||||
}
|
||||
|
||||
Node* CodeStubArguments::AtIndex(Node* index,
|
||||
CodeStubAssembler::ParameterMode mode) const {
|
||||
Node* CodeStubArguments::AtIndexPtr(
|
||||
Node* index, CodeStubAssembler::ParameterMode mode) const {
|
||||
typedef compiler::Node Node;
|
||||
CSA_ASSERT(assembler_, assembler_->UintPtrLessThan(
|
||||
mode == CodeStubAssembler::INTPTR_PARAMETERS
|
||||
? index
|
||||
: assembler_->SmiUntag(index),
|
||||
GetLength()));
|
||||
Node* negated_index =
|
||||
assembler_->IntPtrSub(assembler_->IntPtrOrSmiConstant(0, mode), index);
|
||||
Node* negated_index = assembler_->IntPtrOrSmiSub(
|
||||
assembler_->IntPtrOrSmiConstant(0, mode), index, mode);
|
||||
Node* offset =
|
||||
assembler_->ElementOffsetFromIndex(negated_index, FAST_ELEMENTS, mode, 0);
|
||||
return assembler_->Load(MachineType::AnyTagged(), arguments_, offset);
|
||||
return assembler_->IntPtrAdd(arguments_, offset);
|
||||
}
|
||||
|
||||
Node* CodeStubArguments::AtIndex(Node* index,
|
||||
CodeStubAssembler::ParameterMode mode) const {
|
||||
DCHECK_EQ(argc_mode_, mode);
|
||||
CSA_ASSERT(assembler_,
|
||||
assembler_->UintPtrOrSmiLessThan(index, GetLength(), mode));
|
||||
return assembler_->Load(MachineType::AnyTagged(), AtIndexPtr(index, mode));
|
||||
}
|
||||
|
||||
Node* CodeStubArguments::AtIndex(int index) const {
|
||||
@ -8253,12 +8258,11 @@ void CodeStubArguments::ForEach(
|
||||
const CodeStubArguments::ForEachBodyFunction& body, Node* first, Node* last,
|
||||
CodeStubAssembler::ParameterMode mode) {
|
||||
assembler_->Comment("CodeStubArguments::ForEach");
|
||||
DCHECK_IMPLIES(first == nullptr || last == nullptr,
|
||||
mode == CodeStubAssembler::INTPTR_PARAMETERS);
|
||||
if (first == nullptr) {
|
||||
first = assembler_->IntPtrOrSmiConstant(0, mode);
|
||||
}
|
||||
if (last == nullptr) {
|
||||
DCHECK_EQ(mode, argc_mode_);
|
||||
last = argc_;
|
||||
}
|
||||
Node* start = assembler_->IntPtrSub(
|
||||
|
@ -1228,10 +1228,17 @@ class CodeStubArguments {
|
||||
|
||||
// |argc| is an uint32 value which specifies the number of arguments passed
|
||||
// to the builtin excluding the receiver.
|
||||
CodeStubArguments(CodeStubAssembler* assembler, Node* argc);
|
||||
CodeStubArguments(CodeStubAssembler* assembler, Node* argc)
|
||||
: CodeStubArguments(assembler, argc, nullptr,
|
||||
CodeStubAssembler::INTPTR_PARAMETERS) {}
|
||||
CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp,
|
||||
CodeStubAssembler::ParameterMode param_mode);
|
||||
|
||||
Node* GetReceiver() const;
|
||||
|
||||
Node* AtIndexPtr(Node* index, CodeStubAssembler::ParameterMode mode =
|
||||
CodeStubAssembler::INTPTR_PARAMETERS) const;
|
||||
|
||||
// |index| is zero-based and does not include the receiver
|
||||
Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode =
|
||||
CodeStubAssembler::INTPTR_PARAMETERS) const;
|
||||
@ -1262,6 +1269,7 @@ class CodeStubArguments {
|
||||
Node* GetArguments();
|
||||
|
||||
CodeStubAssembler* assembler_;
|
||||
CodeStubAssembler::ParameterMode argc_mode_;
|
||||
Node* argc_;
|
||||
Node* arguments_;
|
||||
Node* fp_;
|
||||
|
@ -1506,7 +1506,7 @@ TEST(Arguments) {
|
||||
CodeAssemblerTester data(isolate, kNumParams);
|
||||
CodeStubAssembler m(data.state());
|
||||
|
||||
CodeStubArguments arguments(&m, m.Int32Constant(3));
|
||||
CodeStubArguments arguments(&m, m.IntPtrConstant(3));
|
||||
|
||||
CSA_ASSERT(
|
||||
&m, m.WordEqual(arguments.AtIndex(0), m.SmiConstant(Smi::FromInt(12))));
|
||||
@ -1536,7 +1536,7 @@ TEST(ArgumentsForEach) {
|
||||
CodeAssemblerTester data(isolate, kNumParams);
|
||||
CodeStubAssembler m(data.state());
|
||||
|
||||
CodeStubArguments arguments(&m, m.Int32Constant(3));
|
||||
CodeStubArguments arguments(&m, m.IntPtrConstant(3));
|
||||
|
||||
CodeAssemblerVariable sum(&m, MachineRepresentation::kTagged);
|
||||
CodeAssemblerVariableList list({&sum}, m.zone());
|
||||
@ -1616,7 +1616,7 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler {
|
||||
JSObject::SetElement(isolate, array, 1,
|
||||
Handle<Smi>(Smi::FromInt(2), isolate), SLOPPY)
|
||||
.Check();
|
||||
CodeStubArguments args(this, Int32Constant(kNumParams));
|
||||
CodeStubArguments args(this, IntPtrConstant(kNumParams));
|
||||
Variable arg_index(this, MachineType::PointerRepresentation());
|
||||
Label bailout(this);
|
||||
arg_index.Bind(IntPtrConstant(0));
|
||||
|
Loading…
Reference in New Issue
Block a user