Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/cctest/test-code-stub-assembler.cc

Issue 2473643002: Revert of [turbofan] Support variable size argument popping in TF-generated functions (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/compiler/test-run-stubs.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/utils/random-number-generator.h" 5 #include "src/base/utils/random-number-generator.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/code-stub-assembler.h" 7 #include "src/code-stub-assembler.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/ic/stub-cache.h" 9 #include "src/ic/stub-cache.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked(); 1722 ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked();
1723 Handle<NameDictionary> dict = NameDictionary::New(isolate, i); 1723 Handle<NameDictionary> dict = NameDictionary::New(isolate, i);
1724 // Both dictionaries should be memory equal. 1724 // Both dictionaries should be memory equal.
1725 int size = 1725 int size =
1726 FixedArrayBase::kHeaderSize + (dict->length() - 1) * kPointerSize; 1726 FixedArrayBase::kHeaderSize + (dict->length() - 1) * kPointerSize;
1727 CHECK_EQ(0, memcmp(*dict, *result, size)); 1727 CHECK_EQ(0, memcmp(*dict, *result, size));
1728 } 1728 }
1729 } 1729 }
1730 } 1730 }
1731 1731
1732 TEST(PopAndReturnConstant) {
1733 Isolate* isolate(CcTest::InitIsolateOnce());
1734
1735 const int kNumParams = 4;
1736 const int kNumProgramaticParams = 2;
1737 CodeStubAssemblerTester m(isolate, kNumParams - kNumProgramaticParams);
1738
1739 // Call a function that return |kNumProgramaticParams| parameters in addition
1740 // to those specified by the static descriptor. |kNumProgramaticParams| is
1741 // specified as a constant.
1742 m.PopAndReturn(m.Int32Constant(kNumProgramaticParams),
1743 m.SmiConstant(Smi::FromInt(1234)));
1744
1745 Handle<Code> code = m.GenerateCode();
1746 CHECK(!code.is_null());
1747
1748 FunctionTester ft(code, kNumParams);
1749 Handle<Object> result;
1750 for (int test_count = 0; test_count < 100; ++test_count) {
1751 result = ft.Call(isolate->factory()->undefined_value(),
1752 Handle<Smi>(Smi::FromInt(1234), isolate),
1753 isolate->factory()->undefined_value(),
1754 isolate->factory()->undefined_value())
1755 .ToHandleChecked();
1756 CHECK_EQ(1234, Handle<Smi>::cast(result)->value());
1757 }
1758 }
1759
1760 TEST(PopAndReturnVariable) {
1761 Isolate* isolate(CcTest::InitIsolateOnce());
1762
1763 const int kNumParams = 4;
1764 const int kNumProgramaticParams = 2;
1765 CodeStubAssemblerTester m(isolate, kNumParams - kNumProgramaticParams);
1766
1767 // Call a function that return |kNumProgramaticParams| parameters in addition
1768 // to those specified by the static descriptor. |kNumProgramaticParams| is
1769 // passed in as a parameter to the function so that it can't be recongized as
1770 // a constant.
1771 m.PopAndReturn(m.SmiUntag(m.Parameter(1)), m.SmiConstant(Smi::FromInt(1234)));
1772
1773 Handle<Code> code = m.GenerateCode();
1774 CHECK(!code.is_null());
1775
1776 FunctionTester ft(code, kNumParams);
1777 Handle<Object> result;
1778 for (int test_count = 0; test_count < 100; ++test_count) {
1779 result =
1780 ft.Call(isolate->factory()->undefined_value(),
1781 Handle<Smi>(Smi::FromInt(1234), isolate),
1782 isolate->factory()->undefined_value(),
1783 Handle<Smi>(Smi::FromInt(kNumProgramaticParams * kPointerSize),
1784 isolate))
1785 .ToHandleChecked();
1786 CHECK_EQ(1234, Handle<Smi>::cast(result)->value());
1787 }
1788 }
1789
1790 } // namespace internal 1732 } // namespace internal
1791 } // namespace v8 1733 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-stubs.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698