[wasm] [cleanup] undef all defined macros in cc files
This is a cleanup for a presubmit check that might get enabled soon: https://chromium-review.googlesource.com/c/v8/v8/+/657104 R=ahaas@chromium.org CC=mstarzinger@chromium.org Change-Id: Id431f2d4e8fcbb88a777b63e3fb136fa8ceac70a Reviewed-on: https://chromium-review.googlesource.com/657400 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#47926}
This commit is contained in:
parent
f162ea9249
commit
dca02f0c28
@ -38,6 +38,10 @@
|
||||
#include "src/wasm/wasm-opcodes.h"
|
||||
#include "src/wasm/wasm-text.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
// TODO(titzer): pull WASM_64 up to a common header.
|
||||
#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64
|
||||
#define WASM_64 1
|
||||
@ -49,10 +53,6 @@
|
||||
V8_Fatal(__FILE__, __LINE__, "Unsupported opcode #%d:%s", (opcode), \
|
||||
wasm::WasmOpcodes::OpcodeName(opcode));
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
namespace {
|
||||
|
||||
void MergeControlToEnd(JSGraph* jsgraph, Node* node) {
|
||||
@ -4418,6 +4418,11 @@ MaybeHandle<Code> WasmCompilationUnit::CompileWasmFunction(
|
||||
return unit.FinishCompilation(thrower);
|
||||
}
|
||||
|
||||
#undef WASM_64
|
||||
#undef FATAL_UNSUPPORTED_OPCODE
|
||||
#undef ATOMIC_BINOP_LIST
|
||||
#undef ATOMIC_TERNARY_LIST
|
||||
|
||||
} // namespace compiler
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -338,6 +338,11 @@ CallDescriptor* GetI32WasmCallDescriptorForSimd(Zone* zone,
|
||||
MachineRepresentation::kWord32);
|
||||
}
|
||||
|
||||
#undef GP_PARAM_REGISTERS
|
||||
#undef GP_RETURN_REGISTERS
|
||||
#undef FP_PARAM_REGISTERS
|
||||
#undef FP_RETURN_REGISTERS
|
||||
|
||||
} // namespace compiler
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -960,7 +960,7 @@ BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
|
||||
&decoder, start, static_cast<uint32_t>(num_locals), zone);
|
||||
}
|
||||
|
||||
#undef TRACE
|
||||
#undef BUILD
|
||||
|
||||
} // namespace wasm
|
||||
} // namespace internal
|
||||
|
@ -2415,6 +2415,8 @@ class AsyncCompileJob::FinishModule : public CompileStep {
|
||||
};
|
||||
|
||||
#undef TRACE
|
||||
#undef TRACE_CHAIN
|
||||
#undef TRACE_COMPILE
|
||||
|
||||
} // namespace wasm
|
||||
} // namespace internal
|
||||
|
@ -265,13 +265,9 @@ class ModuleDecoder : public Decoder {
|
||||
}
|
||||
// File are named `HASH.{ok,failed}.wasm`.
|
||||
size_t hash = base::hash_range(start_, end_);
|
||||
char buf[32] = {'\0'};
|
||||
#if V8_OS_WIN && _MSC_VER < 1900
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
snprintf(buf, sizeof(buf) - 1, "%016zx.%s.wasm", hash,
|
||||
result.ok() ? "ok" : "failed");
|
||||
std::string name(buf);
|
||||
EmbeddedVector<char, 32> buf;
|
||||
SNPrintF(buf, "%016zx.%s.wasm", hash, result.ok() ? "ok" : "failed");
|
||||
std::string name(buf.start());
|
||||
if (FILE* wasm_file = base::OS::FOpen((path + name).c_str(), "wb")) {
|
||||
if (fwrite(start_, end_ - start_, 1, wasm_file) != 1) {
|
||||
OFStream os(stderr);
|
||||
@ -316,6 +312,7 @@ class ModuleDecoder : public Decoder {
|
||||
BYTES(kWasmVersion), BYTES(magic_version));
|
||||
}
|
||||
}
|
||||
#undef BYTES
|
||||
}
|
||||
|
||||
void DecodeSection(SectionCode section_code, Vector<const uint8_t> bytes,
|
||||
|
@ -2005,6 +2005,7 @@ class ThreadImpl {
|
||||
return;
|
||||
PAUSE_IF_BREAK_FLAG(AfterReturn);
|
||||
}
|
||||
#undef PAUSE_IF_BREAK_FLAG
|
||||
}
|
||||
|
||||
state_ = WasmInterpreter::PAUSED;
|
||||
@ -2702,6 +2703,11 @@ WasmInterpreter::HeapObjectsScope::~HeapObjectsScope() {
|
||||
}
|
||||
|
||||
#undef TRACE
|
||||
#undef FOREACH_INTERNAL_OPCODE
|
||||
#undef WASM_CTYPES
|
||||
#undef FOREACH_SIMPLE_BINOP
|
||||
#undef FOREACH_OTHER_BINOP
|
||||
#undef FOREACH_OTHER_UNOP
|
||||
|
||||
} // namespace wasm
|
||||
} // namespace internal
|
||||
|
@ -590,17 +590,16 @@ void WebAssemblyMemory(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
args.GetReturnValue().Set(Utils::ToLocal(memory_obj));
|
||||
}
|
||||
|
||||
#define NAME_OF_WasmMemoryObject "WebAssembly.Memory"
|
||||
#define NAME_OF_WasmModuleObject "WebAssembly.Module"
|
||||
#define NAME_OF_WasmInstanceObject "WebAssembly.Instance"
|
||||
#define NAME_OF_WasmTableObject "WebAssembly.Table"
|
||||
constexpr const char* kName_WasmMemoryObject = "WebAssembly.Memory";
|
||||
constexpr const char* kName_WasmInstanceObject = "WebAssembly.Instance";
|
||||
constexpr const char* kName_WasmTableObject = "WebAssembly.Table";
|
||||
|
||||
#define EXTRACT_THIS(var, WasmType) \
|
||||
i::Handle<i::WasmType> var; \
|
||||
{ \
|
||||
i::Handle<i::Object> this_arg = Utils::OpenHandle(*args.This()); \
|
||||
if (!this_arg->Is##WasmType()) { \
|
||||
thrower.TypeError("Receiver is not a " NAME_OF_##WasmType); \
|
||||
thrower.TypeError("Receiver is not a %s", kName_##WasmType); \
|
||||
return; \
|
||||
} \
|
||||
var = i::Handle<i::WasmType>::cast(this_arg); \
|
||||
@ -966,5 +965,9 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
|
||||
JSObject::AddProperty(webassembly, isolate->factory()->RuntimeError_string(),
|
||||
runtime_error, attributes);
|
||||
}
|
||||
|
||||
#undef ASSIGN
|
||||
#undef EXTRACT_THIS
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -22,12 +22,6 @@
|
||||
if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \
|
||||
} while (false)
|
||||
|
||||
// TODO(mostynb@opera.com): this is never used, remove it?
|
||||
#define TRACE_CHAIN(instance) \
|
||||
do { \
|
||||
instance->PrintInstancesChain(); \
|
||||
} while (false)
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
@ -1525,7 +1519,6 @@ Handle<Code> WasmCompiledModule::CompileLazy(
|
||||
}
|
||||
|
||||
#undef TRACE
|
||||
#undef TRACE_CHAIN
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -248,6 +248,34 @@ const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) {
|
||||
}
|
||||
}
|
||||
|
||||
#undef CASE_OP
|
||||
#undef CASE_I32_OP
|
||||
#undef CASE_I64_OP
|
||||
#undef CASE_F32_OP
|
||||
#undef CASE_F64_OP
|
||||
#undef CASE_F32x4_OP
|
||||
#undef CASE_I32x4_OP
|
||||
#undef CASE_I16x8_OP
|
||||
#undef CASE_I8x16_OP
|
||||
#undef CASE_S128_OP
|
||||
#undef CASE_S32x4_OP
|
||||
#undef CASE_S16x8_OP
|
||||
#undef CASE_S8x16_OP
|
||||
#undef CASE_S1x4_OP
|
||||
#undef CASE_S1x8_OP
|
||||
#undef CASE_S1x16_OP
|
||||
#undef CASE_INT_OP
|
||||
#undef CASE_FLOAT_OP
|
||||
#undef CASE_ALL_OP
|
||||
#undef CASE_SIMD_OP
|
||||
#undef CASE_SIMDI_OP
|
||||
#undef CASE_SIGN_OP
|
||||
#undef CASE_UNSIGNED_OP
|
||||
#undef CASE_ALL_SIGN_OP
|
||||
#undef CASE_CONVERT_OP
|
||||
#undef CASE_L32_OP
|
||||
#undef CASE_U32_OP
|
||||
|
||||
bool WasmOpcodes::IsPrefixOpcode(WasmOpcode opcode) {
|
||||
switch (opcode) {
|
||||
#define CHECK_PREFIX(name, opcode) case k##name##Prefix:
|
||||
@ -305,23 +333,23 @@ bool IsJSCompatibleSignature(const FunctionSig* sig) {
|
||||
namespace {
|
||||
|
||||
#define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name,
|
||||
|
||||
enum WasmOpcodeSig : byte {
|
||||
kSigEnum_None,
|
||||
FOREACH_SIGNATURE(DECLARE_SIG_ENUM)
|
||||
};
|
||||
#undef DECLARE_SIG_ENUM
|
||||
|
||||
#define DECLARE_SIG(name, ...) \
|
||||
constexpr ValueType kTypes_##name[] = {__VA_ARGS__}; \
|
||||
constexpr FunctionSig kSig_##name( \
|
||||
1, static_cast<int>(arraysize(kTypes_##name)) - 1, kTypes_##name);
|
||||
|
||||
FOREACH_SIGNATURE(DECLARE_SIG)
|
||||
#undef DECLARE_SIG
|
||||
|
||||
#define DECLARE_SIG_ENTRY(name, ...) &kSig_##name,
|
||||
|
||||
constexpr const FunctionSig* kSimpleExprSigs[] = {
|
||||
nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)};
|
||||
#undef DECLARE_SIG_ENTRY
|
||||
|
||||
// The following constexpr functions are used to initialize the constant arrays
|
||||
// defined below. They must have exactly one return statement, and no switch.
|
||||
@ -375,6 +403,8 @@ CONSTEXPR_IF_NOT_GCC_4 std::array<WasmOpcodeSig, 256> kSimdExprSigTable =
|
||||
CONSTEXPR_IF_NOT_GCC_4 std::array<WasmOpcodeSig, 256> kAtomicExprSigTable =
|
||||
base::make_array<256>(GetAtomicOpcodeSigIndex);
|
||||
|
||||
#undef CONSTEXPR_IF_NOT_GCC_4
|
||||
|
||||
} // namespace
|
||||
|
||||
FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) {
|
||||
|
@ -169,6 +169,7 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes,
|
||||
CASE_CONST(I64, i64, int64_t)
|
||||
CASE_CONST(F32, f32, float)
|
||||
CASE_CONST(F64, f64, double)
|
||||
#undef CASE_CONST
|
||||
|
||||
#define CASE_OPCODE(opcode, _, __) case kExpr##opcode:
|
||||
FOREACH_LOAD_MEM_OPCODE(CASE_OPCODE)
|
||||
@ -202,6 +203,7 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes,
|
||||
FOREACH_ATOMIC_OPCODE(CASE_OPCODE)
|
||||
os << WasmOpcodes::OpcodeName(opcode);
|
||||
break;
|
||||
#undef CASE_OPCODE
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
Loading…
Reference in New Issue
Block a user