Commit 541abb1c authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Move {shared} field to {WasmModuleObject}.

This makes the fact that {WasmSharedModuleData} is shared across
instances explicit by hanging this {shared} reference off the module
object instead of the instance-specific {WasmCompiledModule} object.

R=titzer@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I99bf3d855d6283bdc48373f0f8e2df1990905d3f
Reviewed-on: https://chromium-review.googlesource.com/1051909
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53163}
parent 1825cccf
......@@ -7416,9 +7416,7 @@ MaybeLocal<Proxy> Proxy::New(Local<Context> context, Local<Object> local_target,
Local<String> WasmCompiledModule::GetWasmWireBytes() {
i::Handle<i::WasmModuleObject> obj =
i::Handle<i::WasmModuleObject>::cast(Utils::OpenHandle(this));
i::Handle<i::WasmCompiledModule> compiled_part =
i::handle(obj->compiled_module());
i::Handle<i::String> wire_bytes(compiled_part->shared()->module_bytes());
i::Handle<i::String> wire_bytes(obj->shared()->module_bytes());
return Local<String>::Cast(Utils::ToLocal(wire_bytes));
}
......
......@@ -1317,18 +1317,18 @@ WASM_SUMMARY_DISPATCH(int, byte_offset)
int FrameSummary::WasmFrameSummary::SourcePosition() const {
Handle<WasmSharedModuleData> shared(
wasm_instance()->compiled_module()->shared(), isolate());
wasm_instance()->module_object()->shared(), isolate());
return WasmSharedModuleData::GetSourcePosition(
shared, function_index(), byte_offset(), at_to_number_conversion());
}
Handle<Script> FrameSummary::WasmFrameSummary::script() const {
return handle(wasm_instance()->compiled_module()->shared()->script());
return handle(wasm_instance()->module_object()->shared()->script());
}
Handle<String> FrameSummary::WasmFrameSummary::FunctionName() const {
Handle<WasmSharedModuleData> shared(
wasm_instance()->compiled_module()->shared(), isolate());
wasm_instance()->module_object()->shared(), isolate());
return WasmSharedModuleData::GetFunctionName(isolate(), shared,
function_index());
}
......@@ -1803,7 +1803,7 @@ WasmInstanceObject* WasmCompiledFrame::wasm_instance() const {
}
WasmSharedModuleData* WasmCompiledFrame::shared() const {
return wasm_instance()->compiled_module()->shared();
return wasm_instance()->module_object()->shared();
}
WasmCompiledModule* WasmCompiledFrame::compiled_module() const {
......@@ -1899,7 +1899,7 @@ WasmDebugInfo* WasmInterpreterEntryFrame::debug_info() const {
}
WasmSharedModuleData* WasmInterpreterEntryFrame::shared() const {
return wasm_instance()->compiled_module()->shared();
return wasm_instance()->module_object()->shared();
}
WasmCompiledModule* WasmInterpreterEntryFrame::compiled_module() const {
......
......@@ -470,7 +470,7 @@ class FrameArrayBuilder {
}
Handle<WasmInstanceObject> instance = summary.wasm_instance();
int flags = 0;
if (instance->compiled_module()->shared()->is_asm_js()) {
if (instance->module_object()->shared()->is_asm_js()) {
flags |= FrameArray::kIsAsmJsWasmFrame;
if (WasmCompiledFrame::cast(frame)->at_to_number_conversion()) {
flags |= FrameArray::kAsmJsAtNumberConversion;
......@@ -489,7 +489,7 @@ class FrameArrayBuilder {
const auto& summary = summ.AsWasmInterpreted();
Handle<WasmInstanceObject> instance = summary.wasm_instance();
int flags = FrameArray::kIsWasmInterpretedFrame;
DCHECK(!instance->compiled_module()->shared()->is_asm_js());
DCHECK(!instance->module_object()->shared()->is_asm_js());
elements_ = FrameArray::AppendWasmFrame(elements_, instance,
summary.function_index(), {},
summary.byte_offset(), flags);
......@@ -807,7 +807,7 @@ class CaptureStackTraceHelper {
Handle<StackFrameInfo> info = factory()->NewStackFrameInfo();
Handle<WasmSharedModuleData> shared(
summ.wasm_instance()->compiled_module()->shared(), isolate_);
summ.wasm_instance()->module_object()->shared(), isolate_);
Handle<String> name = WasmSharedModuleData::GetFunctionName(
isolate_, shared, summ.function_index());
info->set_function_name(*name);
......@@ -1738,8 +1738,7 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
const int frame_count = elements->FrameCount();
for (int i = 0; i < frame_count; i++) {
if (elements->IsWasmFrame(i) || elements->IsAsmJsWasmFrame(i)) {
Handle<WasmCompiledModule> compiled_module(
elements->WasmInstance(i)->compiled_module());
Handle<WasmInstanceObject> instance(elements->WasmInstance(i));
uint32_t func_index =
static_cast<uint32_t>(elements->WasmFunctionIndex(i)->value());
int code_offset = elements->Offset(i)->value();
......@@ -1748,16 +1747,16 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
// a second lookup here could lead to inconsistency.
int byte_offset =
FrameSummary::WasmCompiledFrameSummary::GetWasmSourcePosition(
compiled_module->GetNativeModule()->code(func_index),
instance->compiled_module()->GetNativeModule()->code(func_index),
code_offset);
bool is_at_number_conversion =
elements->IsAsmJsWasmFrame(i) &&
elements->Flags(i)->value() & FrameArray::kAsmJsAtNumberConversion;
int pos = WasmSharedModuleData::GetSourcePosition(
handle(compiled_module->shared(), this), func_index, byte_offset,
is_at_number_conversion);
Handle<Script> script(compiled_module->shared()->script());
handle(instance->module_object()->shared(), this), func_index,
byte_offset, is_at_number_conversion);
Handle<Script> script(instance->module_object()->shared()->script());
*target = MessageLocation(script, pos, pos + 1);
return true;
......
......@@ -664,8 +664,8 @@ Handle<Object> WasmStackFrame::GetFunction() const {
Handle<Object> WasmStackFrame::GetFunctionName() {
Handle<Object> name;
Handle<WasmSharedModuleData> shared(
wasm_instance_->compiled_module()->shared(), isolate_);
Handle<WasmSharedModuleData> shared(wasm_instance_->module_object()->shared(),
isolate_);
if (!WasmSharedModuleData::GetFunctionNameOrNull(isolate_, shared,
wasm_func_index_)
.ToHandle(&name)) {
......@@ -677,8 +677,8 @@ Handle<Object> WasmStackFrame::GetFunctionName() {
MaybeHandle<String> WasmStackFrame::ToString() {
IncrementalStringBuilder builder(isolate_);
Handle<WasmSharedModuleData> shared(
wasm_instance_->compiled_module()->shared(), isolate_);
Handle<WasmSharedModuleData> shared(wasm_instance_->module_object()->shared(),
isolate_);
MaybeHandle<String> module_name =
WasmSharedModuleData::GetModuleNameOrNull(isolate_, shared);
MaybeHandle<String> function_name =
......@@ -726,8 +726,7 @@ Handle<Object> WasmStackFrame::Null() const {
bool WasmStackFrame::HasScript() const { return true; }
Handle<Script> WasmStackFrame::GetScript() const {
return handle(wasm_instance_->compiled_module()->shared()->script(),
isolate_);
return handle(wasm_instance_->module_object()->shared()->script(), isolate_);
}
AsmJsWasmStackFrame::AsmJsWasmStackFrame() {}
......@@ -751,14 +750,14 @@ Handle<Object> AsmJsWasmStackFrame::GetFunction() const {
}
Handle<Object> AsmJsWasmStackFrame::GetFileName() {
Handle<Script> script(wasm_instance_->compiled_module()->shared()->script(),
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
isolate_);
DCHECK(script->IsUserJavaScript());
return handle(script->name(), isolate_);
}
Handle<Object> AsmJsWasmStackFrame::GetScriptNameOrSourceUrl() {
Handle<Script> script(wasm_instance_->compiled_module()->shared()->script(),
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
isolate_);
DCHECK_EQ(Script::TYPE_NORMAL, script->type());
return ScriptNameOrSourceUrl(script, isolate_);
......@@ -769,8 +768,8 @@ int AsmJsWasmStackFrame::GetPosition() const {
int byte_offset =
FrameSummary::WasmCompiledFrameSummary::GetWasmSourcePosition(code_,
offset_);
Handle<WasmSharedModuleData> shared(
wasm_instance_->compiled_module()->shared(), isolate_);
Handle<WasmSharedModuleData> shared(wasm_instance_->module_object()->shared(),
isolate_);
DCHECK_LE(0, byte_offset);
return WasmSharedModuleData::GetSourcePosition(
shared, wasm_func_index_, static_cast<uint32_t>(byte_offset),
......@@ -779,7 +778,7 @@ int AsmJsWasmStackFrame::GetPosition() const {
int AsmJsWasmStackFrame::GetLineNumber() {
DCHECK_LE(0, GetPosition());
Handle<Script> script(wasm_instance_->compiled_module()->shared()->script(),
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
isolate_);
DCHECK(script->IsUserJavaScript());
return Script::GetLineNumber(script, GetPosition()) + 1;
......@@ -787,7 +786,7 @@ int AsmJsWasmStackFrame::GetLineNumber() {
int AsmJsWasmStackFrame::GetColumnNumber() {
DCHECK_LE(0, GetPosition());
Handle<Script> script(wasm_instance_->compiled_module()->shared()->script(),
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
isolate_);
DCHECK(script->IsUserJavaScript());
return Script::GetColumnNumber(script, GetPosition()) + 1;
......
......@@ -1546,7 +1546,6 @@ void Tuple3::Tuple3Verify() {
void WasmCompiledModule::WasmCompiledModuleVerify() {
CHECK(IsWasmCompiledModule());
VerifyObjectField(kSharedOffset);
VerifyObjectField(kNextInstanceOffset);
VerifyObjectField(kPrevInstanceOffset);
VerifyObjectField(kOwningInstanceOffset);
......
......@@ -1644,7 +1644,6 @@ void Tuple3::Tuple3Print(std::ostream& os) { // NOLINT
void WasmCompiledModule::WasmCompiledModulePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "WasmCompiledModule");
os << "\n - shared: " << Brief(shared());
os << "\n";
}
......
......@@ -872,12 +872,11 @@ Maybe<bool> ValueSerializer::WriteWasmModule(Handle<WasmModuleObject> object) {
}
}
Handle<WasmCompiledModule> compiled_part(object->compiled_module(), isolate_);
WasmEncodingTag encoding_tag = WasmEncodingTag::kRawBytes;
WriteTag(SerializationTag::kWasmModule);
WriteRawBytes(&encoding_tag, sizeof(encoding_tag));
Handle<String> wire_bytes(compiled_part->shared()->module_bytes(), isolate_);
Handle<String> wire_bytes(object->shared()->module_bytes(), isolate_);
int wire_bytes_length = wire_bytes->length();
WriteVarint<uint32_t>(wire_bytes_length);
uint8_t* destination;
......@@ -885,6 +884,7 @@ Maybe<bool> ValueSerializer::WriteWasmModule(Handle<WasmModuleObject> object) {
String::WriteToFlat(*wire_bytes, destination, 0, wire_bytes_length);
}
Handle<WasmCompiledModule> compiled_part(object->compiled_module(), isolate_);
size_t module_size =
wasm::GetSerializedNativeModuleSize(isolate_, compiled_part);
CHECK_GE(std::numeric_limits<uint32_t>::max(), module_size);
......
This diff is collapsed.
......@@ -72,7 +72,7 @@ bool CodeSpecialization::ApplyToWholeModule(
NativeModule* native_module, Handle<WasmModuleObject> module_object,
ICacheFlushMode icache_flush_mode) {
DisallowHeapAllocation no_gc;
WasmSharedModuleData* shared = module_object->compiled_module()->shared();
WasmSharedModuleData* shared = module_object->shared();
WasmModule* module = shared->module();
std::vector<WasmFunction>* wasm_functions = &shared->module()->functions;
FixedArray* export_wrappers = module_object->export_wrappers();
......
......@@ -71,7 +71,7 @@ MaybeHandle<String> GetLocalName(Isolate* isolate,
DCHECK_LE(0, local_index);
if (!debug_info->has_locals_names()) {
Handle<WasmSharedModuleData> shared(
debug_info->wasm_instance()->compiled_module()->shared(), isolate);
debug_info->wasm_instance()->module_object()->shared(), isolate);
Handle<FixedArray> locals_names = wasm::DecodeLocalNames(isolate, shared);
debug_info->set_locals_names(*locals_names);
}
......@@ -132,10 +132,8 @@ class InterpreterHandle {
static Vector<const byte> GetBytes(WasmDebugInfo* debug_info) {
// Return raw pointer into heap. The WasmInterpreter will make its own copy
// of this data anyway, and there is no heap allocation in-between.
SeqOneByteString* bytes_str = debug_info->wasm_instance()
->compiled_module()
->shared()
->module_bytes();
SeqOneByteString* bytes_str =
debug_info->wasm_instance()->module_object()->shared()->module_bytes();
return {bytes_str->GetChars(), static_cast<size_t>(bytes_str->length())};
}
......@@ -144,7 +142,7 @@ class InterpreterHandle {
InterpreterHandle(Isolate* isolate, WasmDebugInfo* debug_info)
: isolate_(isolate),
module_(
debug_info->wasm_instance()->compiled_module()->shared()->module()),
debug_info->wasm_instance()->module_object()->shared()->module()),
interpreter_(isolate, module_, GetBytes(debug_info),
handle(debug_info->wasm_instance())) {}
......@@ -309,7 +307,7 @@ class InterpreterHandle {
// Check whether we hit a breakpoint.
if (isolate_->debug()->break_points_active()) {
Handle<WasmSharedModuleData> shared(
GetInstanceObject()->compiled_module()->shared(), isolate_);
GetInstanceObject()->module_object()->shared(), isolate_);
int position = GetTopPosition(shared);
Handle<FixedArray> breakpoints;
if (WasmSharedModuleData::CheckBreakPoints(isolate_, shared, position)
......@@ -557,7 +555,7 @@ wasm::InterpreterHandle* GetInterpreterHandleOrNull(WasmDebugInfo* debug_info) {
int GetNumFunctions(WasmInstanceObject* instance) {
size_t num_functions =
instance->compiled_module()->shared()->module()->functions.size();
instance->module_object()->shared()->module()->functions.size();
DCHECK_GE(kMaxInt, num_functions);
return static_cast<int>(num_functions);
}
......
......@@ -127,8 +127,7 @@ bool IsWasmCodegenAllowed(Isolate* isolate, Handle<Context> context) {
Handle<JSArray> GetImports(Isolate* isolate,
Handle<WasmModuleObject> module_object) {
Handle<WasmSharedModuleData> shared(
module_object->compiled_module()->shared(), isolate);
Handle<WasmSharedModuleData> shared(module_object->shared(), isolate);
Factory* factory = isolate->factory();
Handle<String> module_string = factory->InternalizeUtf8String("module");
......@@ -197,8 +196,7 @@ Handle<JSArray> GetImports(Isolate* isolate,
Handle<JSArray> GetExports(Isolate* isolate,
Handle<WasmModuleObject> module_object) {
Handle<WasmSharedModuleData> shared(
module_object->compiled_module()->shared(), isolate);
Handle<WasmSharedModuleData> shared(module_object->shared(), isolate);
Factory* factory = isolate->factory();
Handle<String> name_string = factory->InternalizeUtf8String("name");
......@@ -261,8 +259,7 @@ Handle<JSArray> GetExports(Isolate* isolate,
Handle<JSArray> GetCustomSections(Isolate* isolate,
Handle<WasmModuleObject> module_object,
Handle<String> name, ErrorThrower* thrower) {
Handle<WasmSharedModuleData> shared(
module_object->compiled_module()->shared(), isolate);
Handle<WasmSharedModuleData> shared(module_object->shared(), isolate);
Factory* factory = isolate->factory();
std::vector<CustomSectionOffset> custom_sections;
......
......@@ -51,10 +51,7 @@ CAST_ACCESSOR(WasmTableObject)
ACCESSORS(WasmModuleObject, compiled_module, WasmCompiledModule,
kCompiledModuleOffset)
ACCESSORS(WasmModuleObject, export_wrappers, FixedArray, kExportWrappersOffset)
WasmSharedModuleData* WasmModuleObject::shared() const {
return compiled_module()->shared();
}
ACCESSORS(WasmModuleObject, shared, WasmSharedModuleData, kSharedOffset)
// WasmTableObject
ACCESSORS(WasmTableObject, functions, FixedArray, kFunctionsOffset)
......@@ -232,7 +229,6 @@ OPTIONAL_ACCESSORS(WasmDebugInfo, c_wasm_entry_map, Managed<wasm::SignatureMap>,
}
// WasmCompiledModule
WCM_OBJECT(WasmSharedModuleData, shared, kSharedOffset)
WCM_OBJECT(WasmCompiledModule, next_instance, kNextInstanceOffset)
WCM_OBJECT(WasmCompiledModule, prev_instance, kPrevInstanceOffset)
WCM_WEAK_LINK(WasmInstanceObject, owning_instance, kOwningInstanceOffset)
......
......@@ -262,16 +262,17 @@ enum DispatchTableElements : int {
Handle<WasmModuleObject> WasmModuleObject::New(
Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
Handle<FixedArray> export_wrappers) {
Handle<FixedArray> export_wrappers, Handle<WasmSharedModuleData> shared) {
Handle<JSFunction> module_cons(
isolate->native_context()->wasm_module_constructor());
auto module_object = Handle<WasmModuleObject>::cast(
isolate->factory()->NewJSObject(module_cons));
module_object->set_compiled_module(*compiled_module);
module_object->set_export_wrappers(*export_wrappers);
if (compiled_module->shared()->script()->type() == Script::TYPE_WASM) {
compiled_module->shared()->script()->set_wasm_module_object(*module_object);
if (shared->script()->type() == Script::TYPE_WASM) {
shared->script()->set_wasm_module_object(*module_object);
}
module_object->set_shared(*shared);
compiled_module->LogWasmCodes(isolate);
return module_object;
......@@ -758,7 +759,7 @@ void WasmInstanceObject::SetRawMemory(byte* mem_start, uint32_t mem_size) {
}
WasmModule* WasmInstanceObject::module() {
return compiled_module()->shared()->module();
return module_object()->shared()->module();
}
Handle<WasmDebugInfo> WasmInstanceObject::GetOrCreateDebugInfo(
......@@ -782,9 +783,9 @@ Handle<WasmInstanceObject> WasmInstanceObject::New(
// Initialize the imported function arrays.
auto num_imported_functions =
compiled_module->shared()->module()->num_imported_functions;
module_object->shared()->module()->num_imported_functions;
auto num_imported_mutable_globals =
compiled_module->shared()->module()->num_imported_mutable_globals;
module_object->shared()->module()->num_imported_mutable_globals;
auto native_allocations = Managed<WasmInstanceNativeAllocations>::Allocate(
isolate, instance, num_imported_functions, num_imported_mutable_globals);
instance->set_managed_native_allocations(*native_allocations);
......@@ -1373,7 +1374,6 @@ Handle<WasmCompiledModule> WasmCompiledModule::Clone(
Handle<FixedArray> code_copy;
Handle<WasmCompiledModule> ret = Handle<WasmCompiledModule>::cast(
isolate->factory()->NewStruct(WASM_COMPILED_MODULE_TYPE, TENURED));
ret->set_shared(module->shared());
ret->set_weak_owning_instance(isolate->heap()->empty_weak_cell());
ret->set_native_module(module->native_module());
......@@ -1554,13 +1554,10 @@ void WasmCompiledModule::LogWasmCodes(Isolate* isolate) {
wasm::NativeModule* native_module = GetNativeModule();
if (native_module == nullptr) return;
const uint32_t number_of_codes = native_module->function_count();
if (has_shared()) {
Handle<WasmSharedModuleData> shared_handle(shared(), isolate);
for (uint32_t i = 0; i < number_of_codes; i++) {
wasm::WasmCode* code = native_module->code(i);
if (code == nullptr) continue;
code->LogCode(isolate);
}
for (uint32_t i = 0; i < number_of_codes; i++) {
wasm::WasmCode* code = native_module->code(i);
if (code == nullptr) continue;
code->LogCode(isolate);
}
}
......
......@@ -108,16 +108,13 @@ class WasmModuleObject : public JSObject {
// Shared compiled code between multiple WebAssembly.Module objects.
DECL_ACCESSORS(compiled_module, WasmCompiledModule)
DECL_ACCESSORS(export_wrappers, FixedArray)
// TODO(mstarzinger): Currently this getter uses an indirection via the
// {WasmCompiledModule}, but we will soon move the reference to the shared
// data directly into this {WasmModuleObject}, making this a normal accessor.
inline WasmSharedModuleData* shared() const;
DECL_ACCESSORS(shared, WasmSharedModuleData)
// Layout description.
#define WASM_MODULE_OBJECT_FIELDS(V) \
V(kCompiledModuleOffset, kPointerSize) \
V(kExportWrappersOffset, kPointerSize) \
V(kSharedOffset, kPointerSize) \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
......@@ -126,7 +123,7 @@ class WasmModuleObject : public JSObject {
static Handle<WasmModuleObject> New(
Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
Handle<FixedArray> export_wrappers);
Handle<FixedArray> export_wrappers, Handle<WasmSharedModuleData> shared);
// Set a breakpoint on the given byte position inside the given module.
// This will affect all live and future instances of the module.
......@@ -537,7 +534,6 @@ class WasmCompiledModule : public Struct {
// Layout description.
#define WASM_COMPILED_MODULE_FIELDS(V) \
V(kSharedOffset, kPointerSize) \
V(kNextInstanceOffset, kPointerSize) \
V(kPrevInstanceOffset, kPointerSize) \
V(kOwningInstanceOffset, kPointerSize) \
......@@ -572,7 +568,6 @@ class WasmCompiledModule : public Struct {
// for deserialization, and if they are serializable.
// By default, instance values go to WasmInstanceObject, however, if
// we embed the generated code with a value, then we track that value here.
WCM_OBJECT(WasmSharedModuleData, shared)
WCM_CONST_OBJECT(WasmCompiledModule, next_instance)
WCM_CONST_OBJECT(WasmCompiledModule, prev_instance)
WCM_WEAK_LINK(WasmInstanceObject, owning_instance)
......
......@@ -665,7 +665,6 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
wasm::RuntimeExceptionSupport::kRuntimeExceptionSupport);
Handle<WasmCompiledModule> compiled_module =
WasmCompiledModule::New(isolate, shared->module(), env);
compiled_module->set_shared(*shared);
compiled_module->GetNativeModule()->SetSharedModuleData(shared);
NativeModuleDeserializer deserializer(isolate,
compiled_module->GetNativeModule());
......@@ -674,7 +673,7 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
if (!deserializer.Read(&reader)) return {};
Handle<WasmModuleObject> module_object =
WasmModuleObject::New(isolate, compiled_module, export_wrappers);
WasmModuleObject::New(isolate, compiled_module, export_wrappers, shared);
// TODO(6792): Wrappers below might be cloned using {Factory::CopyCode}. This
// requires unlocking the code space here. This should eventually be moved
......
......@@ -277,12 +277,10 @@ class WasmSerializationTest {
v8::Utils::OpenHandle(*deserialized_module));
{
DisallowHeapAllocation assume_no_gc;
Handle<WasmCompiledModule> compiled_part(module_object->compiled_module(),
current_isolate());
CHECK_EQ(
memcmp(
reinterpret_cast<const uint8_t*>(
compiled_part->shared()->module_bytes()->GetCharsAddress()),
module_object->shared()->module_bytes()->GetCharsAddress()),
wire_bytes().first, wire_bytes().second),
0);
}
......@@ -345,8 +343,9 @@ class WasmSerializationTest {
Handle<WasmCompiledModule> compiled_module(
module_object->compiled_module());
Handle<FixedArray> export_wrappers(module_object->export_wrappers());
Handle<WasmSharedModuleData> shared(module_object->shared());
Handle<JSObject> module_obj = WasmModuleObject::New(
serialization_isolate, compiled_module, export_wrappers);
serialization_isolate, compiled_module, export_wrappers, shared);
v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj);
CHECK(v8_module_obj->IsWebAssemblyCompiledModule());
......@@ -1181,9 +1180,7 @@ TEST(AtomicOpDisassembly) {
isolate->wasm_engine()->SyncCompile(
isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end()));
Handle<WasmCompiledModule> compiled_module(
module_object.ToHandleChecked()->compiled_module(), isolate);
compiled_module->shared()->DisassembleFunction(0);
module_object.ToHandleChecked()->shared()->DisassembleFunction(0);
}
Cleanup();
}
......
......@@ -249,7 +249,7 @@ WASM_COMPILED_EXEC_TEST(WasmCollectPossibleBreakpoints) {
BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_ZERO, WASM_ONE));
WasmInstanceObject* instance = *runner.builder().instance_object();
WasmSharedModuleData* shared = instance->compiled_module()->shared();
WasmSharedModuleData* shared = instance->module_object()->shared();
std::vector<debug::Location> locations;
// Check all locations for function 0.
......
......@@ -173,7 +173,7 @@ void TestingModuleBuilder::PopulateIndirectFunctionTable() {
uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) {
Handle<WasmSharedModuleData> shared(
instance_object_->compiled_module()->shared(), isolate_);
instance_object_->module_object()->shared(), isolate_);
Handle<SeqOneByteString> old_bytes(shared->module_bytes(), isolate_);
uint32_t old_size = static_cast<uint32_t>(old_bytes->length());
// Avoid placing strings at offset 0, this might be interpreted as "not
......@@ -222,10 +222,9 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() {
ModuleEnv env = CreateModuleEnv();
Handle<WasmCompiledModule> compiled_module =
WasmCompiledModule::New(isolate_, test_module_ptr_, env);
compiled_module->set_shared(*shared_module_data);
compiled_module->GetNativeModule()->SetSharedModuleData(shared_module_data);
Handle<WasmModuleObject> module_object =
WasmModuleObject::New(isolate_, compiled_module, export_wrappers);
Handle<WasmModuleObject> module_object = WasmModuleObject::New(
isolate_, compiled_module, export_wrappers, shared_module_data);
// This method is called when we initialize TestEnvironment. We don't
// have a memory yet, so we won't create it here. We'll update the
// interpreter when we get a memory. We do have globals, though.
......@@ -421,8 +420,9 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
Handle<WasmCompiledModule> compiled_module(
builder_->instance_object()->compiled_module(), isolate());
NativeModule* native_module = compiled_module->GetNativeModule();
Handle<SeqOneByteString> wire_bytes(compiled_module->shared()->module_bytes(),
isolate());
Handle<SeqOneByteString> wire_bytes(
builder_->instance_object()->module_object()->shared()->module_bytes(),
isolate());
ModuleEnv module_env = builder_->CreateModuleEnv();
ErrorThrower thrower(isolate(), "WasmFunctionCompiler::Build");
......
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