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

Unified Diff: test/cctest/compiler/test-code-stub-assembler.cc

Issue 1989363004: [turbofan] Add FixedArray peephole optimizations to CodeStubAssembler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Final review feedback Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: test/cctest/compiler/test-code-stub-assembler.cc
diff --git a/test/cctest/compiler/test-code-stub-assembler.cc b/test/cctest/compiler/test-code-stub-assembler.cc
index ff02cc9b445a5640899335993b9b22eb63defeb3..37ba9e9904fa7148e3f4f15e8551fbc8d62b36af 100644
--- a/test/cctest/compiler/test-code-stub-assembler.cc
+++ b/test/cctest/compiler/test-code-stub-assembler.cc
@@ -246,8 +246,9 @@ TEST(FixedArrayAccessSmiIndex) {
CodeStubAssemblerTester m(isolate, descriptor);
Handle<FixedArray> array = isolate->factory()->NewFixedArray(5);
array->set(4, Smi::FromInt(733));
- m.Return(m.LoadFixedArrayElementSmiIndex(m.HeapConstant(array),
- m.SmiTag(m.Int32Constant(4))));
+ m.Return(m.LoadFixedArrayElement(m.HeapConstant(array),
+ m.SmiTag(m.Int32Constant(4)), 0,
+ CodeStubAssembler::SMI_PARAMETERS));
Handle<Code> code = m.GenerateCode();
FunctionTester ft(descriptor, code);
MaybeHandle<Object> result = ft.Call();
@@ -361,6 +362,33 @@ TEST(SplitEdgeSwitchMerge) {
USE(m.GenerateCode());
}
+TEST(TestToConstant) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+ VoidDescriptor descriptor(isolate);
+ CodeStubAssemblerTester m(isolate, descriptor);
+ int32_t value32;
+ int64_t value64;
+ Node* a = m.Int32Constant(5);
+ CHECK(m.ToInt32Constant(a, value32));
+ CHECK(m.ToInt64Constant(a, value64));
+
+ a = m.Int64Constant(static_cast<int64_t>(1) << 32);
+ CHECK(!m.ToInt32Constant(a, value32));
+ CHECK(m.ToInt64Constant(a, value64));
+
+ a = m.Int64Constant(13);
+ CHECK(m.ToInt32Constant(a, value32));
+ CHECK(m.ToInt64Constant(a, value64));
+
+ a = m.UndefinedConstant();
+ CHECK(!m.ToInt32Constant(a, value32));
+ CHECK(!m.ToInt64Constant(a, value64));
+
+ a = m.UndefinedConstant();
+ CHECK(!m.ToInt32Constant(a, value32));
+ CHECK(!m.ToInt64Constant(a, value64));
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/interpreter-assembler.cc ('k') | test/unittests/interpreter/interpreter-assembler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698