Commit 99de47f1 authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[cleanup] Remove redundant wasm:: namespace prefixes

The wasm/ directory is inconsistent in many places, often within the
same file. For all code that exists in a v8::internal::wasm namespace,
this CL removes any wasm:: qualifiers, which is especially helpful
since most types are already Wasm-named, such as WasmCode, WasmModule,
etc. Namespace qualifiers are redundant inside the wasm:: namespace and
thus go against the main point of using namespaces. Removing the
qualifiers for non Wasm-named classes also makes the code somewhat more
future-proof, should we move some things that are not really WASM-specific
(such as ErrorThrower and Decoder) into a higher namespace.

R=clemensh@chromium.org,mstarzinger@chromium.org

Change-Id: Ibff3e1e93c64c12dcb53c46c03d1bfb2fb0b7586
Reviewed-on: https://chromium-review.googlesource.com/1160232
Commit-Queue: Ben Titzer <titzer@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54862}
parent 0cd263ac
......@@ -446,7 +446,7 @@ void LiftoffAssembler::SpillAllRegisters() {
cache_state_.reset_used_registers();
}
void LiftoffAssembler::PrepareCall(wasm::FunctionSig* sig,
void LiftoffAssembler::PrepareCall(FunctionSig* sig,
compiler::CallDescriptor* call_descriptor,
Register* target,
LiftoffRegister* target_instance) {
......@@ -555,7 +555,7 @@ void LiftoffAssembler::PrepareCall(wasm::FunctionSig* sig,
}
}
void LiftoffAssembler::FinishCall(wasm::FunctionSig* sig,
void LiftoffAssembler::FinishCall(FunctionSig* sig,
compiler::CallDescriptor* call_descriptor) {
const size_t return_count = sig->return_count();
if (return_count != 0) {
......
......@@ -314,11 +314,11 @@ class LiftoffAssembler : public TurboAssembler {
// Load parameters into the right registers / stack slots for the call.
// Move {*target} into another register if needed and update {*target} to that
// register, or {no_reg} if target was spilled to the stack.
void PrepareCall(wasm::FunctionSig*, compiler::CallDescriptor*,
void PrepareCall(FunctionSig*, compiler::CallDescriptor*,
Register* target = nullptr,
LiftoffRegister* target_instance = nullptr);
// Process return values of the call.
void FinishCall(wasm::FunctionSig*, compiler::CallDescriptor*);
void FinishCall(FunctionSig*, compiler::CallDescriptor*);
// Move {src} into {dst}. {src} and {dst} must be different.
void Move(LiftoffRegister dst, LiftoffRegister src, ValueType);
......@@ -540,13 +540,13 @@ class LiftoffAssembler : public TurboAssembler {
// this is the return value of the C function, stored in {rets[0]}. Further
// outputs (specified in {sig->returns()}) are read from the buffer and stored
// in the remaining {rets} registers.
inline void CallC(wasm::FunctionSig* sig, const LiftoffRegister* args,
inline void CallC(FunctionSig* sig, const LiftoffRegister* args,
const LiftoffRegister* rets, ValueType out_argument_type,
int stack_bytes, ExternalReference ext_ref);
inline void CallNativeWasmCode(Address addr);
// Indirect call: If {target == no_reg}, then pop the target from the stack.
inline void CallIndirect(wasm::FunctionSig* sig,
inline void CallIndirect(FunctionSig* sig,
compiler::CallDescriptor* call_descriptor,
Register target);
inline void CallRuntimeStub(WasmCode::RuntimeStubId sid);
......
This diff is collapsed.
......@@ -21,7 +21,7 @@ class LiftoffCompilationUnit final {
: wasm_unit_(wasm_unit) {}
bool ExecuteCompilation();
wasm::WasmCode* FinishCompilation(wasm::ErrorThrower*);
WasmCode* FinishCompilation(ErrorThrower*);
private:
WasmCompilationUnit* const wasm_unit_;
......
......@@ -1214,7 +1214,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
public:
template <typename... InterfaceArgs>
WasmFullDecoder(Zone* zone, const wasm::WasmModule* module,
WasmFullDecoder(Zone* zone, const WasmModule* module,
const FunctionBody& body, InterfaceArgs&&... interface_args)
: WasmDecoder<validate>(module, body.sig, body.start, body.end,
body.offset),
......@@ -1301,7 +1301,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
return local_type_vec_[index];
}
inline wasm::WasmCodePosition position() {
inline WasmCodePosition position() {
int offset = static_cast<int>(this->pc_ - this->start_);
DCHECK_EQ(this->pc_ - this->start_, offset); // overflows cannot happen
return offset;
......@@ -2476,14 +2476,13 @@ class WasmFullDecoder : public WasmDecoder<validate> {
class EmptyInterface {
public:
static constexpr wasm::Decoder::ValidateFlag validate =
wasm::Decoder::kValidate;
static constexpr Decoder::ValidateFlag validate = Decoder::kValidate;
using Value = ValueBase;
using Control = ControlBase<Value>;
using Decoder = WasmFullDecoder<validate, EmptyInterface>;
using FullDecoder = WasmFullDecoder<validate, EmptyInterface>;
#define DEFINE_EMPTY_CALLBACK(name, ...) \
void name(Decoder* decoder, ##__VA_ARGS__) {}
void name(FullDecoder* decoder, ##__VA_ARGS__) {}
INTERFACE_FUNCTIONS(DEFINE_EMPTY_CALLBACK)
#undef DEFINE_EMPTY_CALLBACK
};
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ const char* GetCompilationModeAsString(
UNREACHABLE();
}
void RecordStats(const wasm::WasmCode* code, Counters* counters) {
void RecordStats(const WasmCode* code, Counters* counters) {
counters->wasm_generated_code_size()->Increment(
static_cast<int>(code->instructions().size()));
counters->wasm_reloc_size()->Increment(
......@@ -42,10 +42,12 @@ WasmCompilationUnit::GetDefaultCompilationMode() {
return FLAG_liftoff ? CompilationMode::kLiftoff : CompilationMode::kTurbofan;
}
WasmCompilationUnit::WasmCompilationUnit(
WasmEngine* wasm_engine, ModuleEnv* env, wasm::NativeModule* native_module,
wasm::FunctionBody body, wasm::WasmName name, int index, Counters* counters,
CompilationMode mode)
WasmCompilationUnit::WasmCompilationUnit(WasmEngine* wasm_engine,
ModuleEnv* env,
NativeModule* native_module,
FunctionBody body, WasmName name,
int index, Counters* counters,
CompilationMode mode)
: env_(env),
wasm_engine_(wasm_engine),
func_body_(body),
......@@ -97,9 +99,8 @@ void WasmCompilationUnit::ExecuteCompilation() {
}
}
wasm::WasmCode* WasmCompilationUnit::FinishCompilation(
wasm::ErrorThrower* thrower) {
wasm::WasmCode* ret;
WasmCode* WasmCompilationUnit::FinishCompilation(ErrorThrower* thrower) {
WasmCode* ret;
switch (mode_) {
case CompilationMode::kLiftoff:
ret = liftoff_unit_->FinishCompilation(thrower);
......@@ -139,15 +140,13 @@ void WasmCompilationUnit::SwitchMode(CompilationMode new_mode) {
}
// static
wasm::WasmCode* WasmCompilationUnit::CompileWasmFunction(
wasm::NativeModule* native_module, wasm::ErrorThrower* thrower,
Isolate* isolate, ModuleEnv* env, const wasm::WasmFunction* function,
CompilationMode mode) {
WasmCode* WasmCompilationUnit::CompileWasmFunction(
NativeModule* native_module, ErrorThrower* thrower, Isolate* isolate,
ModuleEnv* env, const WasmFunction* function, CompilationMode mode) {
ModuleWireBytes wire_bytes(native_module->wire_bytes());
wasm::FunctionBody function_body{
function->sig, function->code.offset(),
wire_bytes.start() + function->code.offset(),
wire_bytes.start() + function->code.end_offset()};
FunctionBody function_body{function->sig, function->code.offset(),
wire_bytes.start() + function->code.offset(),
wire_bytes.start() + function->code.end_offset()};
WasmCompilationUnit unit(isolate->wasm_engine(), env, native_module,
function_body,
......
......@@ -67,12 +67,11 @@ struct ModuleEnv {
: module(module),
use_trap_handler(use_trap_handler),
runtime_exception_support(runtime_exception_support),
min_memory_size(
module ? module->initial_pages * uint64_t{wasm::kWasmPageSize} : 0),
max_memory_size(
module && module->has_maximum_pages
? (module->maximum_pages * uint64_t{wasm::kWasmPageSize})
: wasm::kSpecMaxWasmMemoryBytes),
min_memory_size(module ? module->initial_pages * uint64_t{kWasmPageSize}
: 0),
max_memory_size(module && module->has_maximum_pages
? (module->maximum_pages * uint64_t{kWasmPageSize})
: kSpecMaxWasmMemoryBytes),
lower_simd(lower_simd) {}
};
......@@ -86,21 +85,21 @@ class WasmCompilationUnit final {
// typically means to hold a std::shared_ptr<Counters>).
// If used exclusively from a foreground thread, Isolate::counters() may be
// used by callers to pass Counters.
WasmCompilationUnit(WasmEngine* wasm_engine, ModuleEnv*, wasm::NativeModule*,
wasm::FunctionBody, wasm::WasmName, int index, Counters*,
WasmCompilationUnit(WasmEngine* wasm_engine, ModuleEnv*, NativeModule*,
FunctionBody, WasmName, int index, Counters*,
CompilationMode = GetDefaultCompilationMode());
~WasmCompilationUnit();
void ExecuteCompilation();
wasm::WasmCode* FinishCompilation(wasm::ErrorThrower* thrower);
WasmCode* FinishCompilation(ErrorThrower* thrower);
static wasm::WasmCode* CompileWasmFunction(
wasm::NativeModule* native_module, wasm::ErrorThrower* thrower,
Isolate* isolate, ModuleEnv* env, const wasm::WasmFunction* function,
static WasmCode* CompileWasmFunction(
NativeModule* native_module, ErrorThrower* thrower, Isolate* isolate,
ModuleEnv* env, const WasmFunction* function,
CompilationMode = GetDefaultCompilationMode());
wasm::NativeModule* native_module() const { return native_module_; }
NativeModule* native_module() const { return native_module_; }
CompilationMode mode() const { return mode_; }
private:
......@@ -109,11 +108,11 @@ class WasmCompilationUnit final {
ModuleEnv* env_;
WasmEngine* wasm_engine_;
wasm::FunctionBody func_body_;
wasm::WasmName func_name_;
FunctionBody func_body_;
WasmName func_name_;
Counters* counters_;
int func_index_;
wasm::NativeModule* native_module_;
NativeModule* native_module_;
CompilationMode mode_;
// LiftoffCompilationUnit, set if {mode_ == kLiftoff}.
std::unique_ptr<LiftoffCompilationUnit> liftoff_unit_;
......
......@@ -167,13 +167,14 @@ namespace {
class JSToWasmWrapperCache {
public:
Handle<Code> GetOrCompileJSToWasmWrapper(
Isolate* isolate, const wasm::NativeModule* native_module,
uint32_t func_index, wasm::UseTrapHandler use_trap_handler) {
const wasm::WasmModule* module = native_module->module();
const wasm::WasmFunction* func = &module->functions[func_index];
Handle<Code> GetOrCompileJSToWasmWrapper(Isolate* isolate,
const NativeModule* native_module,
uint32_t func_index,
UseTrapHandler use_trap_handler) {
const WasmModule* module = native_module->module();
const WasmFunction* func = &module->functions[func_index];
bool is_import = func_index < module->num_imported_functions;
std::pair<bool, wasm::FunctionSig> key(is_import, *func->sig);
std::pair<bool, FunctionSig> key(is_import, *func->sig);
Handle<Code>& cached = cache_[key];
if (!cached.is_null()) return cached;
......@@ -188,7 +189,7 @@ class JSToWasmWrapperCache {
private:
// We generate different code for calling imports than calling wasm functions
// in this module. Both are cached separately.
using CacheKey = std::pair<bool, wasm::FunctionSig>;
using CacheKey = std::pair<bool, FunctionSig>;
std::unordered_map<CacheKey, Handle<Code>, base::hash<CacheKey>> cache_;
};
......@@ -234,7 +235,7 @@ class InstanceBuilder {
JSToWasmWrapperCache js_to_wasm_cache_;
std::vector<SanitizedImport> sanitized_imports_;
wasm::UseTrapHandler use_trap_handler() const {
UseTrapHandler use_trap_handler() const {
return module_object_->native_module()->use_trap_handler() ? kUseTrapHandler
: kNoTrapHandler;
}
......@@ -325,9 +326,8 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject(
return {};
}
wasm::WasmCode* LazyCompileFunction(Isolate* isolate,
NativeModule* native_module,
int func_index) {
WasmCode* LazyCompileFunction(Isolate* isolate, NativeModule* native_module,
int func_index) {
base::ElapsedTimer compilation_timer;
DCHECK(!native_module->has_code(static_cast<uint32_t>(func_index)));
......@@ -358,9 +358,9 @@ wasm::WasmCode* LazyCompileFunction(Isolate* isolate,
WasmCompilationUnit unit(isolate->wasm_engine(), module_env, native_module,
body, func_name, func_index, isolate->counters());
unit.ExecuteCompilation();
wasm::WasmCode* wasm_code = unit.FinishCompilation(&thrower);
WasmCode* wasm_code = unit.FinishCompilation(&thrower);
if (wasm::WasmCode::ShouldBeLogged(isolate)) wasm_code->LogCode(isolate);
if (WasmCode::ShouldBeLogged(isolate)) wasm_code->LogCode(isolate);
// If there is a pending error, something really went wrong. The module was
// verified before starting execution with lazy compilation.
......@@ -392,8 +392,7 @@ Address CompileLazy(Isolate* isolate, NativeModule* native_module,
NativeModuleModificationScope native_module_modification_scope(native_module);
wasm::WasmCode* result =
LazyCompileFunction(isolate, native_module, func_index);
WasmCode* result = LazyCompileFunction(isolate, native_module, func_index);
DCHECK_NOT_NULL(result);
DCHECK_EQ(func_index, result->index());
......@@ -485,8 +484,7 @@ class CompilationUnitBuilder {
return base::make_unique<WasmCompilationUnit>(
compilation_state_->wasm_engine(), compilation_state_->module_env(),
native_module_,
wasm::FunctionBody{function->sig, buffer_offset, bytes.begin(),
bytes.end()},
FunctionBody{function->sig, buffer_offset, bytes.begin(), bytes.end()},
name, function->func_index,
compilation_state_->isolate()->async_counters().get(), mode);
}
......@@ -547,7 +545,7 @@ void FinishCompilationUnits(CompilationState* compilation_state,
std::unique_ptr<WasmCompilationUnit> unit =
compilation_state->GetNextExecutedUnit();
if (unit == nullptr) break;
wasm::WasmCode* result = unit->FinishCompilation(thrower);
WasmCode* result = unit->FinishCompilation(thrower);
if (thrower->error()) {
compilation_state->Abort();
......@@ -658,7 +656,7 @@ void CompileSequentially(Isolate* isolate, NativeModule* native_module,
if (func.imported) continue; // Imports are compiled at instantiation time.
// Compile the function.
wasm::WasmCode* code = WasmCompilationUnit::CompileWasmFunction(
WasmCode* code = WasmCompilationUnit::CompileWasmFunction(
native_module, thrower, isolate, module_env, &func);
if (code == nullptr) {
TruncatedUserString<> name(wire_bytes.GetName(&func, module));
......@@ -779,7 +777,7 @@ class FinishCompileTask : public CancelableTask {
}
ErrorThrower thrower(compilation_state_->isolate(), "AsyncCompile");
wasm::WasmCode* result = unit->FinishCompilation(&thrower);
WasmCode* result = unit->FinishCompilation(&thrower);
if (thrower.error()) {
DCHECK_NULL(result);
......@@ -796,7 +794,7 @@ class FinishCompileTask : public CancelableTask {
DCHECK_EQ(CompileMode::kTiering, compilation_state_->compile_mode());
DCHECK(!result->is_liftoff());
if (wasm::WasmCode::ShouldBeLogged(isolate)) result->LogCode(isolate);
if (WasmCode::ShouldBeLogged(isolate)) result->LogCode(isolate);
}
// Update the compilation state, and possibly notify
......@@ -1011,11 +1009,11 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
//--------------------------------------------------------------------------
// Create the WebAssembly.Instance object.
//--------------------------------------------------------------------------
wasm::NativeModule* native_module = module_object_->native_module();
NativeModule* native_module = module_object_->native_module();
TRACE("New module instantiation for %p\n", native_module);
Handle<WasmInstanceObject> instance =
WasmInstanceObject::New(isolate_, module_object_);
wasm::NativeModuleModificationScope native_modification_scope(native_module);
NativeModuleModificationScope native_modification_scope(native_module);
//--------------------------------------------------------------------------
// Set up the globals for the new instance.
......@@ -1491,7 +1489,7 @@ int InstanceBuilder::ProcessImports(Handle<WasmInstanceObject> instance) {
RecordStats(*wrapper_code, isolate_->counters());
WasmCode* wasm_code = native_module->AddCodeCopy(
wrapper_code, wasm::WasmCode::kWasmToJsWrapper, func_index);
wrapper_code, WasmCode::kWasmToJsWrapper, func_index);
ImportedFunctionEntry entry(instance, func_index);
entry.set_wasm_to_js(*js_receiver, wasm_code);
}
......@@ -2933,7 +2931,7 @@ void CompileJsToWasmWrappers(Isolate* isolate,
int wrapper_index = 0;
Handle<FixedArray> export_wrappers(module_object->export_wrappers(), isolate);
NativeModule* native_module = module_object->native_module();
wasm::UseTrapHandler use_trap_handler =
UseTrapHandler use_trap_handler =
native_module->use_trap_handler() ? kUseTrapHandler : kNoTrapHandler;
const WasmModule* module = native_module->module();
for (auto exp : module->export_table) {
......
......@@ -451,8 +451,8 @@ class ModuleDecoderImpl : public Decoder {
});
WasmImport* import = &module_->import_table.back();
const byte* pos = pc_;
import->module_name = consume_string(true, "module name");
import->field_name = consume_string(true, "field name");
import->module_name = consume_string(*this, true, "module name");
import->field_name = consume_string(*this, true, "field name");
import->kind =
static_cast<ImportExportKindCode>(consume_u8("import kind"));
switch (import->kind) {
......@@ -615,7 +615,7 @@ class ModuleDecoderImpl : public Decoder {
});
WasmExport* exp = &module_->export_table.back();
exp->name = consume_string(true, "field name");
exp->name = consume_string(*this, true, "field name");
const byte* pos = pc();
exp->kind = static_cast<ImportExportKindCode>(consume_u8("export kind"));
......@@ -816,7 +816,7 @@ class ModuleDecoderImpl : public Decoder {
// Decode module name, ignore the rest.
// Function and local names will be decoded when needed.
if (name_type == NameSectionKindCode::kModule) {
WireBytesRef name = wasm::consume_string(inner, false, "module name");
WireBytesRef name = consume_string(inner, false, "module name");
if (inner.ok() && validate_utf8(&inner, name)) module_->name = name;
} else {
inner.consume_bytes(name_payload_len, "name subsection payload");
......@@ -1069,10 +1069,6 @@ class ModuleDecoderImpl : public Decoder {
}
}
WireBytesRef consume_string(bool validate_utf8, const char* name) {
return wasm::consume_string(*this, validate_utf8, name);
}
uint32_t consume_sig_index(WasmModule* module, FunctionSig** sig) {
const byte* pos = pc_;
uint32_t sig_index = consume_u32v("signature index");
......@@ -1464,7 +1460,7 @@ ModuleResult ModuleDecoder::FinishDecoding(bool verify_functions) {
SectionCode ModuleDecoder::IdentifyUnknownSection(Decoder& decoder,
const byte* end) {
WireBytesRef string = wasm::consume_string(decoder, true, "section name");
WireBytesRef string = consume_string(decoder, true, "section name");
if (decoder.failed() || decoder.pc() > end) {
return kUnknownSectionCode;
}
......@@ -1645,7 +1641,7 @@ void DecodeFunctionNames(const byte* module_start, const byte* module_end,
for (; decoder.ok() && functions_count > 0; --functions_count) {
uint32_t function_index = decoder.consume_u32v("function index");
WireBytesRef name = wasm::consume_string(decoder, false, "function name");
WireBytesRef name = consume_string(decoder, false, "function name");
// Be lenient with errors in the name section: Ignore non-UTF8 names. You
// can even assign to the same function multiple times (last valid one
......@@ -1688,7 +1684,7 @@ void DecodeLocalNames(const byte* module_start, const byte* module_end,
uint32_t num_names = decoder.consume_u32v("namings count");
for (uint32_t k = 0; k < num_names; ++k) {
uint32_t local_index = decoder.consume_u32v("local index");
WireBytesRef name = wasm::consume_string(decoder, true, "local name");
WireBytesRef name = consume_string(decoder, true, "local name");
if (!decoder.ok()) break;
if (local_index > kMaxInt) continue;
func_names.max_local_index =
......
......@@ -117,7 +117,7 @@ void WasmCode::set_trap_handler_index(size_t value) {
void WasmCode::RegisterTrapHandlerData() {
DCHECK(!HasTrapHandlerIndex());
if (kind() != wasm::WasmCode::kFunction) return;
if (kind() != WasmCode::kFunction) return;
Address base = instruction_start();
......@@ -338,11 +338,11 @@ void NativeModule::ReserveCodeTableForTesting(uint32_t max_functions) {
}
void NativeModule::LogWasmCodes(Isolate* isolate) {
if (!wasm::WasmCode::ShouldBeLogged(isolate)) return;
if (!WasmCode::ShouldBeLogged(isolate)) return;
// TODO(titzer): we skip the logging of the import wrappers
// here, but they should be included somehow.
for (wasm::WasmCode* code : code_table()) {
for (WasmCode* code : code_table()) {
if (code != nullptr) code->LogCode(isolate);
}
}
......@@ -592,7 +592,7 @@ std::vector<WasmCode*> NativeModule::SnapshotCodeTable() const {
base::LockGuard<base::Mutex> lock(&allocation_mutex_);
std::vector<WasmCode*> result;
result.reserve(code_table().size());
for (wasm::WasmCode* code : code_table()) result.push_back(code);
for (WasmCode* code : code_table()) result.push_back(code);
return result;
}
......
......@@ -72,8 +72,7 @@ MaybeHandle<String> GetLocalName(Isolate* isolate,
if (!debug_info->has_locals_names()) {
Handle<WasmModuleObject> module_object(
debug_info->wasm_instance()->module_object(), isolate);
Handle<FixedArray> locals_names =
wasm::DecodeLocalNames(isolate, module_object);
Handle<FixedArray> locals_names = DecodeLocalNames(isolate, module_object);
debug_info->set_locals_names(*locals_names);
}
......@@ -290,7 +289,7 @@ class InterpreterHandle {
Handle<WasmInstanceObject> instance_obj(frame->wasm_instance(), isolate_);
// Check that this is indeed the instance which is connected to this
// interpreter.
DCHECK_EQ(this, Managed<wasm::InterpreterHandle>::cast(
DCHECK_EQ(this, Managed<InterpreterHandle>::cast(
instance_obj->debug_info()->interpreter_handle())
->raw());
return instance_obj;
......@@ -406,7 +405,7 @@ class InterpreterHandle {
return interpreter()->GetThread(0)->NumInterpretedCalls();
}
Handle<JSObject> GetGlobalScopeObject(wasm::InterpretedFrame* frame,
Handle<JSObject> GetGlobalScopeObject(InterpretedFrame* frame,
Handle<WasmDebugInfo> debug_info) {
Isolate* isolate = isolate_;
Handle<WasmInstanceObject> instance(debug_info->wasm_instance(), isolate);
......@@ -430,7 +429,7 @@ class InterpreterHandle {
return global_scope_object;
}
Handle<JSObject> GetLocalScopeObject(wasm::InterpretedFrame* frame,
Handle<JSObject> GetLocalScopeObject(InterpretedFrame* frame,
Handle<WasmDebugInfo> debug_info) {
Isolate* isolate = isolate_;
......
......@@ -120,8 +120,7 @@ void WasmEngine::AsyncCompile(
// Make a copy of the wire bytes to avoid concurrent modification.
std::unique_ptr<uint8_t[]> copy(new uint8_t[bytes.length()]);
memcpy(copy.get(), bytes.start(), bytes.length());
i::wasm::ModuleWireBytes bytes_copy(copy.get(),
copy.get() + bytes.length());
ModuleWireBytes bytes_copy(copy.get(), copy.get() + bytes.length());
module_object = SyncCompile(isolate, &thrower, bytes_copy);
} else {
// The wire bytes are not shared, OK to use them directly.
......
......@@ -1419,7 +1419,7 @@ class ThreadImpl {
len = 1 + imm.length;
if (FLAG_wasm_trace_memory) {
wasm::MemoryTracingInfo info(imm.offset + index, false, rep);
MemoryTracingInfo info(imm.offset + index, false, rep);
TraceMemoryOperation(ExecutionEngine::kInterpreter, &info,
code->function->func_index, static_cast<int>(pc),
instance_object_->memory_start());
......@@ -1445,7 +1445,7 @@ class ThreadImpl {
len = 1 + imm.length;
if (FLAG_wasm_trace_memory) {
wasm::MemoryTracingInfo info(imm.offset + index, true, rep);
MemoryTracingInfo info(imm.offset + index, true, rep);
TraceMemoryOperation(ExecutionEngine::kInterpreter, &info,
code->function->func_index, static_cast<int>(pc),
instance_object_->memory_start());
......@@ -2122,9 +2122,9 @@ class ThreadImpl {
#ifdef DEBUG
// Compute the stack effect of this opcode, and verify later that the
// stack was modified accordingly.
std::pair<uint32_t, uint32_t> stack_effect = wasm::StackEffect(
codemap_->module(), frames_.back().code->function->sig,
code->orig_start + pc, code->orig_end);
std::pair<uint32_t, uint32_t> stack_effect =
StackEffect(codemap_->module(), frames_.back().code->function->sig,
code->orig_start + pc, code->orig_end);
sp_t expected_new_stack_height =
StackHeight() - stack_effect.first + stack_effect.second;
#endif
......@@ -2687,8 +2687,8 @@ class ThreadImpl {
ExternalCallResult CallExternalWasmFunction(
Isolate* isolate, Handle<WasmInstanceObject> instance,
const wasm::WasmCode* code, FunctionSig* sig) {
if (code->kind() == wasm::WasmCode::kWasmToJsWrapper &&
const WasmCode* code, FunctionSig* sig) {
if (code->kind() == WasmCode::kWasmToJsWrapper &&
!IsJSCompatibleSignature(sig)) {
isolate->Throw(*isolate->factory()->NewTypeError(
MessageTemplate::kWasmTrapTypeError));
......@@ -2881,7 +2881,7 @@ class ThreadImpl {
HandleScope scope(isolate);
FunctionSig* signature = module()->signatures[sig_index];
if (code->kind() == wasm::WasmCode::kFunction) {
if (code->kind() == WasmCode::kFunction) {
if (!instance_object_.is_identical_to(instance)) {
// Cross instance call.
return CallExternalWasmFunction(isolate, instance, code, signature);
......@@ -2890,8 +2890,8 @@ class ThreadImpl {
}
// Call to external function.
if (code->kind() == wasm::WasmCode::kInterpreterEntry ||
code->kind() == wasm::WasmCode::kWasmToJsWrapper) {
if (code->kind() == WasmCode::kInterpreterEntry ||
code->kind() == WasmCode::kWasmToJsWrapper) {
return CallExternalWasmFunction(isolate, instance, code, signature);
}
return {ExternalCallResult::INVALID_FUNC};
......
......@@ -39,8 +39,8 @@ WireBytesRef WasmModule::LookupFunctionName(const ModuleWireBytes& wire_bytes,
uint32_t function_index) const {
if (!function_names) {
function_names.reset(new std::unordered_map<uint32_t, WireBytesRef>());
wasm::DecodeFunctionNames(wire_bytes.start(), wire_bytes.end(),
function_names.get());
DecodeFunctionNames(wire_bytes.start(), wire_bytes.end(),
function_names.get());
}
auto it = function_names->find(function_index);
if (it == function_names->end()) return WireBytesRef();
......
......@@ -114,9 +114,9 @@ struct WasmExport {
enum ModuleOrigin : uint8_t { kWasmOrigin, kAsmJsOrigin };
#define SELECT_WASM_COUNTER(counters, origin, prefix, suffix) \
((origin) == wasm::kWasmOrigin ? (counters)->prefix##_wasm_##suffix() \
: (counters)->prefix##_asm_##suffix())
#define SELECT_WASM_COUNTER(counters, origin, prefix, suffix) \
((origin) == kWasmOrigin ? (counters)->prefix##_wasm_##suffix() \
: (counters)->prefix##_asm_##suffix())
struct ModuleWireBytes;
......
......@@ -374,7 +374,7 @@ std::ostream& operator<<(std::ostream& os, const FunctionSig& sig) {
bool IsJSCompatibleSignature(const FunctionSig* sig) {
for (auto type : sig->all()) {
if (type == wasm::kWasmI64 || type == wasm::kWasmS128) return false;
if (type == kWasmI64 || type == kWasmS128) return false;
}
return sig->return_count() <= 1;
}
......
......@@ -557,8 +557,8 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
// handler was used or not when serializing.
UseTrapHandler use_trap_handler =
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler;
wasm::ModuleEnv env(module, use_trap_handler,
wasm::RuntimeExceptionSupport::kRuntimeExceptionSupport);
ModuleEnv env(module, use_trap_handler,
RuntimeExceptionSupport::kRuntimeExceptionSupport);
OwnedVector<uint8_t> wire_bytes_copy = OwnedVector<uint8_t>::Of(wire_bytes);
......
......@@ -93,7 +93,7 @@ class CWasmEntryArgTester {
std::function<ReturnType(Args...)> expected_fn_;
FunctionSig* sig_;
Handle<JSFunction> c_wasm_entry_fn_;
wasm::WasmCode* wasm_code_;
WasmCode* wasm_code_;
};
} // namespace
......
......@@ -88,7 +88,7 @@ enum class CompilationState {
kFailed,
};
class TestResolver : public i::wasm::CompilationResultResolver {
class TestResolver : public CompilationResultResolver {
public:
explicit TestResolver(CompilationState* state) : state_(state) {}
......
......@@ -47,8 +47,7 @@ TestingModuleBuilder::TestingModuleBuilder(
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler
: kNoTrapHandler);
auto wasm_to_js_wrapper = native_module_->AddCodeCopy(
code.ToHandleChecked(), wasm::WasmCode::kWasmToJsWrapper,
maybe_import_index);
code.ToHandleChecked(), WasmCode::kWasmToJsWrapper, maybe_import_index);
ImportedFunctionEntry(instance_object_, maybe_import_index)
.set_wasm_to_js(*maybe_import->js_function, wasm_to_js_wrapper);
......@@ -69,7 +68,7 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size) {
test_module_->has_memory = true;
uint32_t alloc_size = RoundUp(size, kWasmPageSize);
Handle<JSArrayBuffer> new_buffer;
CHECK(wasm::NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer));
CHECK(NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer));
CHECK(!new_buffer.is_null());
mem_start_ = reinterpret_cast<byte*>(new_buffer->backing_store());
mem_size_ = size;
......@@ -426,8 +425,8 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
func_body, func_name, function_->func_index,
isolate()->counters(), comp_mode);
unit.ExecuteCompilation();
wasm::WasmCode* wasm_code = unit.FinishCompilation(&thrower);
if (wasm::WasmCode::ShouldBeLogged(isolate())) {
WasmCode* wasm_code = unit.FinishCompilation(&thrower);
if (WasmCode::ShouldBeLogged(isolate())) {
wasm_code->LogCode(isolate());
}
CHECK(!thrower.error());
......
......@@ -201,7 +201,7 @@ class TestingModuleBuilder {
Handle<WasmInstanceObject> instance_object() const {
return instance_object_;
}
wasm::WasmCode* GetFunctionCode(uint32_t index) const {
WasmCode* GetFunctionCode(uint32_t index) const {
return native_module_->code(index);
}
Address globals_start() const {
......@@ -263,7 +263,7 @@ class WasmFunctionWrapper : private compiler::GraphAndBuilders {
Init(call_descriptor, MachineTypeForC<ReturnType>(), param_vec);
}
void SetInnerCode(wasm::WasmCode* code) {
void SetInnerCode(WasmCode* code) {
intptr_t address = static_cast<intptr_t>(code->instruction_start());
compiler::NodeProperties::ChangeOp(
inner_code_node_,
......
......@@ -166,8 +166,8 @@ class WasmCodeManagerTest : public TestWithContext,
std::shared_ptr<WasmModule> module(new WasmModule);
module->num_declared_functions = kNumFunctions;
bool can_request_more = style == Growable;
wasm::ModuleEnv env(module.get(), UseTrapHandler::kNoTrapHandler,
RuntimeExceptionSupport::kNoRuntimeExceptionSupport);
ModuleEnv env(module.get(), UseTrapHandler::kNoTrapHandler,
RuntimeExceptionSupport::kNoRuntimeExceptionSupport);
return manager->NewNativeModule(i_isolate(), size, can_request_more,
std::move(module), env);
}
......
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