Commit 55478da2 authored by mtrofin's avatar mtrofin Committed by Commit bot

[wasm] cleanup wasm-module.cc

- Coalesced all anonymous namespaces into one, and moved it to the
top of the file, to match elsewhere in the v8 codebase.
- Deleted dead code.
- Moved functions that turned out to be local to wasm-module.cc to
the anonymous namespace.

BUG=

Review-Url: https://codereview.chromium.org/2384183002
Cr-Commit-Position: refs/heads/master@{#39936}
parent 9feab2d2
...@@ -1461,8 +1461,9 @@ Address WasmFrame::GetCallerStackPointer() const { ...@@ -1461,8 +1461,9 @@ Address WasmFrame::GetCallerStackPointer() const {
} }
Object* WasmFrame::wasm_obj() const { Object* WasmFrame::wasm_obj() const {
return wasm::GetOwningWasmInstance(*isolate()->factory()->undefined_value(), Object* ret = wasm::GetOwningWasmInstance(LookupCode());
LookupCode()); if (ret == nullptr) ret = *(isolate()->factory()->undefined_value());
return ret;
} }
uint32_t WasmFrame::function_index() const { uint32_t WasmFrame::function_index() const {
......
...@@ -32,10 +32,8 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { ...@@ -32,10 +32,8 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) {
Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset); Memory::Address_at(entry + StandardFrameConstants::kCallerPCOffset);
Code* code = Code* code =
isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code;
Object* undefined = *isolate->factory()->undefined_value(); Object* owning_instance = wasm::GetOwningWasmInstance(code);
Object* owning_instance = wasm::GetOwningWasmInstance(undefined, code);
CHECK_NOT_NULL(owning_instance); CHECK_NOT_NULL(owning_instance);
CHECK_NE(owning_instance, undefined);
module_instance = handle(JSObject::cast(owning_instance), isolate); module_instance = handle(JSObject::cast(owning_instance), isolate);
} }
......
This diff is collapsed.
...@@ -321,7 +321,6 @@ struct ModuleEnv { ...@@ -321,7 +321,6 @@ struct ModuleEnv {
FunctionSig* sig); FunctionSig* sig);
static compiler::CallDescriptor* GetI32WasmCallDescriptor( static compiler::CallDescriptor* GetI32WasmCallDescriptor(
Zone* zone, compiler::CallDescriptor* descriptor); Zone* zone, compiler::CallDescriptor* descriptor);
compiler::CallDescriptor* GetCallDescriptor(Zone* zone, uint32_t index);
}; };
// A helper for printing out the names of functions. // A helper for printing out the names of functions.
...@@ -510,10 +509,8 @@ uint32_t GetNumImportedFunctions(Handle<JSObject> wasm_object); ...@@ -510,10 +509,8 @@ uint32_t GetNumImportedFunctions(Handle<JSObject> wasm_object);
// Assumed to be called with a code object associated to a wasm module instance. // Assumed to be called with a code object associated to a wasm module instance.
// Intended to be called from runtime functions. // Intended to be called from runtime functions.
// Returns undefined if the runtime support was not setup, nullptr if the // Returns nullptr on failing to get owning instance.
// instance Object* GetOwningWasmInstance(Code* code);
// was collected, or the instance object owning the Code object
Object* GetOwningWasmInstance(Object* undefined, Code* code);
MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate,
Handle<JSObject> instance); Handle<JSObject> instance);
......
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