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 <stdint.h> | 5 #include <stdint.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 // Check the thread finished with the right value. | 213 // Check the thread finished with the right value. |
214 CHECK_EQ(WasmInterpreter::FINISHED, thread->state()); | 214 CHECK_EQ(WasmInterpreter::FINISHED, thread->state()); |
215 uint32_t expected = (*a) + (b); | 215 uint32_t expected = (*a) + (b); |
216 CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>()); | 216 CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>()); |
217 } | 217 } |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 TEST(Step_I32Mul) { | 221 TEST(Step_I32Mul) { |
222 static const int kTraceLength = 4; | 222 static const int kTraceLength = 5; |
223 byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; | 223 byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; |
224 | 224 |
225 WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreted); | 225 WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreted); |
226 | 226 |
227 r.Build(code, code + arraysize(code)); | 227 r.Build(code, code + arraysize(code)); |
228 | 228 |
229 WasmInterpreter* interpreter = r.interpreter(); | 229 WasmInterpreter* interpreter = r.interpreter(); |
230 WasmInterpreter::Thread* thread = interpreter->GetThread(0); | 230 WasmInterpreter::Thread* thread = interpreter->GetThread(0); |
231 | 231 |
232 FOR_UINT32_INPUTS(a) { | 232 FOR_UINT32_INPUTS(a) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 BUILD(r, WASM_F64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 393 BUILD(r, WASM_F64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
394 r.Call(1048575.5, 2.5); | 394 r.Call(1048575.5, 2.5); |
395 CHECK(!r.possible_nondeterminism()); | 395 CHECK(!r.possible_nondeterminism()); |
396 r.Call(std::numeric_limits<double>::infinity(), 0.0); | 396 r.Call(std::numeric_limits<double>::infinity(), 0.0); |
397 CHECK(r.possible_nondeterminism()); | 397 CHECK(r.possible_nondeterminism()); |
398 } | 398 } |
399 } | 399 } |
400 } // namespace wasm | 400 } // namespace wasm |
401 } // namespace internal | 401 } // namespace internal |
402 } // namespace v8 | 402 } // namespace v8 |
OLD | NEW |