Commit 717b2eaf authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Use handles in wasm::GetDebugInfo.

Handles are necessary in wasm::GetDebugInfo because a GC can be
triggered in this function.

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

Review-Url: https://codereview.chromium.org/2132553002
Cr-Commit-Position: refs/heads/master@{#37601}
parent 237a0022
......@@ -1434,8 +1434,8 @@ uint32_t WasmFrame::function_index() const {
}
Script* WasmFrame::script() const {
JSObject* wasm = JSObject::cast(wasm_obj());
Handle<wasm::WasmDebugInfo> debug_info(wasm::GetDebugInfo(wasm), isolate());
Handle<JSObject> wasm(JSObject::cast(wasm_obj()), isolate());
Handle<wasm::WasmDebugInfo> debug_info = wasm::GetDebugInfo(wasm);
return wasm::WasmDebugInfo::GetFunctionScript(debug_info, function_index());
}
......
......@@ -1803,8 +1803,8 @@ RUNTIME_FUNCTION(Runtime_GetWasmFunctionOffsetTable) {
CHECK(script_val->value()->IsScript());
Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
Handle<wasm::WasmDebugInfo> debug_info(
wasm::GetDebugInfo(script->wasm_object()), isolate);
Handle<wasm::WasmDebugInfo> debug_info =
wasm::GetDebugInfo(handle(script->wasm_object(), isolate));
Handle<FixedArray> elements = wasm::WasmDebugInfo::GetFunctionOffsetTable(
debug_info, script->wasm_function_index());
return *isolate->factory()->NewJSArrayWithElements(elements);
......@@ -1818,8 +1818,8 @@ RUNTIME_FUNCTION(Runtime_DisassembleWasmFunction) {
CHECK(script_val->value()->IsScript());
Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
Handle<wasm::WasmDebugInfo> debug_info(
wasm::GetDebugInfo(script->wasm_object()), isolate);
Handle<wasm::WasmDebugInfo> debug_info =
wasm::GetDebugInfo(handle(script->wasm_object(), isolate));
return *wasm::WasmDebugInfo::DisassembleFunction(
debug_info, script->wasm_function_index());
}
......
......@@ -1278,12 +1278,14 @@ SeqOneByteString* GetWasmBytes(JSObject* wasm) {
return SeqOneByteString::cast(wasm->GetInternalField(kWasmModuleBytesString));
}
WasmDebugInfo* GetDebugInfo(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> GetDebugInfo(Handle<JSObject> wasm) {
Handle<Object> info(wasm->GetInternalField(kWasmDebugInfo),
wasm->GetIsolate());
if (!info->IsUndefined(wasm->GetIsolate()))
return Handle<WasmDebugInfo>::cast(info);
Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(wasm);
wasm->SetInternalField(kWasmDebugInfo, *new_info);
return *new_info;
return new_info;
}
bool UpdateWasmModuleMemory(Handle<JSObject> object, Address old_start,
......
......@@ -354,7 +354,7 @@ SeqOneByteString* GetWasmBytes(JSObject* wasm);
// Get the debug info associated with the given wasm object.
// If no debug info exists yet, it is created automatically.
WasmDebugInfo* GetDebugInfo(JSObject* wasm);
Handle<WasmDebugInfo> GetDebugInfo(Handle<JSObject> wasm);
// Return the number of functions in the given wasm object.
int GetNumberOfFunctions(JSObject* wasm);
......
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