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