summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-macro-assembler-mips.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-03-31 14:38:28 +0200
committerFedor Indutny <fedor@indutny.com>2014-04-02 00:05:24 +0400
commit67e078094b53861a5aa7e9354e33487d0bd4f73b (patch)
tree09a706adee1ddb59c1507ee3320de9cb6896135b /deps/v8/test/cctest/test-macro-assembler-mips.cc
parentf984555d47298cfb01b3e55c2861066379306fc3 (diff)
downloadnode-new-67e078094b53861a5aa7e9354e33487d0bd4f73b.tar.gz
deps: upgrade v8 to 3.25.30
Diffstat (limited to 'deps/v8/test/cctest/test-macro-assembler-mips.cc')
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-mips.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/test-macro-assembler-mips.cc b/deps/v8/test/cctest/test-macro-assembler-mips.cc
index b200949679..3154aac596 100644
--- a/deps/v8/test/cctest/test-macro-assembler-mips.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-mips.cc
@@ -132,5 +132,47 @@ TEST(CopyBytes) {
}
+static void TestNaN(const char *code) {
+ // NaN value is different on MIPS and x86 architectures, and TEST(NaNx)
+ // tests checks the case where a x86 NaN value is serialized into the
+ // snapshot on the simulator during cross compilation.
+ v8::HandleScope scope(CcTest::isolate());
+ v8::Local<v8::Context> context = CcTest::NewContext(PRINT_EXTENSION);
+ v8::Context::Scope context_scope(context);
+
+ v8::Local<v8::Script> script = v8::Script::Compile(v8_str(code));
+ v8::Local<v8::Object> result = v8::Local<v8::Object>::Cast(script->Run());
+ // Have to populate the handle manually, as it's not Cast-able.
+ i::Handle<i::JSObject> o =
+ v8::Utils::OpenHandle<v8::Object, i::JSObject>(result);
+ i::Handle<i::JSArray> array1(reinterpret_cast<i::JSArray*>(*o));
+ i::FixedDoubleArray* a = i::FixedDoubleArray::cast(array1->elements());
+ double value = a->get_scalar(0);
+ CHECK(std::isnan(value) &&
+ i::BitCast<uint64_t>(value) ==
+ i::BitCast<uint64_t>(
+ i::FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
+}
+
+
+TEST(NaN0) {
+ TestNaN(
+ "var result;"
+ "for (var i = 0; i < 2; i++) {"
+ " result = new Array(Number.NaN, Number.POSITIVE_INFINITY);"
+ "}"
+ "result;");
+}
+
+
+TEST(NaN1) {
+ TestNaN(
+ "var result;"
+ "for (var i = 0; i < 2; i++) {"
+ " result = [NaN];"
+ "}"
+ "result;");
+}
+
#undef __