Commit 23792eca authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[tests] Fix parameter indices in test-code-generator and test-torque

This is exactly the same issue as in https://crrev.com/c/2299364 for test-torque.cc

Change-Id: I066d93918c94d0c68278c72d9b60ec92a1c5f68b
Bug: v8:10201
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2300546
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68897}
parent de5dcb79
...@@ -77,11 +77,12 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate, ...@@ -77,11 +77,12 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate,
Handle<Code> BuildSetupFunction(Isolate* isolate, Handle<Code> BuildSetupFunction(Isolate* isolate,
CallDescriptor* call_descriptor, CallDescriptor* call_descriptor,
std::vector<AllocatedOperand> parameters) { std::vector<AllocatedOperand> parameters) {
CodeAssemblerTester tester(isolate, 2, Code::BUILTIN, "setup"); CodeAssemblerTester tester(isolate, 3, Code::BUILTIN,
"setup"); // Include receiver.
CodeStubAssembler assembler(tester.state()); CodeStubAssembler assembler(tester.state());
std::vector<Node*> params; std::vector<Node*> params;
// The first parameter is always the callee. // The first parameter is always the callee.
params.push_back(__ Parameter(0)); params.push_back(__ Parameter(1));
params.push_back(__ HeapConstant( params.push_back(__ HeapConstant(
BuildTeardownFunction(isolate, call_descriptor, parameters))); BuildTeardownFunction(isolate, call_descriptor, parameters)));
// First allocate the FixedArray which will hold the final results. Here we // First allocate the FixedArray which will hold the final results. Here we
...@@ -113,7 +114,7 @@ Handle<Code> BuildSetupFunction(Isolate* isolate, ...@@ -113,7 +114,7 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
} }
params.push_back(state_out); params.push_back(state_out);
// Then take each element of the initial state and pass them as arguments. // Then take each element of the initial state and pass them as arguments.
TNode<FixedArray> state_in = __ Cast(__ Parameter(1)); TNode<FixedArray> state_in = __ Cast(__ Parameter(2));
for (int i = 0; i < static_cast<int>(parameters.size()); i++) { for (int i = 0; i < static_cast<int>(parameters.size()); i++) {
Node* element = __ LoadFixedArrayElement(state_in, __ IntPtrConstant(i)); Node* element = __ LoadFixedArrayElement(state_in, __ IntPtrConstant(i));
// Unbox all elements before passing them as arguments. // Unbox all elements before passing them as arguments.
......
...@@ -148,10 +148,10 @@ TEST(TestFunctionPointers) { ...@@ -148,10 +148,10 @@ TEST(TestFunctionPointers) {
TEST(TestTernaryOperator) { TEST(TestTernaryOperator) {
Isolate* isolate(CcTest::InitIsolateOnce()); Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1; const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams); CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
TestTorqueAssembler m(asm_tester.state()); TestTorqueAssembler m(asm_tester.state());
{ {
TNode<Smi> arg = m.UncheckedCast<Smi>(m.Parameter(0)); TNode<Smi> arg = m.UncheckedCast<Smi>(m.Parameter(1));
m.Return(m.TestTernaryOperator(arg)); m.Return(m.TestTernaryOperator(arg));
} }
FunctionTester ft(asm_tester.GenerateCode(), kNumParams); FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
...@@ -633,20 +633,20 @@ TEST(TestBitFieldLoad) { ...@@ -633,20 +633,20 @@ TEST(TestBitFieldLoad) {
Isolate* isolate(CcTest::i_isolate()); Isolate* isolate(CcTest::i_isolate());
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
const int kNumParams = 5; const int kNumParams = 5;
CodeAssemblerTester asm_tester(isolate, kNumParams); CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
TestTorqueAssembler m(asm_tester.state()); TestTorqueAssembler m(asm_tester.state());
{ {
// Untag all of the parameters to get plain integer values. // Untag all of the parameters to get plain integer values.
TNode<Uint8T> val = TNode<Uint8T> val =
m.UncheckedCast<Uint8T>(m.Unsigned(m.SmiToInt32(m.Parameter(0)))); m.UncheckedCast<Uint8T>(m.Unsigned(m.SmiToInt32(m.Parameter(1))));
TNode<BoolT> expected_a = TNode<BoolT> expected_a =
m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(1)))); m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(2))));
TNode<Uint16T> expected_b = TNode<Uint16T> expected_b =
m.UncheckedCast<Uint16T>(m.Unsigned(m.SmiToInt32(m.Parameter(2)))); m.UncheckedCast<Uint16T>(m.Unsigned(m.SmiToInt32(m.Parameter(3))));
TNode<Uint32T> expected_c = TNode<Uint32T> expected_c =
m.UncheckedCast<Uint32T>(m.Unsigned(m.SmiToInt32(m.Parameter(3)))); m.UncheckedCast<Uint32T>(m.Unsigned(m.SmiToInt32(m.Parameter(4))));
TNode<BoolT> expected_d = TNode<BoolT> expected_d =
m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(4)))); m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(5))));
// Call the Torque-defined macro, which verifies that reading each bitfield // Call the Torque-defined macro, which verifies that reading each bitfield
// out of val yields the correct result. // out of val yields the correct result.
...@@ -696,18 +696,18 @@ TEST(TestBitFieldInit) { ...@@ -696,18 +696,18 @@ TEST(TestBitFieldInit) {
Isolate* isolate(CcTest::i_isolate()); Isolate* isolate(CcTest::i_isolate());
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
const int kNumParams = 4; const int kNumParams = 4;
CodeAssemblerTester asm_tester(isolate, kNumParams); CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
TestTorqueAssembler m(asm_tester.state()); TestTorqueAssembler m(asm_tester.state());
{ {
// Untag all of the parameters to get plain integer values. // Untag all of the parameters to get plain integer values.
TNode<BoolT> a = TNode<BoolT> a =
m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(0)))); m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(1))));
TNode<Uint16T> b = TNode<Uint16T> b =
m.UncheckedCast<Uint16T>(m.Unsigned(m.SmiToInt32(m.Parameter(1)))); m.UncheckedCast<Uint16T>(m.Unsigned(m.SmiToInt32(m.Parameter(2))));
TNode<Uint32T> c = TNode<Uint32T> c =
m.UncheckedCast<Uint32T>(m.Unsigned(m.SmiToInt32(m.Parameter(2)))); m.UncheckedCast<Uint32T>(m.Unsigned(m.SmiToInt32(m.Parameter(3))));
TNode<BoolT> d = TNode<BoolT> d =
m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(3)))); m.UncheckedCast<BoolT>(m.Unsigned(m.SmiToInt32(m.Parameter(4))));
// Call the Torque-defined macro, which verifies that reading each bitfield // Call the Torque-defined macro, which verifies that reading each bitfield
// out of val yields the correct result. // out of val yields the correct result.
...@@ -733,14 +733,14 @@ TEST(TestBitFieldUintptrOps) { ...@@ -733,14 +733,14 @@ TEST(TestBitFieldUintptrOps) {
Isolate* isolate(CcTest::i_isolate()); Isolate* isolate(CcTest::i_isolate());
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
const int kNumParams = 2; const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams); CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
TestTorqueAssembler m(asm_tester.state()); TestTorqueAssembler m(asm_tester.state());
{ {
// Untag the parameters to get a plain integer value. // Untag the parameters to get a plain integer value.
TNode<Uint32T> val2 = TNode<Uint32T> val2 =
m.UncheckedCast<Uint32T>(m.Unsigned(m.SmiToInt32(m.Parameter(0)))); m.UncheckedCast<Uint32T>(m.Unsigned(m.SmiToInt32(m.Parameter(1))));
TNode<UintPtrT> val3 = m.UncheckedCast<UintPtrT>( TNode<UintPtrT> val3 = m.UncheckedCast<UintPtrT>(
m.ChangeUint32ToWord(m.Unsigned(m.SmiToInt32(m.Parameter(1))))); m.ChangeUint32ToWord(m.Unsigned(m.SmiToInt32(m.Parameter(2)))));
m.TestBitFieldUintptrOps(val2, val3); m.TestBitFieldUintptrOps(val2, val3);
m.Return(m.UndefinedConstant()); m.Return(m.UndefinedConstant());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment