Chromium Code Reviews| 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 "src/wasm/wasm-interpreter.h" | 5 #include "src/wasm/wasm-interpreter.h" |
| 6 #include "src/wasm/ast-decoder.h" | 6 #include "src/wasm/ast-decoder.h" |
| 7 #include "src/wasm/decoder.h" | 7 #include "src/wasm/decoder.h" |
| 8 #include "src/wasm/wasm-external-refs.h" | 8 #include "src/wasm/wasm-external-refs.h" |
| 9 #include "src/wasm/wasm-module.h" | 9 #include "src/wasm/wasm-module.h" |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 V(I64Ne, uint64_t, !=) \ | 53 V(I64Ne, uint64_t, !=) \ |
| 54 V(I64LtU, uint64_t, <) \ | 54 V(I64LtU, uint64_t, <) \ |
| 55 V(I64LeU, uint64_t, <=) \ | 55 V(I64LeU, uint64_t, <=) \ |
| 56 V(I64GtU, uint64_t, >) \ | 56 V(I64GtU, uint64_t, >) \ |
| 57 V(I64GeU, uint64_t, >=) \ | 57 V(I64GeU, uint64_t, >=) \ |
| 58 V(I64LtS, int64_t, <) \ | 58 V(I64LtS, int64_t, <) \ |
| 59 V(I64LeS, int64_t, <=) \ | 59 V(I64LeS, int64_t, <=) \ |
| 60 V(I64GtS, int64_t, >) \ | 60 V(I64GtS, int64_t, >) \ |
| 61 V(I64GeS, int64_t, >=) \ | 61 V(I64GeS, int64_t, >=) \ |
| 62 V(F32Add, float, +) \ | 62 V(F32Add, float, +) \ |
| 63 V(F32Sub, float, -) \ | |
|
Marija Antic
2016/06/17 08:09:08
Have you run the interpreter tests on the board? W
| |
| 64 V(F32Mul, float, *) \ | 63 V(F32Mul, float, *) \ |
| 65 V(F32Div, float, /) \ | 64 V(F32Div, float, /) \ |
| 66 V(F32Eq, float, ==) \ | 65 V(F32Eq, float, ==) \ |
| 67 V(F32Ne, float, !=) \ | 66 V(F32Ne, float, !=) \ |
| 68 V(F32Lt, float, <) \ | 67 V(F32Lt, float, <) \ |
| 69 V(F32Le, float, <=) \ | 68 V(F32Le, float, <=) \ |
| 70 V(F32Gt, float, >) \ | 69 V(F32Gt, float, >) \ |
| 71 V(F32Ge, float, >=) \ | 70 V(F32Ge, float, >=) \ |
| 72 V(F64Add, double, +) \ | 71 V(F64Add, double, +) \ |
| 73 V(F64Sub, double, -) \ | |
| 74 V(F64Mul, double, *) \ | 72 V(F64Mul, double, *) \ |
| 75 V(F64Div, double, /) \ | 73 V(F64Div, double, /) \ |
| 76 V(F64Eq, double, ==) \ | 74 V(F64Eq, double, ==) \ |
| 77 V(F64Ne, double, !=) \ | 75 V(F64Ne, double, !=) \ |
| 78 V(F64Lt, double, <) \ | 76 V(F64Lt, double, <) \ |
| 79 V(F64Le, double, <=) \ | 77 V(F64Le, double, <=) \ |
| 80 V(F64Gt, double, >) \ | 78 V(F64Gt, double, >) \ |
| 81 V(F64Ge, double, >=) | 79 V(F64Ge, double, >=) |
| 82 | 80 |
| 83 #define FOREACH_OTHER_BINOP(V) \ | 81 #define FOREACH_OTHER_BINOP(V) \ |
| 84 V(I32DivS, int32_t) \ | 82 V(I32DivS, int32_t) \ |
| 85 V(I32DivU, uint32_t) \ | 83 V(I32DivU, uint32_t) \ |
| 86 V(I32RemS, int32_t) \ | 84 V(I32RemS, int32_t) \ |
| 87 V(I32RemU, uint32_t) \ | 85 V(I32RemU, uint32_t) \ |
| 88 V(I32Shl, uint32_t) \ | 86 V(I32Shl, uint32_t) \ |
| 89 V(I32ShrU, uint32_t) \ | 87 V(I32ShrU, uint32_t) \ |
| 90 V(I32ShrS, int32_t) \ | 88 V(I32ShrS, int32_t) \ |
| 91 V(I64DivS, int64_t) \ | 89 V(I64DivS, int64_t) \ |
| 92 V(I64DivU, uint64_t) \ | 90 V(I64DivU, uint64_t) \ |
| 93 V(I64RemS, int64_t) \ | 91 V(I64RemS, int64_t) \ |
| 94 V(I64RemU, uint64_t) \ | 92 V(I64RemU, uint64_t) \ |
| 95 V(I64Shl, uint64_t) \ | 93 V(I64Shl, uint64_t) \ |
| 96 V(I64ShrU, uint64_t) \ | 94 V(I64ShrU, uint64_t) \ |
| 97 V(I64ShrS, int64_t) \ | 95 V(I64ShrS, int64_t) \ |
| 98 V(I32Ror, int32_t) \ | 96 V(I32Ror, int32_t) \ |
| 99 V(I32Rol, int32_t) \ | 97 V(I32Rol, int32_t) \ |
| 100 V(I64Ror, int64_t) \ | 98 V(I64Ror, int64_t) \ |
| 101 V(I64Rol, int64_t) \ | 99 V(I64Rol, int64_t) \ |
| 100 V(F32Sub, float) \ | |
| 102 V(F32Min, float) \ | 101 V(F32Min, float) \ |
| 103 V(F32Max, float) \ | 102 V(F32Max, float) \ |
| 104 V(F32CopySign, float) \ | 103 V(F32CopySign, float) \ |
| 105 V(F64Min, double) \ | 104 V(F64Min, double) \ |
| 106 V(F64Max, double) \ | 105 V(F64Max, double) \ |
| 106 V(F64Sub, double) \ | |
| 107 V(F64CopySign, double) \ | 107 V(F64CopySign, double) \ |
| 108 V(I32AsmjsDivS, int32_t) \ | 108 V(I32AsmjsDivS, int32_t) \ |
| 109 V(I32AsmjsDivU, uint32_t) \ | 109 V(I32AsmjsDivU, uint32_t) \ |
| 110 V(I32AsmjsRemS, int32_t) \ | 110 V(I32AsmjsRemS, int32_t) \ |
| 111 V(I32AsmjsRemU, uint32_t) | 111 V(I32AsmjsRemU, uint32_t) |
| 112 | 112 |
| 113 #define FOREACH_OTHER_UNOP(V) \ | 113 #define FOREACH_OTHER_UNOP(V) \ |
| 114 V(I32Clz, uint32_t) \ | 114 V(I32Clz, uint32_t) \ |
| 115 V(I32Ctz, uint32_t) \ | 115 V(I32Ctz, uint32_t) \ |
| 116 V(I32Popcnt, uint32_t) \ | 116 V(I32Popcnt, uint32_t) \ |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 uint64_t q = bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN()); | 304 uint64_t q = bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN()); |
| 305 if ((q & kSignalingBit) != 0) { | 305 if ((q & kSignalingBit) != 0) { |
| 306 // On some machines, the signaling bit set indicates it's a quiet NaN. | 306 // On some machines, the signaling bit set indicates it's a quiet NaN. |
| 307 return bit_cast<double>(bit_cast<uint64_t>(a) | kSignalingBit); | 307 return bit_cast<double>(bit_cast<uint64_t>(a) | kSignalingBit); |
| 308 } else { | 308 } else { |
| 309 // On others, the signaling bit set indicates it's a signaling NaN. | 309 // On others, the signaling bit set indicates it's a signaling NaN. |
| 310 return bit_cast<double>(bit_cast<uint64_t>(a) & ~kSignalingBit); | 310 return bit_cast<double>(bit_cast<uint64_t>(a) & ~kSignalingBit); |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| 314 static inline float ExecuteF32Sub(float a, float b, TrapReason* trap) { | |
| 315 float result = a - b; | |
| 316 if (result - result != 0) { | |
| 317 if (std::isnan(a)) return quiet(a); | |
| 318 if (std::isnan(b)) return quiet(b); | |
| 319 } | |
| 320 return a - b; | |
| 321 } | |
| 322 | |
| 314 static inline float ExecuteF32Min(float a, float b, TrapReason* trap) { | 323 static inline float ExecuteF32Min(float a, float b, TrapReason* trap) { |
| 315 if (std::isnan(a)) return quiet(a); | 324 if (std::isnan(a)) return quiet(a); |
| 316 if (std::isnan(b)) return quiet(b); | 325 if (std::isnan(b)) return quiet(b); |
| 317 return std::min(a, b); | 326 return std::min(a, b); |
| 318 } | 327 } |
| 319 | 328 |
| 320 static inline float ExecuteF32Max(float a, float b, TrapReason* trap) { | 329 static inline float ExecuteF32Max(float a, float b, TrapReason* trap) { |
| 321 if (std::isnan(a)) return quiet(a); | 330 if (std::isnan(a)) return quiet(a); |
| 322 if (std::isnan(b)) return quiet(b); | 331 if (std::isnan(b)) return quiet(b); |
| 323 return std::max(a, b); | 332 return std::max(a, b); |
| 324 } | 333 } |
| 325 | 334 |
| 326 static inline float ExecuteF32CopySign(float a, float b, TrapReason* trap) { | 335 static inline float ExecuteF32CopySign(float a, float b, TrapReason* trap) { |
| 327 return copysignf(a, b); | 336 return copysignf(a, b); |
| 328 } | 337 } |
| 329 | 338 |
| 339 static inline double ExecuteF64Sub(double a, double b, TrapReason* trap) { | |
| 340 double result = a - b; | |
| 341 if (result - result != 0) { | |
| 342 if (std::isnan(a)) return quiet(a); | |
| 343 if (std::isnan(b)) return quiet(b); | |
| 344 } | |
| 345 return a - b; | |
| 346 } | |
| 347 | |
| 330 static inline double ExecuteF64Min(double a, double b, TrapReason* trap) { | 348 static inline double ExecuteF64Min(double a, double b, TrapReason* trap) { |
| 331 if (std::isnan(a)) return quiet(a); | 349 if (std::isnan(a)) return quiet(a); |
| 332 if (std::isnan(b)) return quiet(b); | 350 if (std::isnan(b)) return quiet(b); |
| 333 return std::min(a, b); | 351 return std::min(a, b); |
| 334 } | 352 } |
| 335 | 353 |
| 336 static inline double ExecuteF64Max(double a, double b, TrapReason* trap) { | 354 static inline double ExecuteF64Max(double a, double b, TrapReason* trap) { |
| 337 if (std::isnan(a)) return quiet(a); | 355 if (std::isnan(a)) return quiet(a); |
| 338 if (std::isnan(b)) return quiet(b); | 356 if (std::isnan(b)) return quiet(b); |
| 339 return std::max(a, b); | 357 return std::max(a, b); |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1799 | 1817 |
| 1800 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( | 1818 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( |
| 1801 Zone* zone, const byte* start, const byte* end) { | 1819 Zone* zone, const byte* start, const byte* end) { |
| 1802 ControlTransfers targets(zone, 0, start, end); | 1820 ControlTransfers targets(zone, 0, start, end); |
| 1803 return targets.map_; | 1821 return targets.map_; |
| 1804 } | 1822 } |
| 1805 | 1823 |
| 1806 } // namespace wasm | 1824 } // namespace wasm |
| 1807 } // namespace internal | 1825 } // namespace internal |
| 1808 } // namespace v8 | 1826 } // namespace v8 |
| OLD | NEW |