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 #ifndef WASM_RUN_UTILS_H | 5 #ifndef WASM_RUN_UTILS_H |
6 #define WASM_RUN_UTILS_H | 6 #define WASM_RUN_UTILS_H |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // exception. | 44 // exception. |
45 #define CHECK_TRAP32(x) \ | 45 #define CHECK_TRAP32(x) \ |
46 CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) | 46 CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF) |
47 #define CHECK_TRAP64(x) \ | 47 #define CHECK_TRAP64(x) \ |
48 CHECK_EQ(0xdeadbeefdeadbeef, (bit_cast<uint64_t>(x)) & 0xFFFFFFFFFFFFFFFF) | 48 CHECK_EQ(0xdeadbeefdeadbeef, (bit_cast<uint64_t>(x)) & 0xFFFFFFFFFFFFFFFF) |
49 #define CHECK_TRAP(x) CHECK_TRAP32(x) | 49 #define CHECK_TRAP(x) CHECK_TRAP32(x) |
50 | 50 |
51 #define WASM_RUNNER_MAX_NUM_PARAMETERS 4 | 51 #define WASM_RUNNER_MAX_NUM_PARAMETERS 4 |
52 #define WASM_WRAPPER_RETURN_VALUE 8754 | 52 #define WASM_WRAPPER_RETURN_VALUE 8754 |
53 | 53 |
| 54 #define BUILD(r, ...) \ |
| 55 do { \ |
| 56 byte code[] = {__VA_ARGS__}; \ |
| 57 r.Build(code, code + arraysize(code)); \ |
| 58 } while (false) |
| 59 |
54 namespace { | 60 namespace { |
55 using namespace v8::base; | 61 using namespace v8::base; |
56 using namespace v8::internal; | 62 using namespace v8::internal; |
57 using namespace v8::internal::compiler; | 63 using namespace v8::internal::compiler; |
58 using namespace v8::internal::wasm; | 64 using namespace v8::internal::wasm; |
59 | 65 |
60 inline void init_env(FunctionEnv* env, FunctionSig* sig) { | 66 inline void init_env(FunctionEnv* env, FunctionSig* sig) { |
61 env->module = nullptr; | 67 env->module = nullptr; |
62 env->sig = sig; | 68 env->sig = sig; |
63 env->local_i32_count = 0; | 69 env->local_i32_count = 0; |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 if (p1 == MachineType::None()) return 1; | 627 if (p1 == MachineType::None()) return 1; |
622 if (p2 == MachineType::None()) return 2; | 628 if (p2 == MachineType::None()) return 2; |
623 if (p3 == MachineType::None()) return 3; | 629 if (p3 == MachineType::None()) return 3; |
624 return 4; | 630 return 4; |
625 } | 631 } |
626 }; | 632 }; |
627 | 633 |
628 } // namespace | 634 } // namespace |
629 | 635 |
630 #endif | 636 #endif |
OLD | NEW |