Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/test/cctest/compiler/test-code-stub-assembler.cc b/test/cctest/compiler/test-code-stub-assembler.cc
index ff02cc9..37ba9e9 100644
--- a/test/cctest/compiler/test-code-stub-assembler.cc
+++ b/test/cctest/compiler/test-code-stub-assembler.cc
@@ -246,8 +246,9 @@
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 @@
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