OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 <cstring> | 5 #include <cstring> |
6 #include <functional> | 6 #include <functional> |
7 #include <iostream> | 7 #include <iostream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/asmjs/asm-typer.h" | 10 #include "src/asmjs/asm-typer.h" |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 {"ulocal"}, | 1116 {"ulocal"}, |
1117 {"dqlocal"}, | 1117 {"dqlocal"}, |
1118 {"fishlocal"}, | 1118 {"fishlocal"}, |
1119 }; | 1119 }; |
1120 | 1120 |
1121 char full_test[200]; | 1121 char full_test[200]; |
1122 static const size_t kFullTestSize = arraysize(full_test); | 1122 static const size_t kFullTestSize = arraysize(full_test); |
1123 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { | 1123 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { |
1124 const auto* test = kTests + ii; | 1124 const auto* test = kTests + ii; |
1125 CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", | 1125 CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", |
1126 test->expression) < kFullTestSize); | 1126 test->expression) < |
| 1127 static_cast<int>(kFullTestSize)); |
1127 if (!ValidationOf(Expression(full_test)) | 1128 if (!ValidationOf(Expression(full_test)) |
1128 ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) | 1129 ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) |
1129 ->WithGlobal(DynamicGlobal("a_float_function"), v2f) | 1130 ->WithGlobal(DynamicGlobal("a_float_function"), v2f) |
1130 ->WithLocal(DynamicGlobal("slocal"), iw::AsmType::Signed()) | 1131 ->WithLocal(DynamicGlobal("slocal"), iw::AsmType::Signed()) |
1131 ->WithLocal(DynamicGlobal("ulocal"), iw::AsmType::Unsigned()) | 1132 ->WithLocal(DynamicGlobal("ulocal"), iw::AsmType::Unsigned()) |
1132 ->WithLocal(DynamicGlobal("dqlocal"), iw::AsmType::DoubleQ()) | 1133 ->WithLocal(DynamicGlobal("dqlocal"), iw::AsmType::DoubleQ()) |
1133 ->WithLocal(DynamicGlobal("fishlocal"), iw::AsmType::Floatish()) | 1134 ->WithLocal(DynamicGlobal("fishlocal"), iw::AsmType::Floatish()) |
1134 ->SucceedsWithExactType(iw::AsmType::Float())) { | 1135 ->SucceedsWithExactType(iw::AsmType::Float())) { |
1135 std::cerr << "Test:\n" << full_test; | 1136 std::cerr << "Test:\n" << full_test; |
1136 CHECK(false); | 1137 CHECK(false); |
(...skipping 10 matching lines...) Expand all Loading... |
1147 }; | 1148 }; |
1148 | 1149 |
1149 auto v2d = [](Zone* zone) -> iw::AsmType* { | 1150 auto v2d = [](Zone* zone) -> iw::AsmType* { |
1150 auto* ret = iw::AsmType::Function(zone, iw::AsmType::Double()); | 1151 auto* ret = iw::AsmType::Function(zone, iw::AsmType::Double()); |
1151 return ret; | 1152 return ret; |
1152 }; | 1153 }; |
1153 | 1154 |
1154 for (size_t ii = 0; ii < arraysize(kFailureTests); ++ii) { | 1155 for (size_t ii = 0; ii < arraysize(kFailureTests); ++ii) { |
1155 const auto* test = kFailureTests + ii; | 1156 const auto* test = kFailureTests + ii; |
1156 CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", | 1157 CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", |
1157 test->expression) < kFullTestSize); | 1158 test->expression) < |
| 1159 static_cast<int>(kFullTestSize)); |
1158 if (!ValidationOf(Expression(full_test)) | 1160 if (!ValidationOf(Expression(full_test)) |
1159 ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) | 1161 ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) |
1160 ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) | 1162 ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) |
1161 ->WithLocal(DynamicGlobal("vlocal"), iw::AsmType::Void()) | 1163 ->WithLocal(DynamicGlobal("vlocal"), iw::AsmType::Void()) |
1162 ->WithGlobal(DynamicGlobal("a_double_function"), v2d) | 1164 ->WithGlobal(DynamicGlobal("a_double_function"), v2d) |
1163 ->FailsWithMessage(test->error_message)) { | 1165 ->FailsWithMessage(test->error_message)) { |
1164 std::cerr << "Test:\n" << full_test; | 1166 std::cerr << "Test:\n" << full_test; |
1165 CHECK(false); | 1167 CHECK(false); |
1166 } | 1168 } |
1167 } | 1169 } |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 if (!ValidationOf(Module(kTests[ii])) | 2049 if (!ValidationOf(Module(kTests[ii])) |
2048 ->FailsWithMessage( | 2050 ->FailsWithMessage( |
2049 "Constant in return must be signed, float, or double.")) { | 2051 "Constant in return must be signed, float, or double.")) { |
2050 std::cerr << "Test:\n" << kTests[ii]; | 2052 std::cerr << "Test:\n" << kTests[ii]; |
2051 CHECK(false); | 2053 CHECK(false); |
2052 } | 2054 } |
2053 } | 2055 } |
2054 } | 2056 } |
2055 | 2057 |
2056 } // namespace | 2058 } // namespace |
OLD | NEW |