[tests] Fix parameter indices in test-code-stub-assembler

The cctests were wrong, since they access the first parameter using `Parameter(0)`. They should instead use `Parameter(1)`, since the index 0 is the receiver, and the receiver is set to be always the undefined object in `FunctionTester::Call`.

The reason it used to work is that the tests would set up an access to the stack with the wrong number of parameters, accessing only a stack suffix.

Change-Id: I02b7ee97c8759c7aecda0338863b7727762df1ba
Bug: v8:10201
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2299364
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68876}
This commit is contained in:
Victor Gomes 2020-07-15 13:03:22 +02:00 committed by Commit Bot
parent cd718536ec
commit ebcc39d59a
3 changed files with 179 additions and 175 deletions

View File

@ -147,11 +147,12 @@ Handle<JSFunction> CreateSumAllArgumentsFunction(FunctionTester* ft) {
TEST(SimpleCallJSFunction0Arg) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kContextOffset = kNumParams + 3;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeAssembler m(asm_tester.state());
{
Node* function = m.Parameter(0);
Node* context = m.Parameter(kNumParams + 2);
Node* function = m.Parameter(1);
Node* context = m.Parameter(kContextOffset);
Node* receiver = SmiTag(&m, m.Int32Constant(42));
@ -168,12 +169,13 @@ TEST(SimpleCallJSFunction0Arg) {
TEST(SimpleCallJSFunction1Arg) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 1;
const int kContextOffset = kNumParams + 3;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeAssembler m(asm_tester.state());
{
Node* function = m.Parameter(0);
Node* context = m.Parameter(1);
Node* function = m.Parameter(1);
Node* context = m.Parameter(kContextOffset);
Node* receiver = SmiTag(&m, m.Int32Constant(42));
Node* a = SmiTag(&m, m.Int32Constant(13));
@ -192,11 +194,12 @@ TEST(SimpleCallJSFunction1Arg) {
TEST(SimpleCallJSFunction2Arg) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kContextOffset = kNumParams + 3;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeAssembler m(asm_tester.state());
{
Node* function = m.Parameter(0);
Node* context = m.Parameter(1);
Node* function = m.Parameter(1);
Node* context = m.Parameter(kContextOffset);
Node* receiver = SmiTag(&m, m.Int32Constant(42));
Node* a = SmiTag(&m, m.Int32Constant(13));

View File

@ -24,12 +24,12 @@ namespace {
void TestStubCacheOffsetCalculation(StubCache::Table table) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester data(isolate, kNumParams);
CodeAssemblerTester data(isolate, kNumParams + 1); // Include receiver.
AccessorAssembler m(data.state());
{
TNode<Name> name = m.CAST(m.Parameter(0));
TNode<Map> map = m.CAST(m.Parameter(1));
TNode<Name> name = m.CAST(m.Parameter(1));
TNode<Map> map = m.CAST(m.Parameter(2));
TNode<IntPtrT> primary_offset =
m.StubCachePrimaryOffsetForTesting(name, map);
Node* result;
@ -121,17 +121,17 @@ TEST(TryProbeStubCache) {
using Label = CodeStubAssembler::Label;
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3;
CodeAssemblerTester data(isolate, kNumParams);
CodeAssemblerTester data(isolate, kNumParams + 1); // Include receiver.
AccessorAssembler m(data.state());
StubCache stub_cache(isolate);
stub_cache.Clear();
{
TNode<Object> receiver = m.CAST(m.Parameter(0));
TNode<Name> name = m.CAST(m.Parameter(1));
TNode<Object> receiver = m.CAST(m.Parameter(1));
TNode<Name> name = m.CAST(m.Parameter(2));
TNode<MaybeObject> expected_handler =
m.UncheckedCast<MaybeObject>(m.Parameter(2));
m.UncheckedCast<MaybeObject>(m.Parameter(3));
Label passed(&m), failed(&m);

View File

@ -116,11 +116,11 @@ TEST(NumberToString) {
Factory* factory = isolate->factory();
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
{
TNode<Number> input = m.CAST(m.Parameter(0));
TNode<Number> input = m.CAST(m.Parameter(1));
Label bailout(&m);
m.Return(m.NumberToString(input, &bailout));
@ -196,12 +196,12 @@ TEST(ToUint32) {
Factory* factory = isolate->factory();
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
const int kContextOffset = 2;
const int kContextOffset = 3;
Node* const context = m.Parameter(kNumParams + kContextOffset);
Node* const input = m.Parameter(0);
Node* const input = m.Parameter(1);
m.Return(m.ToUint32(context, input));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -317,14 +317,14 @@ TEST(ConvertToRelativeIndex) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
enum Result { kFound, kNotFound };
{
TNode<Number> index = m.CAST(m.Parameter(0));
TNode<Number> length_number = m.CAST(m.Parameter(1));
TNode<Number> expected_relative_index = m.CAST(m.Parameter(2));
TNode<Number> index = m.CAST(m.Parameter(1));
TNode<Number> length_number = m.CAST(m.Parameter(2));
TNode<Number> expected_relative_index = m.CAST(m.Parameter(3));
TNode<UintPtrT> length = m.ChangeUintPtrNumberToUintPtr(length_number);
TNode<UintPtrT> expected =
@ -465,17 +465,16 @@ TEST(DecodeWordFromWord32) {
}
TEST(JSFunction) {
const int kNumParams = 3; // Receiver, left, right.
const int kNumParams = 2; // left, right.
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
m.Return(m.SmiFromInt32(
m.Int32Add(m.SmiToInt32(m.Parameter(1)), m.SmiToInt32(m.Parameter(2)))));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
MaybeHandle<Object> result = ft.Call(isolate->factory()->undefined_value(),
handle(Smi::FromInt(23), isolate),
MaybeHandle<Object> result = ft.Call(handle(Smi::FromInt(23), isolate),
handle(Smi::FromInt(34), isolate));
CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value());
}
@ -483,11 +482,11 @@ TEST(JSFunction) {
TEST(ComputeIntegerHash) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
m.Return(m.SmiFromInt32(m.UncheckedCast<Int32T>(
m.ComputeSeededHash(m.SmiUntag(m.Parameter(0))))));
m.ComputeSeededHash(m.SmiUntag(m.Parameter(1))))));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -508,10 +507,10 @@ TEST(ComputeIntegerHash) {
TEST(ToString) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
m.Return(m.ToStringImpl(m.CAST(m.Parameter(kNumParams + 2)),
m.CAST(m.Parameter(0))));
m.Return(m.ToStringImpl(m.CAST(m.Parameter(kNumParams + 3)),
m.CAST(m.Parameter(1))));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -567,15 +566,15 @@ TEST(TryToName) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
enum Result { kKeyIsIndex, kKeyIsUnique, kBailout };
{
Node* key = m.Parameter(0);
Node* key = m.Parameter(1);
TNode<MaybeObject> expected_result =
m.UncheckedCast<MaybeObject>(m.Parameter(1));
TNode<Object> expected_arg = m.CAST(m.Parameter(2));
m.UncheckedCast<MaybeObject>(m.Parameter(2));
TNode<Object> expected_arg = m.CAST(m.Parameter(3));
Label passed(&m), failed(&m);
Label if_keyisindex(&m), if_keyisunique(&m), if_bailout(&m);
@ -791,10 +790,10 @@ void TestEntryToIndex() {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
{
TNode<IntPtrT> entry = m.SmiUntag(m.Parameter(0));
TNode<IntPtrT> entry = m.SmiUntag(m.Parameter(1));
TNode<IntPtrT> result = m.EntryToIndex<Dictionary>(entry);
m.Return(m.SmiTag(result));
}
@ -823,15 +822,15 @@ void TestNameDictionaryLookup() {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 4;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
enum Result { kFound, kNotFound };
{
TNode<Dictionary> dictionary = m.CAST(m.Parameter(0));
TNode<Name> unique_name = m.CAST(m.Parameter(1));
TNode<Smi> expected_result = m.CAST(m.Parameter(2));
TNode<Object> expected_arg = m.CAST(m.Parameter(3));
TNode<Dictionary> dictionary = m.CAST(m.Parameter(1));
TNode<Name> unique_name = m.CAST(m.Parameter(2));
TNode<Smi> expected_result = m.CAST(m.Parameter(3));
TNode<Object> expected_arg = m.CAST(m.Parameter(4));
Label passed(&m), failed(&m);
Label if_found(&m), if_not_found(&m);
@ -926,15 +925,15 @@ TEST(NumberDictionaryLookup) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 4;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
enum Result { kFound, kNotFound };
{
TNode<NumberDictionary> dictionary = m.CAST(m.Parameter(0));
TNode<IntPtrT> key = m.SmiUntag(m.Parameter(1));
TNode<Smi> expected_result = m.CAST(m.Parameter(2));
TNode<Object> expected_arg = m.CAST(m.Parameter(3));
TNode<NumberDictionary> dictionary = m.CAST(m.Parameter(1));
TNode<IntPtrT> key = m.SmiUntag(m.Parameter(2));
TNode<Smi> expected_result = m.CAST(m.Parameter(3));
TNode<Object> expected_arg = m.CAST(m.Parameter(4));
Label passed(&m), failed(&m);
Label if_found(&m), if_not_found(&m);
@ -1011,7 +1010,7 @@ TEST(TransitionLookup) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 4;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
enum Result { kFound, kNotFound };
@ -1021,10 +1020,10 @@ TEST(TransitionLookup) {
: CodeStubAssembler(state) {}
void Generate() {
TNode<TransitionArray> transitions = CAST(Parameter(0));
TNode<Name> name = CAST(Parameter(1));
TNode<Smi> expected_result = CAST(Parameter(2));
TNode<Object> expected_arg = CAST(Parameter(3));
TNode<TransitionArray> transitions = CAST(Parameter(1));
TNode<Name> name = CAST(Parameter(2));
TNode<Smi> expected_result = CAST(Parameter(3));
TNode<Object> expected_arg = CAST(Parameter(4));
Label passed(this), failed(this);
Label if_found(this), if_not_found(this);
@ -1189,16 +1188,16 @@ void AddProperties(Handle<JSObject> object, Handle<Name> names[],
TEST(TryHasOwnProperty) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 4;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
enum Result { kFound, kNotFound, kBailout };
{
TNode<HeapObject> object = m.CAST(m.Parameter(0));
TNode<Name> unique_name = m.CAST(m.Parameter(1));
TNode<HeapObject> object = m.CAST(m.Parameter(1));
TNode<Name> unique_name = m.CAST(m.Parameter(2));
TNode<MaybeObject> expected_result =
m.UncheckedCast<MaybeObject>(m.Parameter(2));
m.UncheckedCast<MaybeObject>(m.Parameter(3));
Label passed(&m), failed(&m);
Label if_found(&m), if_not_found(&m), if_bailout(&m);
@ -1383,15 +1382,15 @@ TEST(TryGetOwnProperty) {
Factory* factory = isolate->factory();
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
Handle<Symbol> not_found_symbol = factory->NewSymbol();
Handle<Symbol> bailout_symbol = factory->NewSymbol();
{
TNode<JSReceiver> object = m.CAST(m.Parameter(0));
TNode<Name> unique_name = m.CAST(m.Parameter(1));
TNode<Context> context = m.CAST(m.Parameter(kNumParams + 2));
TNode<JSReceiver> object = m.CAST(m.Parameter(1));
TNode<Name> unique_name = m.CAST(m.Parameter(2));
TNode<Context> context = m.CAST(m.Parameter(kNumParams + 3));
TVariable<Object> var_value(&m);
Label if_found(&m), if_not_found(&m), if_bailout(&m);
@ -1604,15 +1603,15 @@ TEST(TryLookupElement) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
enum Result { kFound, kAbsent, kNotFound, kBailout };
{
TNode<HeapObject> object = m.CAST(m.Parameter(0));
TNode<IntPtrT> index = m.SmiUntag(m.Parameter(1));
TNode<HeapObject> object = m.CAST(m.Parameter(1));
TNode<IntPtrT> index = m.SmiUntag(m.Parameter(2));
TNode<MaybeObject> expected_result =
m.UncheckedCast<MaybeObject>(m.Parameter(2));
m.UncheckedCast<MaybeObject>(m.Parameter(3));
Label passed(&m), failed(&m);
Label if_found(&m), if_not_found(&m), if_bailout(&m), if_absent(&m);
@ -1835,13 +1834,13 @@ TEST(AllocateJSObjectFromMap) {
Factory* factory = isolate->factory();
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
{
TNode<Map> map = m.CAST(m.Parameter(0));
TNode<HeapObject> properties = m.CAST(m.Parameter(1));
TNode<FixedArray> elements = m.CAST(m.Parameter(2));
TNode<Map> map = m.CAST(m.Parameter(1));
TNode<HeapObject> properties = m.CAST(m.Parameter(2));
TNode<FixedArray> elements = m.CAST(m.Parameter(3));
TNode<JSObject> result =
m.AllocateJSObjectFromMap(map, properties, elements);
@ -1908,11 +1907,11 @@ TEST(AllocateNameDictionary) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
{
Node* capacity = m.Parameter(0);
Node* capacity = m.Parameter(1);
TNode<NameDictionary> result =
m.AllocateNameDictionary(m.SmiUntag(capacity));
m.Return(result);
@ -1989,10 +1988,10 @@ TEST(OneToTwoByteStringCopy) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
StringBuiltinsAssembler m(asm_tester.state());
m.CopyStringCharacters<String>(m.CAST(m.Parameter(0)), m.CAST(m.Parameter(1)),
m.CopyStringCharacters<String>(m.CAST(m.Parameter(1)), m.CAST(m.Parameter(2)),
m.IntPtrConstant(0), m.IntPtrConstant(0),
m.IntPtrConstant(5), String::ONE_BYTE_ENCODING,
String::TWO_BYTE_ENCODING);
@ -2022,10 +2021,10 @@ TEST(OneToOneByteStringCopy) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
StringBuiltinsAssembler m(asm_tester.state());
m.CopyStringCharacters<String>(m.CAST(m.Parameter(0)), m.CAST(m.Parameter(1)),
m.CopyStringCharacters<String>(m.CAST(m.Parameter(1)), m.CAST(m.Parameter(2)),
m.IntPtrConstant(0), m.IntPtrConstant(0),
m.IntPtrConstant(5), String::ONE_BYTE_ENCODING,
String::ONE_BYTE_ENCODING);
@ -2055,10 +2054,10 @@ TEST(OneToOneByteStringCopyNonZeroStart) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
StringBuiltinsAssembler m(asm_tester.state());
m.CopyStringCharacters<String>(m.CAST(m.Parameter(0)), m.CAST(m.Parameter(1)),
m.CopyStringCharacters<String>(m.CAST(m.Parameter(1)), m.CAST(m.Parameter(2)),
m.IntPtrConstant(0), m.IntPtrConstant(3),
m.IntPtrConstant(2), String::ONE_BYTE_ENCODING,
String::ONE_BYTE_ENCODING);
@ -2085,10 +2084,10 @@ TEST(TwoToTwoByteStringCopy) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
StringBuiltinsAssembler m(asm_tester.state());
m.CopyStringCharacters<String>(m.CAST(m.Parameter(0)), m.CAST(m.Parameter(1)),
m.CopyStringCharacters<String>(m.CAST(m.Parameter(1)), m.CAST(m.Parameter(2)),
m.IntPtrConstant(0), m.IntPtrConstant(0),
m.IntPtrConstant(5), String::TWO_BYTE_ENCODING,
String::TWO_BYTE_ENCODING);
@ -2120,8 +2119,8 @@ TEST(TwoToTwoByteStringCopy) {
TEST(Arguments) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 4;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
CodeStubArguments arguments(&m, m.IntPtrConstant(3));
@ -2133,19 +2132,20 @@ TEST(Arguments) {
arguments.PopAndReturn(arguments.GetReceiver());
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
Handle<Object> result = ft.Call(isolate->factory()->undefined_value(),
Handle<Smi>(Smi::FromInt(12), isolate),
Handle<Object> result = ft.Call(Handle<Smi>(Smi::FromInt(12), isolate),
Handle<Smi>(Smi::FromInt(13), isolate),
Handle<Smi>(Smi::FromInt(14), isolate))
.ToHandleChecked();
CHECK_EQ(*isolate->factory()->undefined_value(), *result);
// When calling with undefined object as the receiver, the CallFunction
// builtin swaps it to the global proxy object.
CHECK_EQ(*isolate->global_proxy(), *result);
}
TEST(ArgumentsForEach) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 4;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
CodeStubArguments arguments(&m, m.IntPtrConstant(3));
@ -2162,8 +2162,7 @@ TEST(ArgumentsForEach) {
arguments.PopAndReturn(sum.value());
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
Handle<Object> result = ft.Call(isolate->factory()->undefined_value(),
Handle<Smi>(Smi::FromInt(12), isolate),
Handle<Object> result = ft.Call(Handle<Smi>(Smi::FromInt(12), isolate),
Handle<Smi>(Smi::FromInt(13), isolate),
Handle<Smi>(Smi::FromInt(14), isolate))
.ToHandleChecked();
@ -2173,8 +2172,8 @@ TEST(ArgumentsForEach) {
TEST(IsDebugActive) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 0;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
Label if_active(&m), if_not_active(&m);
@ -2197,7 +2196,7 @@ TEST(IsDebugActive) {
// Cheat to enable debug (TODO: do this properly).
*debug_is_active = true;
result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
result = ft.Call().ToHandleChecked();
CHECK_EQ(ReadOnlyRoots(isolate).true_value(), *result);
// Reset debug mode.
@ -2413,10 +2412,10 @@ TEST(IsSymbol) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
TNode<HeapObject> const symbol = m.CAST(m.Parameter(0));
TNode<HeapObject> const symbol = m.CAST(m.Parameter(1));
m.Return(m.SelectBooleanConstant(m.IsSymbol(symbol)));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -2432,10 +2431,10 @@ TEST(IsPrivateSymbol) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
TNode<HeapObject> const symbol = m.CAST(m.Parameter(0));
TNode<HeapObject> const symbol = m.CAST(m.Parameter(1));
m.Return(m.SelectBooleanConstant(m.IsPrivateSymbol(symbol)));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -2471,11 +2470,11 @@ TEST(PromiseHasHandler) {
TEST(CreatePromiseResolvingFunctionsContext) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 0;
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
PromiseBuiltinsAssembler m(asm_tester.state());
const TNode<Context> context = m.CAST(m.Parameter(kNumParams + 2));
const TNode<Context> context = m.CAST(m.Parameter(kNumParams + 3));
const TNode<NativeContext> native_context = m.LoadNativeContext(context);
const TNode<JSPromise> promise =
m.NewJSPromise(context, m.UndefinedConstant());
@ -2485,8 +2484,7 @@ TEST(CreatePromiseResolvingFunctionsContext) {
m.Return(promise_context);
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
Handle<Object> result =
ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
Handle<Object> result = ft.Call().ToHandleChecked();
CHECK(result->IsContext());
Handle<Context> context_js = Handle<Context>::cast(result);
CHECK_EQ(isolate->root(RootIndex::kEmptyScopeInfo), context_js->scope_info());
@ -2528,13 +2526,13 @@ TEST(CreatePromiseResolvingFunctions) {
TEST(NewElementsCapacity) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 1);
CodeAssemblerTester asm_tester(isolate, 2);
CodeStubAssembler m(asm_tester.state());
m.Return(
m.SmiTag(m.CalculateNewElementsCapacity(m.SmiUntag(m.Parameter(0)))));
m.SmiTag(m.CalculateNewElementsCapacity(m.SmiUntag(m.Parameter(1)))));
FunctionTester ft(asm_tester.GenerateCode(), 1);
Handle<Smi> test_value = Handle<Smi>(Smi::FromInt(0), isolate);
Handle<Smi> test_value = Handle<Smi>(Smi::FromInt(1), isolate);
Handle<Smi> result_obj = ft.CallChecked<Smi>(test_value);
CHECK_EQ(
result_obj->value(),
@ -2558,10 +2556,10 @@ TEST(NewElementsCapacity) {
TEST(NewElementsCapacitySmi) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 1);
CodeAssemblerTester asm_tester(isolate, 2);
CodeStubAssembler m(asm_tester.state());
m.Return(
m.CalculateNewElementsCapacity(m.UncheckedCast<Smi>(m.Parameter(0))));
m.CalculateNewElementsCapacity(m.UncheckedCast<Smi>(m.Parameter(1))));
FunctionTester ft(asm_tester.GenerateCode(), 1);
Handle<Smi> test_value = Handle<Smi>(Smi::FromInt(0), isolate);
@ -2657,11 +2655,12 @@ TEST(NewPromiseCapability) {
Isolate* isolate(CcTest::InitIsolateOnce());
{ // Builtin Promise
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 0;
CodeAssemblerTester asm_tester(isolate,
kNumParams + 1); // Include receiver.
PromiseBuiltinsAssembler m(asm_tester.state());
Node* const context = m.Parameter(kNumParams + 2);
Node* const context = m.Parameter(kNumParams + 3);
const TNode<NativeContext> native_context = m.LoadNativeContext(context);
const TNode<Object> promise_constructor =
m.LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX);
@ -2674,8 +2673,7 @@ TEST(NewPromiseCapability) {
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
Handle<Object> result_obj =
ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
Handle<Object> result_obj = ft.Call().ToHandleChecked();
CHECK(result_obj->IsPromiseCapability());
Handle<PromiseCapability> result =
Handle<PromiseCapability>::cast(result_obj);
@ -2705,11 +2703,12 @@ TEST(NewPromiseCapability) {
}
{ // Custom Promise
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate,
kNumParams + 1); // Include receiver.
PromiseBuiltinsAssembler m(asm_tester.state());
Node* const context = m.Parameter(kNumParams + 2);
Node* const context = m.Parameter(kNumParams + 3);
Node* const constructor = m.Parameter(1);
const TNode<Oddball> debug_event = m.TrueConstant();
@ -2728,9 +2727,7 @@ TEST(NewPromiseCapability) {
" executor(resolve, reject);"
"})")));
Handle<Object> result_obj =
ft.Call(isolate->factory()->undefined_value(), constructor_fn)
.ToHandleChecked();
Handle<Object> result_obj = ft.Call(constructor_fn).ToHandleChecked();
CHECK(result_obj->IsPromiseCapability());
Handle<PromiseCapability> result =
Handle<PromiseCapability>::cast(result_obj);
@ -2936,12 +2933,12 @@ TEST(DirectMemoryTest16BitWord32) {
TEST(LoadJSArrayElementsMap) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
Node* context = m.Parameter(kNumParams + 2);
Node* context = m.Parameter(kNumParams + 3);
TNode<NativeContext> native_context = m.LoadNativeContext(context);
TNode<Int32T> kind = m.SmiToInt32(m.Parameter(0));
TNode<Int32T> kind = m.SmiToInt32(m.Parameter(1));
m.Return(m.LoadJSArrayElementsMap(kind, native_context));
}
@ -2961,13 +2958,13 @@ TEST(GotoIfNotWhiteSpaceOrLineTerminator) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
StringTrimAssembler m(asm_tester.state());
{ // Returns true if whitespace, false otherwise.
Label if_not_whitespace(&m);
m.GotoIfNotWhiteSpaceOrLineTerminator(m.SmiToInt32(m.Parameter(0)),
m.GotoIfNotWhiteSpaceOrLineTerminator(m.SmiToInt32(m.Parameter(1)),
&if_not_whitespace);
m.Return(m.TrueConstant());
@ -2990,12 +2987,12 @@ TEST(BranchIfNumberRelationalComparison) {
Isolate* isolate(CcTest::InitIsolateOnce());
Factory* f = isolate->factory();
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
Label return_true(&m), return_false(&m);
m.BranchIfNumberRelationalComparison(Operation::kGreaterThanOrEqual,
m.Parameter(0), m.Parameter(1),
m.Parameter(1), m.Parameter(2),
&return_true, &return_false);
m.BIND(&return_true);
m.Return(m.BooleanConstant(true));
@ -3020,10 +3017,10 @@ TEST(BranchIfNumberRelationalComparison) {
TEST(IsNumberArrayIndex) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
TNode<Number> number = m.CAST(m.Parameter(0));
TNode<Number> number = m.CAST(m.Parameter(1));
m.Return(
m.SmiFromInt32(m.UncheckedCast<Int32T>(m.IsNumberArrayIndex(number))));
}
@ -3068,17 +3065,19 @@ TEST(IsNumberArrayIndex) {
TEST(NumberMinMax) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester_min(isolate, kNumParams);
CodeAssemblerTester asm_tester_min(isolate,
kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester_min.state());
m.Return(m.NumberMin(m.Parameter(0), m.Parameter(1)));
m.Return(m.NumberMin(m.Parameter(1), m.Parameter(2)));
}
FunctionTester ft_min(asm_tester_min.GenerateCode(), kNumParams);
CodeAssemblerTester asm_tester_max(isolate, kNumParams);
CodeAssemblerTester asm_tester_max(isolate,
kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester_max.state());
m.Return(m.NumberMax(m.Parameter(0), m.Parameter(1)));
m.Return(m.NumberMax(m.Parameter(1), m.Parameter(2)));
}
FunctionTester ft_max(asm_tester_max.GenerateCode(), kNumParams);
@ -3124,17 +3123,19 @@ TEST(NumberMinMax) {
TEST(NumberAddSub) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester asm_tester_add(isolate, kNumParams);
CodeAssemblerTester asm_tester_add(isolate,
kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester_add.state());
m.Return(m.NumberAdd(m.Parameter(0), m.Parameter(1)));
m.Return(m.NumberAdd(m.Parameter(1), m.Parameter(2)));
}
FunctionTester ft_add(asm_tester_add.GenerateCode(), kNumParams);
CodeAssemblerTester asm_tester_sub(isolate, kNumParams);
CodeAssemblerTester asm_tester_sub(isolate,
kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester_sub.state());
m.Return(m.NumberSub(m.Parameter(0), m.Parameter(1)));
m.Return(m.NumberSub(m.Parameter(1), m.Parameter(2)));
}
FunctionTester ft_sub(asm_tester_sub.GenerateCode(), kNumParams);
@ -3168,10 +3169,10 @@ TEST(NumberAddSub) {
TEST(CloneEmptyFixedArray) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
m.Return(m.CloneFixedArray(m.CAST(m.Parameter(0))));
m.Return(m.CloneFixedArray(m.CAST(m.Parameter(1))));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -3185,10 +3186,10 @@ TEST(CloneEmptyFixedArray) {
TEST(CloneFixedArray) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
m.Return(m.CloneFixedArray(m.CAST(m.Parameter(0))));
m.Return(m.CloneFixedArray(m.CAST(m.Parameter(1))));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -3207,10 +3208,10 @@ TEST(CloneFixedArray) {
TEST(CloneFixedArrayCOW) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
m.Return(m.CloneFixedArray(m.CAST(m.Parameter(0))));
m.Return(m.CloneFixedArray(m.CAST(m.Parameter(1))));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -3225,12 +3226,12 @@ TEST(CloneFixedArrayCOW) {
TEST(ExtractFixedArrayCOWForceCopy) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.SmiConstant(0),
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(1)), m.SmiConstant(0),
nullptr, nullptr, flags,
CodeStubAssembler::SMI_PARAMETERS));
}
@ -3253,14 +3254,14 @@ TEST(ExtractFixedArrayCOWForceCopy) {
TEST(ExtractFixedArraySimple) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW;
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.Parameter(1),
m.Parameter(2), nullptr, flags,
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(1)), m.Parameter(2),
m.Parameter(3), nullptr, flags,
CodeStubAssembler::SMI_PARAMETERS));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -3280,13 +3281,13 @@ TEST(ExtractFixedArraySimple) {
TEST(ExtractFixedArraySimpleSmiConstant) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW;
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.SmiConstant(1),
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(1)), m.SmiConstant(1),
m.SmiConstant(2), nullptr, flags,
CodeStubAssembler::SMI_PARAMETERS));
}
@ -3304,13 +3305,13 @@ TEST(ExtractFixedArraySimpleSmiConstant) {
TEST(ExtractFixedArraySimpleIntPtrConstant) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
CodeStubAssembler::ExtractFixedArrayFlags flags;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kAllFixedArrays;
flags |= CodeStubAssembler::ExtractFixedArrayFlag::kDontCopyCOW;
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(0)), m.IntPtrConstant(1),
m.Return(m.ExtractFixedArray(m.CAST(m.Parameter(1)), m.IntPtrConstant(1),
m.IntPtrConstant(2), nullptr, flags,
CodeStubAssembler::INTPTR_PARAMETERS));
}
@ -3328,11 +3329,11 @@ TEST(ExtractFixedArraySimpleIntPtrConstant) {
TEST(ExtractFixedArraySimpleIntPtrConstantNoDoubles) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
m.Return(m.ExtractFixedArray(
m.CAST(m.Parameter(0)), m.IntPtrConstant(1), m.IntPtrConstant(2),
m.CAST(m.Parameter(1)), m.IntPtrConstant(1), m.IntPtrConstant(2),
nullptr, CodeStubAssembler::ExtractFixedArrayFlag::kFixedArrays,
CodeStubAssembler::INTPTR_PARAMETERS));
}
@ -3350,13 +3351,13 @@ TEST(ExtractFixedArraySimpleIntPtrConstantNoDoubles) {
TEST(ExtractFixedArraySimpleIntPtrParameters) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 3;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
TNode<IntPtrT> p1_untagged = m.SmiUntag(m.Parameter(1));
TNode<IntPtrT> p2_untagged = m.SmiUntag(m.Parameter(2));
TNode<IntPtrT> p1_untagged = m.SmiUntag(m.Parameter(2));
TNode<IntPtrT> p2_untagged = m.SmiUntag(m.Parameter(3));
m.Return(
m.ExtractFixedArray(m.CAST(m.Parameter(0)), p1_untagged, p2_untagged));
m.ExtractFixedArray(m.CAST(m.Parameter(1)), p1_untagged, p2_untagged));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -3418,10 +3419,10 @@ TEST(SingleInputPhiElimination) {
TEST(SmallOrderedHashMapAllocate) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
TNode<Smi> capacity = m.CAST(m.Parameter(0));
TNode<Smi> capacity = m.CAST(m.Parameter(1));
m.Return(m.AllocateSmallOrderedHashMap(m.SmiToIntPtr(capacity)));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -3456,10 +3457,10 @@ TEST(SmallOrderedHashMapAllocate) {
TEST(SmallOrderedHashSetAllocate) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(asm_tester.state());
TNode<Smi> capacity = m.CAST(m.Parameter(0));
TNode<Smi> capacity = m.CAST(m.Parameter(1));
m.Return(m.AllocateSmallOrderedHashSet(m.SmiToIntPtr(capacity)));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
@ -3494,11 +3495,11 @@ TEST(SmallOrderedHashSetAllocate) {
TEST(IsDoubleElementsKind) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 2;
CodeAssemblerTester ft_tester(isolate, kNumParams);
CodeAssemblerTester ft_tester(isolate, kNumParams + 1); // Include receiver.
{
CodeStubAssembler m(ft_tester.state());
m.Return(m.SmiFromInt32(m.UncheckedCast<Int32T>(
m.IsDoubleElementsKind(m.SmiToInt32(m.Parameter(0))))));
m.IsDoubleElementsKind(m.SmiToInt32(m.Parameter(1))))));
}
FunctionTester ft(ft_tester.GenerateCode(), kNumParams);
CHECK_EQ(
@ -3543,11 +3544,11 @@ TEST(IsDoubleElementsKind) {
TEST(TestCallBuiltinInlineTrampoline) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
const int kContextOffset = 2;
Node* str = m.Parameter(0);
const int kContextOffset = 3;
Node* str = m.Parameter(1);
TNode<Context> context = m.CAST(m.Parameter(kNumParams + kContextOffset));
TNode<Smi> index = m.SmiConstant(2);
@ -3599,11 +3600,11 @@ TEST(InstructionSchedulingCallerSavedRegisters) {
Isolate* isolate(CcTest::InitIsolateOnce());
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
{
Node* x = m.SmiUntag(m.Parameter(0));
Node* x = m.SmiUntag(m.Parameter(1));
Node* y = m.WordOr(m.WordShr(x, 1), m.IntPtrConstant(1));
TNode<ExternalReference> isolate_ptr =
m.ExternalConstant(ExternalReference::isolate_address(isolate));
@ -3695,10 +3696,10 @@ TEST(WasmTaggedNonSmiToInt32) {
};
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
Node* context = m.Parameter(kNumParams + 2);
const TNode<Object> arg = m.CAST(m.Parameter(0));
Node* context = m.Parameter(kNumParams + 3);
const TNode<Object> arg = m.CAST(m.Parameter(1));
int32_t result = 0;
Node* base = m.IntPtrConstant(reinterpret_cast<intptr_t>(&result));
Node* value = m.CallBuiltin(Builtins::kWasmTaggedNonSmiToInt32, context, arg);
@ -3833,10 +3834,10 @@ TEST(WasmTaggedToFloat64) {
};
const int kNumParams = 1;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeAssemblerTester asm_tester(isolate, kNumParams + 1); // Include receiver.
CodeStubAssembler m(asm_tester.state());
Node* context = m.Parameter(kNumParams + 2);
const TNode<Object> arg = m.CAST(m.Parameter(0));
Node* context = m.Parameter(kNumParams + 3);
const TNode<Object> arg = m.CAST(m.Parameter(1));
double result = 0;
Node* base = m.IntPtrConstant(reinterpret_cast<intptr_t>(&result));
Node* value = m.CallBuiltin(Builtins::kWasmTaggedToFloat64, context, arg);