Commit dca02f0c authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[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: 's avatarAndreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47926}
parent f162ea92
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
#include "src/wasm/wasm-opcodes.h" #include "src/wasm/wasm-opcodes.h"
#include "src/wasm/wasm-text.h" #include "src/wasm/wasm-text.h"
namespace v8 {
namespace internal {
namespace compiler {
// TODO(titzer): pull WASM_64 up to a common header. // TODO(titzer): pull WASM_64 up to a common header.
#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 #if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64
#define WASM_64 1 #define WASM_64 1
...@@ -49,10 +53,6 @@ ...@@ -49,10 +53,6 @@
V8_Fatal(__FILE__, __LINE__, "Unsupported opcode #%d:%s", (opcode), \ V8_Fatal(__FILE__, __LINE__, "Unsupported opcode #%d:%s", (opcode), \
wasm::WasmOpcodes::OpcodeName(opcode)); wasm::WasmOpcodes::OpcodeName(opcode));
namespace v8 {
namespace internal {
namespace compiler {
namespace { namespace {
void MergeControlToEnd(JSGraph* jsgraph, Node* node) { void MergeControlToEnd(JSGraph* jsgraph, Node* node) {
...@@ -4418,6 +4418,11 @@ MaybeHandle<Code> WasmCompilationUnit::CompileWasmFunction( ...@@ -4418,6 +4418,11 @@ MaybeHandle<Code> WasmCompilationUnit::CompileWasmFunction(
return unit.FinishCompilation(thrower); return unit.FinishCompilation(thrower);
} }
#undef WASM_64
#undef FATAL_UNSUPPORTED_OPCODE
#undef ATOMIC_BINOP_LIST
#undef ATOMIC_TERNARY_LIST
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -338,6 +338,11 @@ CallDescriptor* GetI32WasmCallDescriptorForSimd(Zone* zone, ...@@ -338,6 +338,11 @@ CallDescriptor* GetI32WasmCallDescriptorForSimd(Zone* zone,
MachineRepresentation::kWord32); MachineRepresentation::kWord32);
} }
#undef GP_PARAM_REGISTERS
#undef GP_RETURN_REGISTERS
#undef FP_PARAM_REGISTERS
#undef FP_RETURN_REGISTERS
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -960,7 +960,7 @@ BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, ...@@ -960,7 +960,7 @@ BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
&decoder, start, static_cast<uint32_t>(num_locals), zone); &decoder, start, static_cast<uint32_t>(num_locals), zone);
} }
#undef TRACE #undef BUILD
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
......
...@@ -2415,6 +2415,8 @@ class AsyncCompileJob::FinishModule : public CompileStep { ...@@ -2415,6 +2415,8 @@ class AsyncCompileJob::FinishModule : public CompileStep {
}; };
#undef TRACE #undef TRACE
#undef TRACE_CHAIN
#undef TRACE_COMPILE
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
......
...@@ -265,13 +265,9 @@ class ModuleDecoder : public Decoder { ...@@ -265,13 +265,9 @@ class ModuleDecoder : public Decoder {
} }
// File are named `HASH.{ok,failed}.wasm`. // File are named `HASH.{ok,failed}.wasm`.
size_t hash = base::hash_range(start_, end_); size_t hash = base::hash_range(start_, end_);
char buf[32] = {'\0'}; EmbeddedVector<char, 32> buf;
#if V8_OS_WIN && _MSC_VER < 1900 SNPrintF(buf, "%016zx.%s.wasm", hash, result.ok() ? "ok" : "failed");
#define snprintf sprintf_s std::string name(buf.start());
#endif
snprintf(buf, sizeof(buf) - 1, "%016zx.%s.wasm", hash,
result.ok() ? "ok" : "failed");
std::string name(buf);
if (FILE* wasm_file = base::OS::FOpen((path + name).c_str(), "wb")) { if (FILE* wasm_file = base::OS::FOpen((path + name).c_str(), "wb")) {
if (fwrite(start_, end_ - start_, 1, wasm_file) != 1) { if (fwrite(start_, end_ - start_, 1, wasm_file) != 1) {
OFStream os(stderr); OFStream os(stderr);
...@@ -316,6 +312,7 @@ class ModuleDecoder : public Decoder { ...@@ -316,6 +312,7 @@ class ModuleDecoder : public Decoder {
BYTES(kWasmVersion), BYTES(magic_version)); BYTES(kWasmVersion), BYTES(magic_version));
} }
} }
#undef BYTES
} }
void DecodeSection(SectionCode section_code, Vector<const uint8_t> bytes, void DecodeSection(SectionCode section_code, Vector<const uint8_t> bytes,
......
...@@ -2005,6 +2005,7 @@ class ThreadImpl { ...@@ -2005,6 +2005,7 @@ class ThreadImpl {
return; return;
PAUSE_IF_BREAK_FLAG(AfterReturn); PAUSE_IF_BREAK_FLAG(AfterReturn);
} }
#undef PAUSE_IF_BREAK_FLAG
} }
state_ = WasmInterpreter::PAUSED; state_ = WasmInterpreter::PAUSED;
...@@ -2702,6 +2703,11 @@ WasmInterpreter::HeapObjectsScope::~HeapObjectsScope() { ...@@ -2702,6 +2703,11 @@ WasmInterpreter::HeapObjectsScope::~HeapObjectsScope() {
} }
#undef TRACE #undef TRACE
#undef FOREACH_INTERNAL_OPCODE
#undef WASM_CTYPES
#undef FOREACH_SIMPLE_BINOP
#undef FOREACH_OTHER_BINOP
#undef FOREACH_OTHER_UNOP
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
......
...@@ -590,17 +590,16 @@ void WebAssemblyMemory(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -590,17 +590,16 @@ void WebAssemblyMemory(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(Utils::ToLocal(memory_obj)); args.GetReturnValue().Set(Utils::ToLocal(memory_obj));
} }
#define NAME_OF_WasmMemoryObject "WebAssembly.Memory" constexpr const char* kName_WasmMemoryObject = "WebAssembly.Memory";
#define NAME_OF_WasmModuleObject "WebAssembly.Module" constexpr const char* kName_WasmInstanceObject = "WebAssembly.Instance";
#define NAME_OF_WasmInstanceObject "WebAssembly.Instance" constexpr const char* kName_WasmTableObject = "WebAssembly.Table";
#define NAME_OF_WasmTableObject "WebAssembly.Table"
#define EXTRACT_THIS(var, WasmType) \ #define EXTRACT_THIS(var, WasmType) \
i::Handle<i::WasmType> var; \ i::Handle<i::WasmType> var; \
{ \ { \
i::Handle<i::Object> this_arg = Utils::OpenHandle(*args.This()); \ i::Handle<i::Object> this_arg = Utils::OpenHandle(*args.This()); \
if (!this_arg->Is##WasmType()) { \ if (!this_arg->Is##WasmType()) { \
thrower.TypeError("Receiver is not a " NAME_OF_##WasmType); \ thrower.TypeError("Receiver is not a %s", kName_##WasmType); \
return; \ return; \
} \ } \
var = i::Handle<i::WasmType>::cast(this_arg); \ var = i::Handle<i::WasmType>::cast(this_arg); \
...@@ -966,5 +965,9 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) { ...@@ -966,5 +965,9 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSObject::AddProperty(webassembly, isolate->factory()->RuntimeError_string(), JSObject::AddProperty(webassembly, isolate->factory()->RuntimeError_string(),
runtime_error, attributes); runtime_error, attributes);
} }
#undef ASSIGN
#undef EXTRACT_THIS
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -22,12 +22,6 @@ ...@@ -22,12 +22,6 @@
if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \ if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \
} while (false) } while (false)
// TODO(mostynb@opera.com): this is never used, remove it?
#define TRACE_CHAIN(instance) \
do { \
instance->PrintInstancesChain(); \
} while (false)
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -1525,7 +1519,6 @@ Handle<Code> WasmCompiledModule::CompileLazy( ...@@ -1525,7 +1519,6 @@ Handle<Code> WasmCompiledModule::CompileLazy(
} }
#undef TRACE #undef TRACE
#undef TRACE_CHAIN
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -248,6 +248,34 @@ const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { ...@@ -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) { bool WasmOpcodes::IsPrefixOpcode(WasmOpcode opcode) {
switch (opcode) { switch (opcode) {
#define CHECK_PREFIX(name, opcode) case k##name##Prefix: #define CHECK_PREFIX(name, opcode) case k##name##Prefix:
...@@ -305,23 +333,23 @@ bool IsJSCompatibleSignature(const FunctionSig* sig) { ...@@ -305,23 +333,23 @@ bool IsJSCompatibleSignature(const FunctionSig* sig) {
namespace { namespace {
#define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name, #define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name,
enum WasmOpcodeSig : byte { enum WasmOpcodeSig : byte {
kSigEnum_None, kSigEnum_None,
FOREACH_SIGNATURE(DECLARE_SIG_ENUM) FOREACH_SIGNATURE(DECLARE_SIG_ENUM)
}; };
#undef DECLARE_SIG_ENUM
#define DECLARE_SIG(name, ...) \ #define DECLARE_SIG(name, ...) \
constexpr ValueType kTypes_##name[] = {__VA_ARGS__}; \ constexpr ValueType kTypes_##name[] = {__VA_ARGS__}; \
constexpr FunctionSig kSig_##name( \ constexpr FunctionSig kSig_##name( \
1, static_cast<int>(arraysize(kTypes_##name)) - 1, kTypes_##name); 1, static_cast<int>(arraysize(kTypes_##name)) - 1, kTypes_##name);
FOREACH_SIGNATURE(DECLARE_SIG) FOREACH_SIGNATURE(DECLARE_SIG)
#undef DECLARE_SIG
#define DECLARE_SIG_ENTRY(name, ...) &kSig_##name, #define DECLARE_SIG_ENTRY(name, ...) &kSig_##name,
constexpr const FunctionSig* kSimpleExprSigs[] = { constexpr const FunctionSig* kSimpleExprSigs[] = {
nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)}; nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)};
#undef DECLARE_SIG_ENTRY
// The following constexpr functions are used to initialize the constant arrays // The following constexpr functions are used to initialize the constant arrays
// defined below. They must have exactly one return statement, and no switch. // 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 = ...@@ -375,6 +403,8 @@ CONSTEXPR_IF_NOT_GCC_4 std::array<WasmOpcodeSig, 256> kSimdExprSigTable =
CONSTEXPR_IF_NOT_GCC_4 std::array<WasmOpcodeSig, 256> kAtomicExprSigTable = CONSTEXPR_IF_NOT_GCC_4 std::array<WasmOpcodeSig, 256> kAtomicExprSigTable =
base::make_array<256>(GetAtomicOpcodeSigIndex); base::make_array<256>(GetAtomicOpcodeSigIndex);
#undef CONSTEXPR_IF_NOT_GCC_4
} // namespace } // namespace
FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) { FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) {
......
...@@ -169,6 +169,7 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes, ...@@ -169,6 +169,7 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes,
CASE_CONST(I64, i64, int64_t) CASE_CONST(I64, i64, int64_t)
CASE_CONST(F32, f32, float) CASE_CONST(F32, f32, float)
CASE_CONST(F64, f64, double) CASE_CONST(F64, f64, double)
#undef CASE_CONST
#define CASE_OPCODE(opcode, _, __) case kExpr##opcode: #define CASE_OPCODE(opcode, _, __) case kExpr##opcode:
FOREACH_LOAD_MEM_OPCODE(CASE_OPCODE) FOREACH_LOAD_MEM_OPCODE(CASE_OPCODE)
...@@ -202,6 +203,7 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes, ...@@ -202,6 +203,7 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes,
FOREACH_ATOMIC_OPCODE(CASE_OPCODE) FOREACH_ATOMIC_OPCODE(CASE_OPCODE)
os << WasmOpcodes::OpcodeName(opcode); os << WasmOpcodes::OpcodeName(opcode);
break; break;
#undef CASE_OPCODE
default: default:
UNREACHABLE(); UNREACHABLE();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment