Index: src/wasm/wasm-module.cc |
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
index d621e8b37e3afb6997aaed0b79fe03c502abc1e3..bd6b6ecd91e4244d64165199ea629282bc7d3074 100644 |
--- a/src/wasm/wasm-module.cc |
+++ b/src/wasm/wasm-module.cc |
@@ -292,6 +292,7 @@ bool LinkFunction(Handle<Code> unlinked, |
AllowDeferredHandleDereference embedding_raw_address; |
for (RelocIterator it(*unlinked, mode_mask); !it.done(); it.next()) { |
RelocInfo::Mode mode = it.rinfo()->rmode(); |
+ DCHECK(RelocInfo::IsCodeTarget(mode)); |
if (RelocInfo::IsCodeTarget(mode)) { |
Code* target = |
Code::GetCodeFromTargetAddress(it.rinfo()->target_address()); |
@@ -1018,10 +1019,10 @@ SeqOneByteString* GetWasmBytes(JSObject* wasm) { |
return SeqOneByteString::cast(wasm->GetInternalField(kWasmModuleBytesString)); |
} |
-WasmDebugInfo* GetDebugInfo(JSObject* wasm) { |
+WasmDebugInfo* GetDebugInfo(Handle<JSObject> wasm) { |
Object* info = wasm->GetInternalField(kWasmDebugInfo); |
if (!info->IsUndefined(wasm->GetIsolate())) return WasmDebugInfo::cast(info); |
- Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(handle(wasm)); |
+ Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(wasm); |
wasm->SetInternalField(kWasmDebugInfo, *new_info); |
return *new_info; |
} |
@@ -1032,6 +1033,20 @@ int GetNumberOfFunctions(JSObject* wasm) { |
return ByteArray::cast(func_names_obj)->get_int(0); |
} |
+JSArrayBuffer* GetWasmMemoryBuffer(JSObject* wasm) { |
+ DCHECK(IsWasmObject(wasm)); |
+ return JSArrayBuffer::cast(wasm->GetInternalField(kWasmMemArrayBuffer)); |
+} |
+ |
+Code* GetWasmFunctionCode(JSObject* wasm, uint32_t func_index) { |
+ FixedArray* code_table = |
+ FixedArray::cast(wasm->GetInternalField(kWasmModuleCodeTable)); |
+ DCHECK_LE(func_index, static_cast<unsigned>(kMaxInt)); |
+ int func_index_int = static_cast<int>(func_index); |
+ DCHECK_LE(func_index_int, code_table->length()); |
+ return Code::cast(code_table->get(func_index_int)); |
+} |
+ |
namespace testing { |
int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |