Commit cbfdbb6d authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Make WasmDebugInfo::interpreted_functions a FixedArray

Store it as FixedArray instead of Object. Use the empty array as
uninitialized value instead of undefined.

R=titzer@chromium.org

Bug: v8:8015
Change-Id: I53275dc5fd2c3a0db1e021ee4da0fc0694e2053e
Reviewed-on: https://chromium-review.googlesource.com/1224372Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55867}
parent cbb400a7
......@@ -555,16 +555,17 @@ wasm::InterpreterHandle* GetInterpreterHandleOrNull(WasmDebugInfo* debug_info) {
Handle<FixedArray> GetOrCreateInterpretedFunctions(
Isolate* isolate, Handle<WasmDebugInfo> debug_info) {
Handle<Object> obj(debug_info->interpreted_functions(), isolate);
if (!obj->IsUndefined(isolate)) return Handle<FixedArray>::cast(obj);
Handle<FixedArray> arr(debug_info->interpreted_functions(), isolate);
int num_functions = debug_info->wasm_instance()
->module_object()
->native_module()
->num_functions();
Handle<FixedArray> new_arr = isolate->factory()->NewFixedArray(num_functions);
debug_info->set_interpreted_functions(*new_arr);
return new_arr;
if (arr->length() == 0 && num_functions > 0) {
arr = isolate->factory()->NewFixedArray(num_functions);
debug_info->set_interpreted_functions(*arr);
}
DCHECK_EQ(num_functions, arr->length());
return arr;
}
} // namespace
......@@ -575,6 +576,7 @@ Handle<WasmDebugInfo> WasmDebugInfo::New(Handle<WasmInstanceObject> instance) {
Handle<WasmDebugInfo> debug_info = Handle<WasmDebugInfo>::cast(
factory->NewStruct(WASM_DEBUG_INFO_TYPE, TENURED));
debug_info->set_wasm_instance(*instance);
debug_info->set_interpreted_functions(*factory->empty_fixed_array());
instance->set_debug_info(*debug_info);
return debug_info;
}
......
......@@ -225,7 +225,7 @@ SMI_ACCESSORS(WasmExportedFunctionData, function_index, kFunctionIndexOffset)
// WasmDebugInfo
ACCESSORS(WasmDebugInfo, wasm_instance, WasmInstanceObject, kInstanceOffset)
ACCESSORS(WasmDebugInfo, interpreter_handle, Object, kInterpreterHandleOffset)
ACCESSORS(WasmDebugInfo, interpreted_functions, Object,
ACCESSORS(WasmDebugInfo, interpreted_functions, FixedArray,
kInterpretedFunctionsOffset)
OPTIONAL_ACCESSORS(WasmDebugInfo, locals_names, FixedArray, kLocalsNamesOffset)
OPTIONAL_ACCESSORS(WasmDebugInfo, c_wasm_entries, FixedArray,
......
......@@ -544,7 +544,7 @@ class WasmDebugInfo : public Struct, public NeverReadOnlySpaceObject {
public:
DECL_ACCESSORS(wasm_instance, WasmInstanceObject)
DECL_ACCESSORS(interpreter_handle, Object);
DECL_ACCESSORS(interpreted_functions, Object);
DECL_ACCESSORS(interpreted_functions, FixedArray);
DECL_OPTIONAL_ACCESSORS(locals_names, FixedArray)
DECL_OPTIONAL_ACCESSORS(c_wasm_entries, FixedArray)
DECL_OPTIONAL_ACCESSORS(c_wasm_entry_map, Managed<wasm::SignatureMap>)
......
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