[wasm] Merge {WasmSharedModuleData} with {WasmModuleObject}
The {WasmSharedModuleData} struct was introduced to hold data common to all wasm instances belonging to the same module. The idea was to keep "internal state" separate from the JS-facing {WasmModuleObject}. Since this objective has no real value, and we already store some internal data on the {WasmModuleObject}, this CL merges these two objects. R=titzer@chromium.org, mstarzinger@chromium.org Bug: v8:7754 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I04f6d07bf5d812bc4717af26f0f64231345861f9 Reviewed-on: https://chromium-review.googlesource.com/1097491 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#53698}
This commit is contained in:
parent
1fe33e266f
commit
b9b4b8798f
22
src/api.cc
22
src/api.cc
@ -7445,8 +7445,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::String> wire_bytes(obj->shared()->module_bytes(),
|
||||
obj->GetIsolate());
|
||||
i::Handle<i::String> wire_bytes(obj->module_bytes(), obj->GetIsolate());
|
||||
return Local<String>::Cast(Utils::ToLocal(wire_bytes));
|
||||
}
|
||||
|
||||
@ -9319,9 +9318,9 @@ bool debug::Script::GetPossibleBreakpoints(
|
||||
CHECK(!start.IsEmpty());
|
||||
i::Handle<i::Script> script = Utils::OpenHandle(this);
|
||||
if (script->type() == i::Script::TYPE_WASM) {
|
||||
i::WasmSharedModuleData* shared =
|
||||
i::WasmModuleObject::cast(script->wasm_module_object())->shared();
|
||||
return shared->GetPossibleBreakpoints(start, end, locations);
|
||||
i::WasmModuleObject* module_object =
|
||||
i::WasmModuleObject::cast(script->wasm_module_object());
|
||||
return module_object->GetPossibleBreakpoints(start, end, locations);
|
||||
}
|
||||
|
||||
i::Script::InitLineEnds(script);
|
||||
@ -9370,7 +9369,6 @@ int debug::Script::GetSourceOffset(const debug::Location& location) const {
|
||||
i::Handle<i::Script> script = Utils::OpenHandle(this);
|
||||
if (script->type() == i::Script::TYPE_WASM) {
|
||||
return i::WasmModuleObject::cast(script->wasm_module_object())
|
||||
->shared()
|
||||
->GetFunctionOffset(location.GetLineNumber()) +
|
||||
location.GetColumnNumber();
|
||||
}
|
||||
@ -9444,7 +9442,7 @@ int debug::WasmScript::NumFunctions() const {
|
||||
DCHECK_EQ(i::Script::TYPE_WASM, script->type());
|
||||
i::WasmModuleObject* module_object =
|
||||
i::WasmModuleObject::cast(script->wasm_module_object());
|
||||
i::wasm::WasmModule* module = module_object->shared()->module();
|
||||
i::wasm::WasmModule* module = module_object->module();
|
||||
DCHECK_GE(i::kMaxInt, module->functions.size());
|
||||
return static_cast<int>(module->functions.size());
|
||||
}
|
||||
@ -9455,7 +9453,7 @@ int debug::WasmScript::NumImportedFunctions() const {
|
||||
DCHECK_EQ(i::Script::TYPE_WASM, script->type());
|
||||
i::WasmModuleObject* module_object =
|
||||
i::WasmModuleObject::cast(script->wasm_module_object());
|
||||
i::wasm::WasmModule* module = module_object->shared()->module();
|
||||
i::wasm::WasmModule* module = module_object->module();
|
||||
DCHECK_GE(i::kMaxInt, module->num_imported_functions);
|
||||
return static_cast<int>(module->num_imported_functions);
|
||||
}
|
||||
@ -9467,7 +9465,7 @@ std::pair<int, int> debug::WasmScript::GetFunctionRange(
|
||||
DCHECK_EQ(i::Script::TYPE_WASM, script->type());
|
||||
i::WasmModuleObject* module_object =
|
||||
i::WasmModuleObject::cast(script->wasm_module_object());
|
||||
i::wasm::WasmModule* module = module_object->shared()->module();
|
||||
i::wasm::WasmModule* module = module_object->module();
|
||||
DCHECK_LE(0, function_index);
|
||||
DCHECK_GT(module->functions.size(), function_index);
|
||||
i::wasm::WasmFunction& func = module->functions[function_index];
|
||||
@ -9483,11 +9481,11 @@ uint32_t debug::WasmScript::GetFunctionHash(int function_index) {
|
||||
DCHECK_EQ(i::Script::TYPE_WASM, script->type());
|
||||
i::WasmModuleObject* module_object =
|
||||
i::WasmModuleObject::cast(script->wasm_module_object());
|
||||
i::wasm::WasmModule* module = module_object->shared()->module();
|
||||
i::wasm::WasmModule* module = module_object->module();
|
||||
DCHECK_LE(0, function_index);
|
||||
DCHECK_GT(module->functions.size(), function_index);
|
||||
i::wasm::WasmFunction& func = module->functions[function_index];
|
||||
i::SeqOneByteString* module_bytes = module_object->shared()->module_bytes();
|
||||
i::SeqOneByteString* module_bytes = module_object->module_bytes();
|
||||
i::wasm::ModuleWireBytes wire_bytes(
|
||||
module_bytes->GetFlatContent().ToOneByteVector());
|
||||
i::Vector<const i::byte> function_bytes = wire_bytes.GetFunctionBytes(&func);
|
||||
@ -9503,7 +9501,7 @@ debug::WasmDisassembly debug::WasmScript::DisassembleFunction(
|
||||
DCHECK_EQ(i::Script::TYPE_WASM, script->type());
|
||||
i::WasmModuleObject* module_object =
|
||||
i::WasmModuleObject::cast(script->wasm_module_object());
|
||||
return module_object->shared()->DisassembleFunction(function_index);
|
||||
return module_object->DisassembleFunction(function_index);
|
||||
}
|
||||
|
||||
debug::Location::Location(int line_number, int column_number)
|
||||
|
@ -316,7 +316,6 @@ Type::bitset BitsetType::Lub(HeapReferenceType const& type) {
|
||||
case WASM_COMPILED_MODULE_TYPE:
|
||||
case WASM_DEBUG_INFO_TYPE:
|
||||
case WASM_EXPORTED_FUNCTION_DATA_TYPE:
|
||||
case WASM_SHARED_MODULE_DATA_TYPE:
|
||||
case LOAD_HANDLER_TYPE:
|
||||
case STORE_HANDLER_TYPE:
|
||||
case ASYNC_GENERATOR_REQUEST_TYPE:
|
||||
|
@ -1316,21 +1316,22 @@ WASM_SUMMARY_DISPATCH(int, byte_offset)
|
||||
#undef WASM_SUMMARY_DISPATCH
|
||||
|
||||
int FrameSummary::WasmFrameSummary::SourcePosition() const {
|
||||
Handle<WasmSharedModuleData> shared(
|
||||
wasm_instance()->module_object()->shared(), isolate());
|
||||
return WasmSharedModuleData::GetSourcePosition(
|
||||
shared, function_index(), byte_offset(), at_to_number_conversion());
|
||||
Handle<WasmModuleObject> module_object(wasm_instance()->module_object(),
|
||||
isolate());
|
||||
return WasmModuleObject::GetSourcePosition(module_object, function_index(),
|
||||
byte_offset(),
|
||||
at_to_number_conversion());
|
||||
}
|
||||
|
||||
Handle<Script> FrameSummary::WasmFrameSummary::script() const {
|
||||
return handle(wasm_instance()->module_object()->shared()->script());
|
||||
return handle(wasm_instance()->module_object()->script());
|
||||
}
|
||||
|
||||
Handle<String> FrameSummary::WasmFrameSummary::FunctionName() const {
|
||||
Handle<WasmSharedModuleData> shared(
|
||||
wasm_instance()->module_object()->shared(), isolate());
|
||||
return WasmSharedModuleData::GetFunctionName(isolate(), shared,
|
||||
function_index());
|
||||
Handle<WasmModuleObject> module_object(wasm_instance()->module_object(),
|
||||
isolate());
|
||||
return WasmModuleObject::GetFunctionName(isolate(), module_object,
|
||||
function_index());
|
||||
}
|
||||
|
||||
Handle<Context> FrameSummary::WasmFrameSummary::native_context() const {
|
||||
@ -1763,7 +1764,7 @@ void WasmCompiledFrame::Print(StringStream* accumulator, PrintMode mode,
|
||||
->instruction_start();
|
||||
int pc = static_cast<int>(this->pc() - instruction_start);
|
||||
Vector<const uint8_t> raw_func_name =
|
||||
shared()->GetRawFunctionName(this->function_index());
|
||||
module_object()->GetRawFunctionName(this->function_index());
|
||||
const int kMaxPrintedFunctionName = 64;
|
||||
char func_name[kMaxPrintedFunctionName + 1];
|
||||
int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length());
|
||||
@ -1796,8 +1797,8 @@ WasmInstanceObject* WasmCompiledFrame::wasm_instance() const {
|
||||
return WasmInstanceObject::cast(instance);
|
||||
}
|
||||
|
||||
WasmSharedModuleData* WasmCompiledFrame::shared() const {
|
||||
return wasm_instance()->module_object()->shared();
|
||||
WasmModuleObject* WasmCompiledFrame::module_object() const {
|
||||
return wasm_instance()->module_object();
|
||||
}
|
||||
|
||||
WasmCompiledModule* WasmCompiledFrame::compiled_module() const {
|
||||
@ -1808,7 +1809,7 @@ uint32_t WasmCompiledFrame::function_index() const {
|
||||
return FrameSummary::GetSingle(this).AsWasmCompiled().function_index();
|
||||
}
|
||||
|
||||
Script* WasmCompiledFrame::script() const { return shared()->script(); }
|
||||
Script* WasmCompiledFrame::script() const { return module_object()->script(); }
|
||||
|
||||
int WasmCompiledFrame::position() const {
|
||||
return FrameSummary::GetSingle(this).SourcePosition();
|
||||
@ -1892,15 +1893,17 @@ WasmDebugInfo* WasmInterpreterEntryFrame::debug_info() const {
|
||||
return wasm_instance()->debug_info();
|
||||
}
|
||||
|
||||
WasmSharedModuleData* WasmInterpreterEntryFrame::shared() const {
|
||||
return wasm_instance()->module_object()->shared();
|
||||
WasmModuleObject* WasmInterpreterEntryFrame::module_object() const {
|
||||
return wasm_instance()->module_object();
|
||||
}
|
||||
|
||||
WasmCompiledModule* WasmInterpreterEntryFrame::compiled_module() const {
|
||||
return wasm_instance()->compiled_module();
|
||||
}
|
||||
|
||||
Script* WasmInterpreterEntryFrame::script() const { return shared()->script(); }
|
||||
Script* WasmInterpreterEntryFrame::script() const {
|
||||
return module_object()->script();
|
||||
}
|
||||
|
||||
int WasmInterpreterEntryFrame::position() const {
|
||||
return FrameSummary::GetBottom(this).AsWasmInterpreted().SourcePosition();
|
||||
|
@ -29,7 +29,7 @@ class ThreadLocalTop;
|
||||
class WasmCompiledModule;
|
||||
class WasmDebugInfo;
|
||||
class WasmInstanceObject;
|
||||
class WasmSharedModuleData;
|
||||
class WasmModuleObject;
|
||||
|
||||
class InnerPointerToCodeCache {
|
||||
public:
|
||||
@ -999,7 +999,7 @@ class WasmCompiledFrame final : public StandardFrame {
|
||||
private:
|
||||
friend class StackFrameIteratorBase;
|
||||
WasmCompiledModule* compiled_module() const;
|
||||
WasmSharedModuleData* shared() const;
|
||||
WasmModuleObject* module_object() const;
|
||||
};
|
||||
|
||||
class WasmInterpreterEntryFrame final : public StandardFrame {
|
||||
@ -1039,7 +1039,7 @@ class WasmInterpreterEntryFrame final : public StandardFrame {
|
||||
private:
|
||||
friend class StackFrameIteratorBase;
|
||||
WasmCompiledModule* compiled_module() const;
|
||||
WasmSharedModuleData* shared() const;
|
||||
WasmModuleObject* module_object() const;
|
||||
};
|
||||
|
||||
class WasmToJsFrame : public StubFrame {
|
||||
|
@ -472,7 +472,7 @@ class FrameArrayBuilder {
|
||||
}
|
||||
Handle<WasmInstanceObject> instance = summary.wasm_instance();
|
||||
int flags = 0;
|
||||
if (instance->module_object()->shared()->is_asm_js()) {
|
||||
if (instance->module_object()->is_asm_js()) {
|
||||
flags |= FrameArray::kIsAsmJsWasmFrame;
|
||||
if (WasmCompiledFrame::cast(frame)->at_to_number_conversion()) {
|
||||
flags |= FrameArray::kAsmJsAtNumberConversion;
|
||||
@ -491,7 +491,7 @@ class FrameArrayBuilder {
|
||||
const auto& summary = summ.AsWasmInterpreted();
|
||||
Handle<WasmInstanceObject> instance = summary.wasm_instance();
|
||||
int flags = FrameArray::kIsWasmInterpretedFrame;
|
||||
DCHECK(!instance->module_object()->shared()->is_asm_js());
|
||||
DCHECK(!instance->module_object()->is_asm_js());
|
||||
elements_ = FrameArray::AppendWasmFrame(elements_, instance,
|
||||
summary.function_index(), {},
|
||||
summary.byte_offset(), flags);
|
||||
@ -804,10 +804,10 @@ class CaptureStackTraceHelper {
|
||||
const FrameSummary::WasmFrameSummary& summ) {
|
||||
Handle<StackFrameInfo> info = factory()->NewStackFrameInfo();
|
||||
|
||||
Handle<WasmSharedModuleData> shared(
|
||||
summ.wasm_instance()->module_object()->shared(), isolate_);
|
||||
Handle<String> name = WasmSharedModuleData::GetFunctionName(
|
||||
isolate_, shared, summ.function_index());
|
||||
Handle<WasmModuleObject> module_object(
|
||||
summ.wasm_instance()->module_object(), isolate_);
|
||||
Handle<String> name = WasmModuleObject::GetFunctionName(
|
||||
isolate_, module_object, summ.function_index());
|
||||
info->set_function_name(*name);
|
||||
// Encode the function index as line number (1-based).
|
||||
info->set_line_number(summ.function_index() + 1);
|
||||
@ -1750,10 +1750,10 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
|
||||
bool is_at_number_conversion =
|
||||
elements->IsAsmJsWasmFrame(i) &&
|
||||
elements->Flags(i)->value() & FrameArray::kAsmJsAtNumberConversion;
|
||||
int pos = WasmSharedModuleData::GetSourcePosition(
|
||||
handle(instance->module_object()->shared(), this), func_index,
|
||||
byte_offset, is_at_number_conversion);
|
||||
Handle<Script> script(instance->module_object()->shared()->script());
|
||||
int pos = WasmModuleObject::GetSourcePosition(
|
||||
handle(instance->module_object(), this), func_index, byte_offset,
|
||||
is_at_number_conversion);
|
||||
Handle<Script> script(instance->module_object()->script());
|
||||
|
||||
*target = MessageLocation(script, pos, pos + 1);
|
||||
return true;
|
||||
|
@ -664,10 +664,10 @@ Handle<Object> WasmStackFrame::GetFunction() const {
|
||||
|
||||
Handle<Object> WasmStackFrame::GetFunctionName() {
|
||||
Handle<Object> name;
|
||||
Handle<WasmSharedModuleData> shared(wasm_instance_->module_object()->shared(),
|
||||
isolate_);
|
||||
if (!WasmSharedModuleData::GetFunctionNameOrNull(isolate_, shared,
|
||||
wasm_func_index_)
|
||||
Handle<WasmModuleObject> module_object(wasm_instance_->module_object(),
|
||||
isolate_);
|
||||
if (!WasmModuleObject::GetFunctionNameOrNull(isolate_, module_object,
|
||||
wasm_func_index_)
|
||||
.ToHandle(&name)) {
|
||||
name = isolate_->factory()->null_value();
|
||||
}
|
||||
@ -677,13 +677,12 @@ Handle<Object> WasmStackFrame::GetFunctionName() {
|
||||
MaybeHandle<String> WasmStackFrame::ToString() {
|
||||
IncrementalStringBuilder builder(isolate_);
|
||||
|
||||
Handle<WasmSharedModuleData> shared(wasm_instance_->module_object()->shared(),
|
||||
isolate_);
|
||||
Handle<WasmModuleObject> module_object(wasm_instance_->module_object(),
|
||||
isolate_);
|
||||
MaybeHandle<String> module_name =
|
||||
WasmSharedModuleData::GetModuleNameOrNull(isolate_, shared);
|
||||
MaybeHandle<String> function_name =
|
||||
WasmSharedModuleData::GetFunctionNameOrNull(isolate_, shared,
|
||||
wasm_func_index_);
|
||||
WasmModuleObject::GetModuleNameOrNull(isolate_, module_object);
|
||||
MaybeHandle<String> function_name = WasmModuleObject::GetFunctionNameOrNull(
|
||||
isolate_, module_object, wasm_func_index_);
|
||||
bool has_name = !module_name.is_null() || !function_name.is_null();
|
||||
if (has_name) {
|
||||
if (module_name.is_null()) {
|
||||
@ -726,7 +725,7 @@ Handle<Object> WasmStackFrame::Null() const {
|
||||
bool WasmStackFrame::HasScript() const { return true; }
|
||||
|
||||
Handle<Script> WasmStackFrame::GetScript() const {
|
||||
return handle(wasm_instance_->module_object()->shared()->script(), isolate_);
|
||||
return handle(wasm_instance_->module_object()->script(), isolate_);
|
||||
}
|
||||
|
||||
AsmJsWasmStackFrame::AsmJsWasmStackFrame() {}
|
||||
@ -750,15 +749,13 @@ Handle<Object> AsmJsWasmStackFrame::GetFunction() const {
|
||||
}
|
||||
|
||||
Handle<Object> AsmJsWasmStackFrame::GetFileName() {
|
||||
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
|
||||
isolate_);
|
||||
Handle<Script> script(wasm_instance_->module_object()->script(), isolate_);
|
||||
DCHECK(script->IsUserJavaScript());
|
||||
return handle(script->name(), isolate_);
|
||||
}
|
||||
|
||||
Handle<Object> AsmJsWasmStackFrame::GetScriptNameOrSourceUrl() {
|
||||
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
|
||||
isolate_);
|
||||
Handle<Script> script(wasm_instance_->module_object()->script(), isolate_);
|
||||
DCHECK_EQ(Script::TYPE_NORMAL, script->type());
|
||||
return ScriptNameOrSourceUrl(script, isolate_);
|
||||
}
|
||||
@ -768,26 +765,24 @@ int AsmJsWasmStackFrame::GetPosition() const {
|
||||
int byte_offset =
|
||||
FrameSummary::WasmCompiledFrameSummary::GetWasmSourcePosition(code_,
|
||||
offset_);
|
||||
Handle<WasmSharedModuleData> shared(wasm_instance_->module_object()->shared(),
|
||||
isolate_);
|
||||
Handle<WasmModuleObject> module_object(wasm_instance_->module_object(),
|
||||
isolate_);
|
||||
DCHECK_LE(0, byte_offset);
|
||||
return WasmSharedModuleData::GetSourcePosition(
|
||||
shared, wasm_func_index_, static_cast<uint32_t>(byte_offset),
|
||||
is_at_number_conversion_);
|
||||
return WasmModuleObject::GetSourcePosition(module_object, wasm_func_index_,
|
||||
static_cast<uint32_t>(byte_offset),
|
||||
is_at_number_conversion_);
|
||||
}
|
||||
|
||||
int AsmJsWasmStackFrame::GetLineNumber() {
|
||||
DCHECK_LE(0, GetPosition());
|
||||
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
|
||||
isolate_);
|
||||
Handle<Script> script(wasm_instance_->module_object()->script(), isolate_);
|
||||
DCHECK(script->IsUserJavaScript());
|
||||
return Script::GetLineNumber(script, GetPosition()) + 1;
|
||||
}
|
||||
|
||||
int AsmJsWasmStackFrame::GetColumnNumber() {
|
||||
DCHECK_LE(0, GetPosition());
|
||||
Handle<Script> script(wasm_instance_->module_object()->shared()->script(),
|
||||
isolate_);
|
||||
Handle<Script> script(wasm_instance_->module_object()->script(), isolate_);
|
||||
DCHECK(script->IsUserJavaScript());
|
||||
return Script::GetColumnNumber(script, GetPosition()) + 1;
|
||||
}
|
||||
|
@ -1631,8 +1631,10 @@ void WasmExportedFunctionData::WasmExportedFunctionDataVerify() {
|
||||
VerifySmiField(kFunctionIndexOffset);
|
||||
}
|
||||
|
||||
void WasmSharedModuleData::WasmSharedModuleDataVerify() {
|
||||
CHECK(IsWasmSharedModuleData());
|
||||
void WasmModuleObject::WasmModuleObjectVerify() {
|
||||
CHECK(IsWasmModuleObject());
|
||||
VerifyObjectField(kCompiledModuleOffset);
|
||||
VerifyObjectField(kExportWrappersOffset);
|
||||
VerifyObjectField(kManagedModuleOffset);
|
||||
CHECK(managed_module()->IsForeign());
|
||||
VerifyObjectField(kModuleBytesOffset);
|
||||
|
@ -1767,9 +1767,9 @@ void WasmExportedFunctionData::WasmExportedFunctionDataPrint(
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
void WasmSharedModuleData::WasmSharedModuleDataPrint(
|
||||
std::ostream& os) { // NOLINT
|
||||
HeapObject::PrintHeader(os, "WasmSharedModuleData");
|
||||
void WasmModuleObject::WasmModuleObjectPrint(std::ostream& os) { // NOLINT
|
||||
JSObjectPrintHeader(os, this, "WasmModuleObject");
|
||||
JSObjectPrintBody(os, this);
|
||||
os << "\n - module: " << module();
|
||||
os << "\n";
|
||||
}
|
||||
|
@ -13407,7 +13407,6 @@ bool Script::GetPositionInfo(int position, PositionInfo* info,
|
||||
if (type() == Script::TYPE_WASM) {
|
||||
DCHECK_LE(0, position);
|
||||
return WasmModuleObject::cast(wasm_module_object())
|
||||
->shared()
|
||||
->GetPositionInfo(static_cast<uint32_t>(position), info);
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,6 @@
|
||||
// - ModuleInfo
|
||||
// - ScriptContextTable
|
||||
// - FixedArrayOfWeakCells
|
||||
// - WasmSharedModuleData
|
||||
// - WasmCompiledModule
|
||||
// - FixedDoubleArray
|
||||
// - Name
|
||||
@ -404,7 +403,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
|
||||
V(WASM_COMPILED_MODULE_TYPE) \
|
||||
V(WASM_DEBUG_INFO_TYPE) \
|
||||
V(WASM_EXPORTED_FUNCTION_DATA_TYPE) \
|
||||
V(WASM_SHARED_MODULE_DATA_TYPE) \
|
||||
\
|
||||
V(CALLABLE_TASK_TYPE) \
|
||||
V(CALLBACK_TASK_TYPE) \
|
||||
@ -593,7 +591,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
|
||||
V(WASM_DEBUG_INFO, WasmDebugInfo, wasm_debug_info) \
|
||||
V(WASM_EXPORTED_FUNCTION_DATA, WasmExportedFunctionData, \
|
||||
wasm_exported_function_data) \
|
||||
V(WASM_SHARED_MODULE_DATA, WasmSharedModuleData, wasm_shared_module_data) \
|
||||
V(CALLABLE_TASK, CallableTask, callable_task) \
|
||||
V(CALLBACK_TASK, CallbackTask, callback_task) \
|
||||
V(PROMISE_FULFILL_REACTION_JOB_TASK, PromiseFulfillReactionJobTask, \
|
||||
@ -792,7 +789,6 @@ enum InstanceType : uint16_t {
|
||||
WASM_COMPILED_MODULE_TYPE,
|
||||
WASM_DEBUG_INFO_TYPE,
|
||||
WASM_EXPORTED_FUNCTION_DATA_TYPE,
|
||||
WASM_SHARED_MODULE_DATA_TYPE,
|
||||
|
||||
CALLABLE_TASK_TYPE, // FIRST_MICROTASK_TYPE
|
||||
CALLBACK_TASK_TYPE,
|
||||
|
@ -539,7 +539,6 @@ int ScriptLinePosition(Handle<Script> script, int line) {
|
||||
|
||||
if (script->type() == Script::TYPE_WASM) {
|
||||
return WasmModuleObject::cast(script->wasm_module_object())
|
||||
->shared()
|
||||
->GetFunctionOffset(line);
|
||||
}
|
||||
|
||||
|
@ -879,7 +879,7 @@ Maybe<bool> ValueSerializer::WriteWasmModule(Handle<WasmModuleObject> object) {
|
||||
WriteTag(SerializationTag::kWasmModule);
|
||||
WriteRawBytes(&encoding_tag, sizeof(encoding_tag));
|
||||
|
||||
Handle<String> wire_bytes(object->shared()->module_bytes(), isolate_);
|
||||
Handle<String> wire_bytes(object->module_bytes(), isolate_);
|
||||
int wire_bytes_length = wire_bytes->length();
|
||||
WriteVarint<uint32_t>(wire_bytes_length);
|
||||
uint8_t* destination;
|
||||
|
@ -487,7 +487,7 @@ class IndirectPatcher {
|
||||
|
||||
ModuleEnv CreateModuleEnvFromModuleObject(
|
||||
Isolate* isolate, Handle<WasmModuleObject> module_object) {
|
||||
WasmModule* module = module_object->shared()->module();
|
||||
WasmModule* module = module_object->module();
|
||||
wasm::UseTrapHandler use_trap_handler =
|
||||
module_object->compiled_module()->GetNativeModule()->use_trap_handler()
|
||||
? kUseTrapHandler
|
||||
@ -513,8 +513,8 @@ const wasm::WasmCode* LazyCompileFunction(
|
||||
// tracing / debugging.
|
||||
std::string func_name;
|
||||
{
|
||||
WasmName name = Vector<const char>::cast(
|
||||
module_object->shared()->GetRawFunctionName(func_index));
|
||||
WasmName name =
|
||||
Vector<const char>::cast(module_object->GetRawFunctionName(func_index));
|
||||
// Copy to std::string, because the underlying string object might move on
|
||||
// the heap.
|
||||
func_name.assign(name.start(), static_cast<size_t>(name.length()));
|
||||
@ -525,8 +525,7 @@ const wasm::WasmCode* LazyCompileFunction(
|
||||
ModuleEnv module_env =
|
||||
CreateModuleEnvFromModuleObject(isolate, module_object);
|
||||
|
||||
const uint8_t* module_start =
|
||||
module_object->shared()->module_bytes()->GetChars();
|
||||
const uint8_t* module_start = module_object->module_bytes()->GetChars();
|
||||
|
||||
const WasmFunction* func = &module_env.module->functions[func_index];
|
||||
FunctionBody body{func->sig, func->code.offset(),
|
||||
@ -658,16 +657,16 @@ const wasm::WasmCode* LazyCompileDirectCall(Isolate* isolate,
|
||||
uint32_t num_non_compiled_callees = 0; // For stats.
|
||||
{
|
||||
DisallowHeapAllocation no_gc;
|
||||
Handle<WasmSharedModuleData> shared(
|
||||
wasm_caller->native_module()->shared_module_data(), isolate);
|
||||
SeqOneByteString* module_bytes = shared->module_bytes();
|
||||
Handle<WasmModuleObject> module_object(
|
||||
wasm_caller->native_module()->module_object(), isolate);
|
||||
SeqOneByteString* module_bytes = module_object->module_bytes();
|
||||
uint32_t caller_func_index = wasm_caller->index();
|
||||
SourcePositionTableIterator source_pos_iterator(
|
||||
wasm_caller->source_positions());
|
||||
|
||||
const byte* func_bytes =
|
||||
module_bytes->GetChars() +
|
||||
shared->module()->functions[caller_func_index].code.offset();
|
||||
module_object->module()->functions[caller_func_index].code.offset();
|
||||
for (RelocIterator it(wasm_caller->instructions(),
|
||||
wasm_caller->reloc_info(),
|
||||
wasm_caller->constant_pool(),
|
||||
@ -1094,7 +1093,7 @@ void FinishCompilationUnits(CompilationState* compilation_state,
|
||||
|
||||
void UpdateAllCompiledModulesWithTopTierCode(
|
||||
Handle<WasmModuleObject> module_object) {
|
||||
WasmModule* module = module_object->shared()->module();
|
||||
WasmModule* module = module_object->module();
|
||||
DCHECK_GT(module->functions.size() - module->num_imported_functions, 0);
|
||||
USE(module);
|
||||
|
||||
@ -1295,7 +1294,7 @@ void CompileNativeModule(Isolate* isolate, ErrorThrower* thrower,
|
||||
const WasmModule* wasm_module, ModuleEnv* env) {
|
||||
WasmCompiledModule* compiled_module = module_object->compiled_module();
|
||||
NativeModule* const native_module = compiled_module->GetNativeModule();
|
||||
auto* byte_string = module_object->shared()->module_bytes();
|
||||
auto* byte_string = module_object->module_bytes();
|
||||
const ModuleWireBytes wire_bytes(
|
||||
byte_string->GetChars(), byte_string->GetChars() + byte_string->length());
|
||||
|
||||
@ -1347,7 +1346,7 @@ MaybeHandle<WasmModuleObject> CompileToModuleObjectInternal(
|
||||
|
||||
Factory* factory = isolate->factory();
|
||||
// Create heap objects for script, module bytes and asm.js offset table to
|
||||
// be stored in the shared module data.
|
||||
// be stored in the module object.
|
||||
Handle<Script> script;
|
||||
Handle<ByteArray> asm_js_offset_table;
|
||||
if (asm_js_script.is_null()) {
|
||||
@ -1375,15 +1374,11 @@ MaybeHandle<WasmModuleObject> CompileToModuleObjectInternal(
|
||||
Managed<WasmModule>::FromUniquePtr(isolate, module_size,
|
||||
std::move(module));
|
||||
|
||||
// Create the shared module data.
|
||||
// Create the module object.
|
||||
// TODO(clemensh): For the same module (same bytes / same hash), we should
|
||||
// only have one WasmSharedModuleData. Otherwise, we might only set
|
||||
// only have one WasmModuleObject. Otherwise, we might only set
|
||||
// breakpoints on a (potentially empty) subset of the instances.
|
||||
|
||||
Handle<WasmSharedModuleData> shared = WasmSharedModuleData::New(
|
||||
isolate, managed_module, Handle<SeqOneByteString>::cast(module_bytes),
|
||||
script, asm_js_offset_table);
|
||||
|
||||
int export_wrappers_size =
|
||||
static_cast<int>(wasm_module->num_exported_functions);
|
||||
Handle<FixedArray> export_wrappers =
|
||||
@ -1400,9 +1395,11 @@ MaybeHandle<WasmModuleObject> CompileToModuleObjectInternal(
|
||||
// object.
|
||||
Handle<WasmCompiledModule> compiled_module =
|
||||
NewCompiledModule(isolate, wasm_module, env);
|
||||
compiled_module->GetNativeModule()->SetSharedModuleData(shared);
|
||||
Handle<WasmModuleObject> module_object =
|
||||
WasmModuleObject::New(isolate, compiled_module, export_wrappers, shared);
|
||||
Handle<WasmModuleObject> module_object = WasmModuleObject::New(
|
||||
isolate, compiled_module, export_wrappers, managed_module,
|
||||
Handle<SeqOneByteString>::cast(module_bytes), script,
|
||||
asm_js_offset_table);
|
||||
compiled_module->GetNativeModule()->SetModuleObject(module_object);
|
||||
CompileNativeModule(isolate, thrower, module_object, wasm_module, &env);
|
||||
if (thrower->error()) return {};
|
||||
|
||||
@ -1553,7 +1550,7 @@ InstanceBuilder::InstanceBuilder(Isolate* isolate, ErrorThrower* thrower,
|
||||
MaybeHandle<JSReceiver> ffi,
|
||||
MaybeHandle<JSArrayBuffer> memory)
|
||||
: isolate_(isolate),
|
||||
module_(module_object->shared()->module()),
|
||||
module_(module_object->module()),
|
||||
async_counters_(isolate->async_counters()),
|
||||
thrower_(thrower),
|
||||
module_object_(module_object),
|
||||
@ -1864,8 +1861,7 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
|
||||
// Debugging support.
|
||||
//--------------------------------------------------------------------------
|
||||
// Set all breakpoints that were set on the shared module.
|
||||
WasmSharedModuleData::SetBreakpointsOnNewInstance(
|
||||
handle(module_object_->shared(), isolate_), instance);
|
||||
WasmModuleObject::SetBreakpointsOnNewInstance(module_object_, instance);
|
||||
|
||||
if (FLAG_wasm_interpret_all && module_->origin == kWasmOrigin) {
|
||||
Handle<WasmDebugInfo> debug_info =
|
||||
@ -2010,8 +2006,8 @@ uint32_t InstanceBuilder::EvalUint32InitExpr(const WasmInitExpr& expr) {
|
||||
|
||||
// Load data segments into the memory.
|
||||
void InstanceBuilder::LoadDataSegments(Handle<WasmInstanceObject> instance) {
|
||||
Handle<SeqOneByteString> module_bytes(
|
||||
module_object_->shared()->module_bytes(), isolate_);
|
||||
Handle<SeqOneByteString> module_bytes(module_object_->module_bytes(),
|
||||
isolate_);
|
||||
for (const WasmDataSegment& segment : module_->data_segments) {
|
||||
uint32_t source_size = segment.source.length();
|
||||
// Segments of size == 0 are just nops.
|
||||
@ -2085,14 +2081,13 @@ void InstanceBuilder::WriteGlobalValue(WasmGlobal& global,
|
||||
}
|
||||
|
||||
void InstanceBuilder::SanitizeImports() {
|
||||
Handle<SeqOneByteString> module_bytes(
|
||||
module_object_->shared()->module_bytes());
|
||||
Handle<SeqOneByteString> module_bytes(module_object_->module_bytes());
|
||||
for (size_t index = 0; index < module_->import_table.size(); ++index) {
|
||||
WasmImport& import = module_->import_table[index];
|
||||
|
||||
Handle<String> module_name;
|
||||
MaybeHandle<String> maybe_module_name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, module_bytes, import.module_name);
|
||||
if (!maybe_module_name.ToHandle(&module_name)) {
|
||||
thrower_->LinkError("Could not resolve module name for import %zu",
|
||||
@ -2102,7 +2097,7 @@ void InstanceBuilder::SanitizeImports() {
|
||||
|
||||
Handle<String> import_name;
|
||||
MaybeHandle<String> maybe_import_name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, module_bytes, import.field_name);
|
||||
if (!maybe_import_name.ToHandle(&import_name)) {
|
||||
thrower_->LinkError("Could not resolve import name for import %zu",
|
||||
@ -2566,10 +2561,9 @@ void InstanceBuilder::ProcessExports(Handle<WasmInstanceObject> instance) {
|
||||
// Process each export in the export table.
|
||||
int export_index = 0; // Index into {export_wrappers}.
|
||||
for (WasmExport& exp : module_->export_table) {
|
||||
Handle<String> name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, handle(module_object_->shared(), isolate_), exp.name)
|
||||
.ToHandleChecked();
|
||||
Handle<String> name = WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, module_object_, exp.name)
|
||||
.ToHandleChecked();
|
||||
Handle<JSObject> export_to;
|
||||
if (is_asm_js && exp.kind == kExternalFunction &&
|
||||
String::Equals(name, single_function_name)) {
|
||||
@ -2591,12 +2585,10 @@ void InstanceBuilder::ProcessExports(Handle<WasmInstanceObject> instance) {
|
||||
if (is_asm_js) {
|
||||
// For modules arising from asm.js, honor the names section.
|
||||
WireBytesRef func_name_ref = module_->LookupName(
|
||||
module_object_->shared()->module_bytes(), function.func_index);
|
||||
func_name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, handle(module_object_->shared(), isolate_),
|
||||
func_name_ref)
|
||||
.ToHandleChecked();
|
||||
module_object_->module_bytes(), function.func_index);
|
||||
func_name = WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, module_object_, func_name_ref)
|
||||
.ToHandleChecked();
|
||||
}
|
||||
js_function = WasmExportedFunction::New(
|
||||
isolate_, instance, func_name, function.func_index,
|
||||
@ -2777,12 +2769,10 @@ void InstanceBuilder::LoadTableSegments(Handle<WasmInstanceObject> instance) {
|
||||
if (module_->origin == kAsmJsOrigin) {
|
||||
// For modules arising from asm.js, honor the names section.
|
||||
WireBytesRef func_name_ref = module_->LookupName(
|
||||
module_object_->shared()->module_bytes(), func_index);
|
||||
func_name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, handle(module_object_->shared(), isolate_),
|
||||
func_name_ref)
|
||||
.ToHandleChecked();
|
||||
module_object_->module_bytes(), func_index);
|
||||
func_name = WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate_, module_object_, func_name_ref)
|
||||
.ToHandleChecked();
|
||||
}
|
||||
Handle<WasmExportedFunction> js_function =
|
||||
WasmExportedFunction::New(
|
||||
@ -2903,7 +2893,7 @@ void AsyncCompileJob::FinishCompile() {
|
||||
RecordStats(compiled_module_->GetNativeModule(), counters());
|
||||
|
||||
// Create heap objects for script and module bytes to be stored in the
|
||||
// shared module data. Asm.js is not compiled asynchronously.
|
||||
// module object. Asm.js is not compiled asynchronously.
|
||||
Handle<Script> script = CreateWasmScript(isolate_, wire_bytes_);
|
||||
Handle<ByteArray> asm_js_offset_table;
|
||||
// TODO(wasm): Improve efficiency of storing module wire bytes.
|
||||
@ -2928,18 +2918,17 @@ void AsyncCompileJob::FinishCompile() {
|
||||
Managed<WasmModule>::FromUniquePtr(isolate_, module_size,
|
||||
std::move(module_));
|
||||
|
||||
// Create the shared module data.
|
||||
// TODO(clemensh): For the same module (same bytes / same hash), we should
|
||||
// only have one WasmSharedModuleData. Otherwise, we might only set
|
||||
// breakpoints on a (potentially empty) subset of the instances.
|
||||
Handle<WasmSharedModuleData> shared = WasmSharedModuleData::New(
|
||||
isolate_, managed_module, Handle<SeqOneByteString>::cast(module_bytes),
|
||||
script, asm_js_offset_table);
|
||||
compiled_module_->GetNativeModule()->SetSharedModuleData(shared);
|
||||
|
||||
// Create the module object.
|
||||
module_object_ = WasmModuleObject::New(isolate_, compiled_module_,
|
||||
export_wrappers, shared);
|
||||
// TODO(clemensh): For the same module (same bytes / same hash), we should
|
||||
// only have one {WasmModuleObject}. Otherwise, we might only set
|
||||
// breakpoints on a (potentially empty) subset of the instances.
|
||||
// Create the module object.
|
||||
module_object_ = WasmModuleObject::New(
|
||||
isolate_, compiled_module_, export_wrappers, managed_module,
|
||||
Handle<SeqOneByteString>::cast(module_bytes), script,
|
||||
asm_js_offset_table);
|
||||
compiled_module_->GetNativeModule()->SetModuleObject(module_object_);
|
||||
|
||||
{
|
||||
DeferredHandleScope deferred(isolate_);
|
||||
module_object_ = handle(*module_object_, isolate_);
|
||||
@ -3265,7 +3254,7 @@ class AsyncCompileJob::FinishModule : public CompileStep {
|
||||
TRACE_COMPILE("(6) Finish module...\n");
|
||||
job_->AsyncCompileSucceeded(job_->module_object_);
|
||||
|
||||
WasmModule* module = job_->module_object_->shared()->module();
|
||||
WasmModule* module = job_->module_object_->module();
|
||||
size_t num_functions =
|
||||
module->functions.size() - module->num_imported_functions;
|
||||
if (job_->compiled_module_->GetNativeModule()
|
||||
@ -3745,7 +3734,7 @@ void CompileJsToWasmWrappers(Isolate* isolate,
|
||||
module_object->compiled_module()->GetNativeModule();
|
||||
wasm::UseTrapHandler use_trap_handler =
|
||||
native_module->use_trap_handler() ? kUseTrapHandler : kNoTrapHandler;
|
||||
WasmModule* module = native_module->shared_module_data()->module();
|
||||
WasmModule* module = native_module->module_object()->module();
|
||||
for (auto exp : module->export_table) {
|
||||
if (exp.kind != kExternalFunction) continue;
|
||||
Address call_target =
|
||||
|
@ -189,13 +189,13 @@ bool WasmCode::ShouldBeLogged(Isolate* isolate) {
|
||||
|
||||
void WasmCode::LogCode(Isolate* isolate) const {
|
||||
DCHECK(ShouldBeLogged(isolate));
|
||||
if (native_module()->shared_module_data() && index_.IsJust()) {
|
||||
if (index_.IsJust()) {
|
||||
uint32_t index = this->index();
|
||||
Handle<WasmSharedModuleData> shared_handle(
|
||||
native_module()->shared_module_data(), isolate);
|
||||
Handle<WasmModuleObject> module_object(native_module()->module_object(),
|
||||
isolate);
|
||||
int name_length;
|
||||
Handle<String> name(
|
||||
WasmSharedModuleData::GetFunctionName(isolate, shared_handle, index));
|
||||
WasmModuleObject::GetFunctionName(isolate, module_object, index));
|
||||
auto cname =
|
||||
name->ToCString(AllowNullsFlag::DISALLOW_NULLS,
|
||||
RobustnessFlag::ROBUST_STRING_TRAVERSAL, &name_length);
|
||||
@ -457,16 +457,18 @@ void NativeModule::SetRuntimeStubs(Isolate* isolate) {
|
||||
#undef COPY_BUILTIN
|
||||
}
|
||||
|
||||
WasmSharedModuleData* NativeModule::shared_module_data() const {
|
||||
DCHECK_NOT_NULL(shared_module_data_);
|
||||
return *shared_module_data_;
|
||||
WasmModuleObject* NativeModule::module_object() const {
|
||||
DCHECK_NOT_NULL(module_object_);
|
||||
return *module_object_;
|
||||
}
|
||||
|
||||
void NativeModule::SetSharedModuleData(Handle<WasmSharedModuleData> shared) {
|
||||
DCHECK_NULL(shared_module_data_);
|
||||
shared_module_data_ =
|
||||
shared->GetIsolate()->global_handles()->Create(*shared).location();
|
||||
GlobalHandles::MakeWeak(reinterpret_cast<Object***>(&shared_module_data_));
|
||||
void NativeModule::SetModuleObject(Handle<WasmModuleObject> module_object) {
|
||||
DCHECK_NULL(module_object_);
|
||||
module_object_ = module_object->GetIsolate()
|
||||
->global_handles()
|
||||
->Create(*module_object)
|
||||
.location();
|
||||
GlobalHandles::MakeWeak(reinterpret_cast<Object***>(&module_object_));
|
||||
}
|
||||
|
||||
WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
|
||||
@ -843,11 +845,11 @@ NativeModule::~NativeModule() {
|
||||
TRACE_HEAP("Deleting native module: %p\n", reinterpret_cast<void*>(this));
|
||||
// Clear the handle at the beginning of destructor to make it robust against
|
||||
// potential GCs in the rest of the destructor.
|
||||
if (shared_module_data_ != nullptr) {
|
||||
Isolate* isolate = shared_module_data()->GetIsolate();
|
||||
if (module_object_ != nullptr) {
|
||||
Isolate* isolate = module_object()->GetIsolate();
|
||||
isolate->global_handles()->Destroy(
|
||||
reinterpret_cast<Object**>(shared_module_data_));
|
||||
shared_module_data_ = nullptr;
|
||||
reinterpret_cast<Object**>(module_object_));
|
||||
module_object_ = nullptr;
|
||||
}
|
||||
wasm_code_manager_->FreeNativeModule(this);
|
||||
}
|
||||
|
@ -317,10 +317,10 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
|
||||
CompilationState* compilation_state() { return compilation_state_.get(); }
|
||||
|
||||
// TODO(mstarzinger): The link to the {shared_module_data} is deprecated and
|
||||
// TODO(mstarzinger): The link to the {WasmModuleObject} is deprecated and
|
||||
// all uses should vanish to make {NativeModule} independent of the Isolate.
|
||||
WasmSharedModuleData* shared_module_data() const;
|
||||
void SetSharedModuleData(Handle<WasmSharedModuleData>);
|
||||
WasmModuleObject* module_object() const;
|
||||
void SetModuleObject(Handle<WasmModuleObject>);
|
||||
|
||||
uint32_t num_functions() const { return num_functions_; }
|
||||
uint32_t num_imported_functions() const { return num_imported_functions_; }
|
||||
@ -391,10 +391,10 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
|
||||
std::unique_ptr<CompilationState, CompilationStateDeleter> compilation_state_;
|
||||
|
||||
// A phantom reference to the {WasmSharedModuleData}. It is intentionally not
|
||||
// typed {Handle<WasmSharedModuleData>} because this location will be cleared
|
||||
// A phantom reference to the {WasmModuleObject}. It is intentionally not
|
||||
// typed {Handle<WasmModuleObject>} because this location will be cleared
|
||||
// when the phantom reference is cleared.
|
||||
WasmSharedModuleData** shared_module_data_ = nullptr;
|
||||
WasmModuleObject** module_object_ = nullptr;
|
||||
|
||||
DisjointAllocationPool free_code_space_;
|
||||
DisjointAllocationPool allocated_code_space_;
|
||||
|
@ -46,9 +46,9 @@ class PatchDirectCallsHelper {
|
||||
PatchDirectCallsHelper(NativeModule* native_module, const WasmCode* code)
|
||||
: source_pos_it(code->source_positions()), decoder(nullptr, nullptr) {
|
||||
uint32_t func_index = code->index();
|
||||
WasmSharedModuleData* shared = native_module->shared_module_data();
|
||||
func_bytes = shared->module_bytes()->GetChars() +
|
||||
shared->module()->functions[func_index].code.offset();
|
||||
WasmModuleObject* module_object = native_module->module_object();
|
||||
func_bytes = module_object->module_bytes()->GetChars() +
|
||||
module_object->module()->functions[func_index].code.offset();
|
||||
}
|
||||
|
||||
SourcePositionTableIterator source_pos_it;
|
||||
@ -72,9 +72,9 @@ bool CodeSpecialization::ApplyToWholeModule(
|
||||
NativeModule* native_module, Handle<WasmModuleObject> module_object,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
WasmSharedModuleData* shared = module_object->shared();
|
||||
WasmModule* module = shared->module();
|
||||
std::vector<WasmFunction>* wasm_functions = &shared->module()->functions;
|
||||
WasmModule* module = module_object->module();
|
||||
std::vector<WasmFunction>* wasm_functions =
|
||||
&module_object->module()->functions;
|
||||
FixedArray* export_wrappers = module_object->export_wrappers();
|
||||
DCHECK_EQ(export_wrappers->length(), module->num_exported_functions);
|
||||
|
||||
|
@ -70,9 +70,10 @@ MaybeHandle<String> GetLocalName(Isolate* isolate,
|
||||
DCHECK_LE(0, func_index);
|
||||
DCHECK_LE(0, local_index);
|
||||
if (!debug_info->has_locals_names()) {
|
||||
Handle<WasmSharedModuleData> shared(
|
||||
debug_info->wasm_instance()->module_object()->shared(), isolate);
|
||||
Handle<FixedArray> locals_names = wasm::DecodeLocalNames(isolate, shared);
|
||||
Handle<WasmModuleObject> module_object(
|
||||
debug_info->wasm_instance()->module_object(), isolate);
|
||||
Handle<FixedArray> locals_names =
|
||||
wasm::DecodeLocalNames(isolate, module_object);
|
||||
debug_info->set_locals_names(*locals_names);
|
||||
}
|
||||
|
||||
@ -133,7 +134,7 @@ class InterpreterHandle {
|
||||
// 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()->module_object()->shared()->module_bytes();
|
||||
debug_info->wasm_instance()->module_object()->module_bytes();
|
||||
return {bytes_str->GetChars(), static_cast<size_t>(bytes_str->length())};
|
||||
}
|
||||
|
||||
@ -141,8 +142,7 @@ class InterpreterHandle {
|
||||
// TODO(wasm): properly handlify this constructor.
|
||||
InterpreterHandle(Isolate* isolate, WasmDebugInfo* debug_info)
|
||||
: isolate_(isolate),
|
||||
module_(
|
||||
debug_info->wasm_instance()->module_object()->shared()->module()),
|
||||
module_(debug_info->wasm_instance()->module_object()->module()),
|
||||
interpreter_(isolate, module_, GetBytes(debug_info),
|
||||
handle(debug_info->wasm_instance(), isolate)) {}
|
||||
|
||||
@ -306,11 +306,11 @@ class InterpreterHandle {
|
||||
|
||||
// Check whether we hit a breakpoint.
|
||||
if (isolate_->debug()->break_points_active()) {
|
||||
Handle<WasmSharedModuleData> shared(
|
||||
GetInstanceObject()->module_object()->shared(), isolate_);
|
||||
int position = GetTopPosition(shared);
|
||||
Handle<WasmModuleObject> module_object(
|
||||
GetInstanceObject()->module_object(), isolate_);
|
||||
int position = GetTopPosition(module_object);
|
||||
Handle<FixedArray> breakpoints;
|
||||
if (WasmSharedModuleData::CheckBreakPoints(isolate_, shared, position)
|
||||
if (WasmModuleObject::CheckBreakPoints(isolate_, module_object, position)
|
||||
.ToHandle(&breakpoints)) {
|
||||
// We hit one or several breakpoints. Clear stepping, notify the
|
||||
// listeners and return.
|
||||
@ -343,13 +343,13 @@ class InterpreterHandle {
|
||||
isolate_->debug()->OnDebugBreak(isolate_->factory()->empty_fixed_array());
|
||||
}
|
||||
|
||||
int GetTopPosition(Handle<WasmSharedModuleData> shared) {
|
||||
int GetTopPosition(Handle<WasmModuleObject> module_object) {
|
||||
DCHECK_EQ(1, interpreter()->GetThreadCount());
|
||||
WasmInterpreter::Thread* thread = interpreter()->GetThread(0);
|
||||
DCHECK_LT(0, thread->GetFrameCount());
|
||||
|
||||
auto frame = thread->GetFrame(thread->GetFrameCount() - 1);
|
||||
return shared->GetFunctionOffset(frame->function()->func_index) +
|
||||
return module_object->GetFunctionOffset(frame->function()->func_index) +
|
||||
frame->pc();
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,6 @@ bool IsWasmCodegenAllowed(Isolate* isolate, Handle<Context> context) {
|
||||
|
||||
Handle<JSArray> GetImports(Isolate* isolate,
|
||||
Handle<WasmModuleObject> module_object) {
|
||||
Handle<WasmSharedModuleData> shared(module_object->shared(), isolate);
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
Handle<String> module_string = factory->InternalizeUtf8String("module");
|
||||
@ -139,7 +138,7 @@ Handle<JSArray> GetImports(Isolate* isolate,
|
||||
Handle<String> global_string = factory->InternalizeUtf8String("global");
|
||||
|
||||
// Create the result array.
|
||||
WasmModule* module = shared->module();
|
||||
WasmModule* module = module_object->module();
|
||||
int num_imports = static_cast<int>(module->import_table.size());
|
||||
Handle<JSArray> array_object = factory->NewJSArray(PACKED_ELEMENTS, 0, 0);
|
||||
Handle<FixedArray> storage = factory->NewFixedArray(num_imports);
|
||||
@ -174,12 +173,12 @@ Handle<JSArray> GetImports(Isolate* isolate,
|
||||
}
|
||||
|
||||
MaybeHandle<String> import_module =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, shared, import.module_name);
|
||||
WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, module_object, import.module_name);
|
||||
|
||||
MaybeHandle<String> import_name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, shared, import.field_name);
|
||||
WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, module_object, import.field_name);
|
||||
|
||||
JSObject::AddProperty(entry, module_string, import_module.ToHandleChecked(),
|
||||
NONE);
|
||||
@ -195,7 +194,6 @@ Handle<JSArray> GetImports(Isolate* isolate,
|
||||
|
||||
Handle<JSArray> GetExports(Isolate* isolate,
|
||||
Handle<WasmModuleObject> module_object) {
|
||||
Handle<WasmSharedModuleData> shared(module_object->shared(), isolate);
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
Handle<String> name_string = factory->InternalizeUtf8String("name");
|
||||
@ -207,7 +205,7 @@ Handle<JSArray> GetExports(Isolate* isolate,
|
||||
Handle<String> global_string = factory->InternalizeUtf8String("global");
|
||||
|
||||
// Create the result array.
|
||||
WasmModule* module = shared->module();
|
||||
WasmModule* module = module_object->module();
|
||||
int num_exports = static_cast<int>(module->export_table.size());
|
||||
Handle<JSArray> array_object = factory->NewJSArray(PACKED_ELEMENTS, 0, 0);
|
||||
Handle<FixedArray> storage = factory->NewFixedArray(num_exports);
|
||||
@ -242,8 +240,8 @@ Handle<JSArray> GetExports(Isolate* isolate,
|
||||
Handle<JSObject> entry = factory->NewJSObject(object_function);
|
||||
|
||||
MaybeHandle<String> export_name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(isolate, shared,
|
||||
exp.name);
|
||||
WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, module_object, exp.name);
|
||||
|
||||
JSObject::AddProperty(entry, name_string, export_name.ToHandleChecked(),
|
||||
NONE);
|
||||
@ -258,13 +256,13 @@ Handle<JSArray> GetExports(Isolate* isolate,
|
||||
Handle<JSArray> GetCustomSections(Isolate* isolate,
|
||||
Handle<WasmModuleObject> module_object,
|
||||
Handle<String> name, ErrorThrower* thrower) {
|
||||
Handle<WasmSharedModuleData> shared(module_object->shared(), isolate);
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
std::vector<CustomSectionOffset> custom_sections;
|
||||
{
|
||||
DisallowHeapAllocation no_gc; // for raw access to string bytes.
|
||||
Handle<SeqOneByteString> module_bytes(shared->module_bytes(), isolate);
|
||||
Handle<SeqOneByteString> module_bytes(module_object->module_bytes(),
|
||||
isolate);
|
||||
const byte* start =
|
||||
reinterpret_cast<const byte*>(module_bytes->GetCharsAddress());
|
||||
const byte* end = start + module_bytes->length();
|
||||
@ -276,8 +274,8 @@ Handle<JSArray> GetCustomSections(Isolate* isolate,
|
||||
// Gather matching sections.
|
||||
for (auto& section : custom_sections) {
|
||||
MaybeHandle<String> section_name =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(isolate, shared,
|
||||
section.name);
|
||||
WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, module_object, section.name);
|
||||
|
||||
if (!name->Equals(*section_name.ToHandleChecked())) continue;
|
||||
|
||||
@ -294,7 +292,8 @@ Handle<JSArray> GetCustomSections(Isolate* isolate,
|
||||
constexpr bool is_external = false;
|
||||
JSArrayBuffer::Setup(buffer, isolate, is_external, memory, size);
|
||||
DisallowHeapAllocation no_gc; // for raw access to string bytes.
|
||||
Handle<SeqOneByteString> module_bytes(shared->module_bytes(), isolate);
|
||||
Handle<SeqOneByteString> module_bytes(module_object->module_bytes(),
|
||||
isolate);
|
||||
const byte* start =
|
||||
reinterpret_cast<const byte*>(module_bytes->GetCharsAddress());
|
||||
memcpy(memory, start + section.payload.offset(), section.payload.length());
|
||||
@ -316,8 +315,8 @@ Handle<JSArray> GetCustomSections(Isolate* isolate,
|
||||
}
|
||||
|
||||
Handle<FixedArray> DecodeLocalNames(Isolate* isolate,
|
||||
Handle<WasmSharedModuleData> shared) {
|
||||
Handle<SeqOneByteString> wire_bytes(shared->module_bytes(), isolate);
|
||||
Handle<WasmModuleObject> module_object) {
|
||||
Handle<SeqOneByteString> wire_bytes(module_object->module_bytes(), isolate);
|
||||
LocalNames decoded_locals;
|
||||
{
|
||||
DisallowHeapAllocation no_gc;
|
||||
@ -333,8 +332,8 @@ Handle<FixedArray> DecodeLocalNames(Isolate* isolate,
|
||||
locals_names->set(func.function_index, *func_locals_names);
|
||||
for (LocalName& name : func.names) {
|
||||
Handle<String> name_str =
|
||||
WasmSharedModuleData::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, shared, name.name)
|
||||
WasmModuleObject::ExtractUtf8StringFromModuleBytes(
|
||||
isolate, module_object, name.name)
|
||||
.ToHandleChecked();
|
||||
func_locals_names->set(name.local_index, *name_str);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ class WasmGlobalObject;
|
||||
class WasmInstanceObject;
|
||||
class WasmMemoryObject;
|
||||
class WasmModuleObject;
|
||||
class WasmSharedModuleData;
|
||||
class WasmTableObject;
|
||||
|
||||
namespace compiler {
|
||||
@ -262,7 +261,7 @@ V8_EXPORT_PRIVATE Handle<JSArray> GetCustomSections(
|
||||
// Decode local variable names from the names section. Return FixedArray of
|
||||
// FixedArray of <undefined|String>. The outer fixed array is indexed by the
|
||||
// function index, the inner one by the local index.
|
||||
Handle<FixedArray> DecodeLocalNames(Isolate*, Handle<WasmSharedModuleData>);
|
||||
Handle<FixedArray> DecodeLocalNames(Isolate*, Handle<WasmModuleObject>);
|
||||
|
||||
// TruncatedUserString makes it easy to output names up to a certain length, and
|
||||
// output a truncation followed by '...' if they exceed a limit.
|
||||
|
@ -26,7 +26,6 @@ CAST_ACCESSOR(WasmGlobalObject)
|
||||
CAST_ACCESSOR(WasmInstanceObject)
|
||||
CAST_ACCESSOR(WasmMemoryObject)
|
||||
CAST_ACCESSOR(WasmModuleObject)
|
||||
CAST_ACCESSOR(WasmSharedModuleData)
|
||||
CAST_ACCESSOR(WasmTableObject)
|
||||
|
||||
#define OPTIONAL_ACCESSORS(holder, name, type, offset) \
|
||||
@ -53,7 +52,16 @@ CAST_ACCESSOR(WasmTableObject)
|
||||
ACCESSORS(WasmModuleObject, compiled_module, WasmCompiledModule,
|
||||
kCompiledModuleOffset)
|
||||
ACCESSORS(WasmModuleObject, export_wrappers, FixedArray, kExportWrappersOffset)
|
||||
ACCESSORS(WasmModuleObject, shared, WasmSharedModuleData, kSharedOffset)
|
||||
ACCESSORS(WasmModuleObject, managed_module, Object, kManagedModuleOffset)
|
||||
ACCESSORS(WasmModuleObject, module_bytes, SeqOneByteString, kModuleBytesOffset)
|
||||
ACCESSORS(WasmModuleObject, script, Script, kScriptOffset)
|
||||
OPTIONAL_ACCESSORS(WasmModuleObject, asm_js_offset_table, ByteArray,
|
||||
kAsmJsOffsetTableOffset)
|
||||
OPTIONAL_ACCESSORS(WasmModuleObject, breakpoint_infos, FixedArray,
|
||||
kBreakPointInfosOffset)
|
||||
void WasmModuleObject::reset_breakpoint_infos() {
|
||||
WRITE_FIELD(this, kBreakPointInfosOffset, GetHeap()->undefined_value());
|
||||
}
|
||||
|
||||
// WasmTableObject
|
||||
ACCESSORS(WasmTableObject, functions, FixedArray, kFunctionsOffset)
|
||||
@ -185,20 +193,6 @@ ACCESSORS(WasmExportedFunctionData, instance, WasmInstanceObject,
|
||||
kInstanceOffset)
|
||||
SMI_ACCESSORS(WasmExportedFunctionData, function_index, kFunctionIndexOffset)
|
||||
|
||||
// WasmSharedModuleData
|
||||
ACCESSORS(WasmSharedModuleData, managed_module, Object, kManagedModuleOffset)
|
||||
ACCESSORS(WasmSharedModuleData, module_bytes, SeqOneByteString,
|
||||
kModuleBytesOffset)
|
||||
ACCESSORS(WasmSharedModuleData, script, Script, kScriptOffset)
|
||||
OPTIONAL_ACCESSORS(WasmSharedModuleData, asm_js_offset_table, ByteArray,
|
||||
kAsmJsOffsetTableOffset)
|
||||
OPTIONAL_ACCESSORS(WasmSharedModuleData, breakpoint_infos, FixedArray,
|
||||
kBreakPointInfosOffset)
|
||||
void WasmSharedModuleData::reset_breakpoint_infos() {
|
||||
DCHECK(IsWasmSharedModuleData());
|
||||
WRITE_FIELD(this, kBreakPointInfosOffset, GetHeap()->undefined_value());
|
||||
}
|
||||
|
||||
// WasmDebugInfo
|
||||
ACCESSORS(WasmDebugInfo, wasm_instance, WasmInstanceObject, kInstanceOffset)
|
||||
ACCESSORS(WasmDebugInfo, interpreter_handle, Object, kInterpreterHandleOffset)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -108,13 +108,27 @@ class WasmModuleObject : public JSObject {
|
||||
// Shared compiled code between multiple WebAssembly.Module objects.
|
||||
DECL_ACCESSORS(compiled_module, WasmCompiledModule)
|
||||
DECL_ACCESSORS(export_wrappers, FixedArray)
|
||||
DECL_ACCESSORS(shared, WasmSharedModuleData)
|
||||
DECL_ACCESSORS(managed_module, Object)
|
||||
wasm::WasmModule* module() const;
|
||||
DECL_ACCESSORS(module_bytes, SeqOneByteString)
|
||||
DECL_ACCESSORS(script, Script)
|
||||
DECL_OPTIONAL_ACCESSORS(asm_js_offset_table, ByteArray)
|
||||
DECL_OPTIONAL_ACCESSORS(breakpoint_infos, FixedArray)
|
||||
inline void reset_breakpoint_infos();
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER(WasmModuleObject)
|
||||
DECL_VERIFIER(WasmModuleObject)
|
||||
|
||||
// Layout description.
|
||||
#define WASM_MODULE_OBJECT_FIELDS(V) \
|
||||
V(kCompiledModuleOffset, kPointerSize) \
|
||||
V(kExportWrappersOffset, kPointerSize) \
|
||||
V(kSharedOffset, kPointerSize) \
|
||||
#define WASM_MODULE_OBJECT_FIELDS(V) \
|
||||
V(kCompiledModuleOffset, kPointerSize) \
|
||||
V(kExportWrappersOffset, kPointerSize) \
|
||||
V(kManagedModuleOffset, kPointerSize) \
|
||||
V(kModuleBytesOffset, kPointerSize) \
|
||||
V(kScriptOffset, kPointerSize) \
|
||||
V(kAsmJsOffsetTableOffset, kPointerSize) \
|
||||
V(kBreakPointInfosOffset, kPointerSize) \
|
||||
V(kSize, 0)
|
||||
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize,
|
||||
@ -123,7 +137,9 @@ class WasmModuleObject : public JSObject {
|
||||
|
||||
static Handle<WasmModuleObject> New(
|
||||
Isolate* isolate, Handle<WasmCompiledModule> compiled_module,
|
||||
Handle<FixedArray> export_wrappers, Handle<WasmSharedModuleData> shared);
|
||||
Handle<FixedArray> export_wrappers, Handle<Foreign> managed_module,
|
||||
Handle<SeqOneByteString> module_bytes, Handle<Script> script,
|
||||
Handle<ByteArray> asm_js_offset_table);
|
||||
|
||||
// Set a breakpoint on the given byte position inside the given module.
|
||||
// This will affect all live and future instances of the module.
|
||||
@ -136,6 +152,86 @@ class WasmModuleObject : public JSObject {
|
||||
|
||||
static void ValidateStateForTesting(Isolate* isolate,
|
||||
Handle<WasmModuleObject> module);
|
||||
|
||||
// Check whether this module was generated from asm.js source.
|
||||
bool is_asm_js();
|
||||
|
||||
static void AddBreakpoint(Handle<WasmModuleObject>, int position,
|
||||
Handle<BreakPoint> break_point);
|
||||
|
||||
static void SetBreakpointsOnNewInstance(Handle<WasmModuleObject>,
|
||||
Handle<WasmInstanceObject>);
|
||||
|
||||
// Get the module name, if set. Returns an empty handle otherwise.
|
||||
static MaybeHandle<String> GetModuleNameOrNull(Isolate*,
|
||||
Handle<WasmModuleObject>);
|
||||
|
||||
// Get the function name of the function identified by the given index.
|
||||
// Returns a null handle if the function is unnamed or the name is not a valid
|
||||
// UTF-8 string.
|
||||
static MaybeHandle<String> GetFunctionNameOrNull(Isolate*,
|
||||
Handle<WasmModuleObject>,
|
||||
uint32_t func_index);
|
||||
|
||||
// Get the function name of the function identified by the given index.
|
||||
// Returns "<WASM UNNAMED>" if the function is unnamed or the name is not a
|
||||
// valid UTF-8 string.
|
||||
static Handle<String> GetFunctionName(Isolate*, Handle<WasmModuleObject>,
|
||||
uint32_t func_index);
|
||||
|
||||
// Get the raw bytes of the function name of the function identified by the
|
||||
// given index.
|
||||
// Meant to be used for debugging or frame printing.
|
||||
// Does not allocate, hence gc-safe.
|
||||
Vector<const uint8_t> GetRawFunctionName(uint32_t func_index);
|
||||
|
||||
// Return the byte offset of the function identified by the given index.
|
||||
// The offset will be relative to the start of the module bytes.
|
||||
// Returns -1 if the function index is invalid.
|
||||
int GetFunctionOffset(uint32_t func_index);
|
||||
|
||||
// Returns the function containing the given byte offset.
|
||||
// Returns -1 if the byte offset is not contained in any function of this
|
||||
// module.
|
||||
int GetContainingFunction(uint32_t byte_offset);
|
||||
|
||||
// Translate from byte offset in the module to function number and byte offset
|
||||
// within that function, encoded as line and column in the position info.
|
||||
// Returns true if the position is valid inside this module, false otherwise.
|
||||
bool GetPositionInfo(uint32_t position, Script::PositionInfo* info);
|
||||
|
||||
// Get the source position from a given function index and byte offset,
|
||||
// for either asm.js or pure WASM modules.
|
||||
static int GetSourcePosition(Handle<WasmModuleObject>, uint32_t func_index,
|
||||
uint32_t byte_offset,
|
||||
bool is_at_number_conversion);
|
||||
|
||||
// Compute the disassembly of a wasm function.
|
||||
// Returns the disassembly string and a list of <byte_offset, line, column>
|
||||
// entries, mapping wasm byte offsets to line and column in the disassembly.
|
||||
// The list is guaranteed to be ordered by the byte_offset.
|
||||
// Returns an empty string and empty vector if the function index is invalid.
|
||||
debug::WasmDisassembly DisassembleFunction(int func_index);
|
||||
|
||||
// Extract a portion of the wire bytes as UTF-8 string.
|
||||
// Returns a null handle if the respective bytes do not form a valid UTF-8
|
||||
// string.
|
||||
static MaybeHandle<String> ExtractUtf8StringFromModuleBytes(
|
||||
Isolate* isolate, Handle<WasmModuleObject>, wasm::WireBytesRef ref);
|
||||
static MaybeHandle<String> ExtractUtf8StringFromModuleBytes(
|
||||
Isolate* isolate, Handle<SeqOneByteString> module_bytes,
|
||||
wasm::WireBytesRef ref);
|
||||
|
||||
// Get a list of all possible breakpoints within a given range of this module.
|
||||
bool GetPossibleBreakpoints(const debug::Location& start,
|
||||
const debug::Location& end,
|
||||
std::vector<debug::BreakLocation>* locations);
|
||||
|
||||
// Return an empty handle if no breakpoint is hit at that location, or a
|
||||
// FixedArray with all hit breakpoint objects.
|
||||
static MaybeHandle<FixedArray> CheckBreakPoints(Isolate*,
|
||||
Handle<WasmModuleObject>,
|
||||
int position);
|
||||
};
|
||||
|
||||
// Representation of a WebAssembly.Table JavaScript-level object.
|
||||
@ -423,122 +519,6 @@ class WasmExportedFunctionData : public Struct {
|
||||
#undef WASM_EXPORTED_FUNCTION_DATA_FIELDS
|
||||
};
|
||||
|
||||
// Information shared by all WasmCompiledModule objects for the same module.
|
||||
class WasmSharedModuleData : public Struct {
|
||||
public:
|
||||
DECL_ACCESSORS(managed_module, Object)
|
||||
wasm::WasmModule* module() const;
|
||||
DECL_ACCESSORS(module_bytes, SeqOneByteString)
|
||||
DECL_ACCESSORS(script, Script)
|
||||
DECL_OPTIONAL_ACCESSORS(asm_js_offset_table, ByteArray)
|
||||
DECL_OPTIONAL_ACCESSORS(breakpoint_infos, FixedArray)
|
||||
inline void reset_breakpoint_infos();
|
||||
|
||||
DECL_CAST(WasmSharedModuleData)
|
||||
|
||||
// Dispatched behavior.
|
||||
DECL_PRINTER(WasmSharedModuleData)
|
||||
DECL_VERIFIER(WasmSharedModuleData)
|
||||
|
||||
// Layout description.
|
||||
#define WASM_SHARED_MODULE_DATA_FIELDS(V) \
|
||||
V(kManagedModuleOffset, kPointerSize) \
|
||||
V(kModuleBytesOffset, kPointerSize) \
|
||||
V(kScriptOffset, kPointerSize) \
|
||||
V(kAsmJsOffsetTableOffset, kPointerSize) \
|
||||
V(kBreakPointInfosOffset, kPointerSize) \
|
||||
V(kSize, 0)
|
||||
|
||||
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
|
||||
WASM_SHARED_MODULE_DATA_FIELDS)
|
||||
#undef WASM_SHARED_MODULE_DATA_FIELDS
|
||||
|
||||
// Check whether this module was generated from asm.js source.
|
||||
bool is_asm_js();
|
||||
|
||||
static void AddBreakpoint(Handle<WasmSharedModuleData>, int position,
|
||||
Handle<BreakPoint> break_point);
|
||||
|
||||
static void SetBreakpointsOnNewInstance(Handle<WasmSharedModuleData>,
|
||||
Handle<WasmInstanceObject>);
|
||||
|
||||
static Handle<WasmSharedModuleData> New(
|
||||
Isolate* isolate, Handle<Foreign> managed_module,
|
||||
Handle<SeqOneByteString> module_bytes, Handle<Script> script,
|
||||
Handle<ByteArray> asm_js_offset_table);
|
||||
|
||||
// Get the module name, if set. Returns an empty handle otherwise.
|
||||
static MaybeHandle<String> GetModuleNameOrNull(Isolate*,
|
||||
Handle<WasmSharedModuleData>);
|
||||
|
||||
// Get the function name of the function identified by the given index.
|
||||
// Returns a null handle if the function is unnamed or the name is not a valid
|
||||
// UTF-8 string.
|
||||
static MaybeHandle<String> GetFunctionNameOrNull(Isolate*,
|
||||
Handle<WasmSharedModuleData>,
|
||||
uint32_t func_index);
|
||||
|
||||
// Get the function name of the function identified by the given index.
|
||||
// Returns "<WASM UNNAMED>" if the function is unnamed or the name is not a
|
||||
// valid UTF-8 string.
|
||||
static Handle<String> GetFunctionName(Isolate*, Handle<WasmSharedModuleData>,
|
||||
uint32_t func_index);
|
||||
|
||||
// Get the raw bytes of the function name of the function identified by the
|
||||
// given index.
|
||||
// Meant to be used for debugging or frame printing.
|
||||
// Does not allocate, hence gc-safe.
|
||||
Vector<const uint8_t> GetRawFunctionName(uint32_t func_index);
|
||||
|
||||
// Return the byte offset of the function identified by the given index.
|
||||
// The offset will be relative to the start of the module bytes.
|
||||
// Returns -1 if the function index is invalid.
|
||||
int GetFunctionOffset(uint32_t func_index);
|
||||
|
||||
// Returns the function containing the given byte offset.
|
||||
// Returns -1 if the byte offset is not contained in any function of this
|
||||
// module.
|
||||
int GetContainingFunction(uint32_t byte_offset);
|
||||
|
||||
// Translate from byte offset in the module to function number and byte offset
|
||||
// within that function, encoded as line and column in the position info.
|
||||
// Returns true if the position is valid inside this module, false otherwise.
|
||||
bool GetPositionInfo(uint32_t position, Script::PositionInfo* info);
|
||||
|
||||
// Get the source position from a given function index and byte offset,
|
||||
// for either asm.js or pure WASM modules.
|
||||
static int GetSourcePosition(Handle<WasmSharedModuleData>,
|
||||
uint32_t func_index, uint32_t byte_offset,
|
||||
bool is_at_number_conversion);
|
||||
|
||||
// Compute the disassembly of a wasm function.
|
||||
// Returns the disassembly string and a list of <byte_offset, line, column>
|
||||
// entries, mapping wasm byte offsets to line and column in the disassembly.
|
||||
// The list is guaranteed to be ordered by the byte_offset.
|
||||
// Returns an empty string and empty vector if the function index is invalid.
|
||||
debug::WasmDisassembly DisassembleFunction(int func_index);
|
||||
|
||||
// Extract a portion of the wire bytes as UTF-8 string.
|
||||
// Returns a null handle if the respective bytes do not form a valid UTF-8
|
||||
// string.
|
||||
static MaybeHandle<String> ExtractUtf8StringFromModuleBytes(
|
||||
Isolate* isolate, Handle<WasmSharedModuleData>, wasm::WireBytesRef ref);
|
||||
static MaybeHandle<String> ExtractUtf8StringFromModuleBytes(
|
||||
Isolate* isolate, Handle<SeqOneByteString> module_bytes,
|
||||
wasm::WireBytesRef ref);
|
||||
|
||||
// Get a list of all possible breakpoints within a given range of this module.
|
||||
bool GetPossibleBreakpoints(const debug::Location& start,
|
||||
const debug::Location& end,
|
||||
std::vector<debug::BreakLocation>* locations);
|
||||
|
||||
// Return an empty handle if no breakpoint is hit at that location, or a
|
||||
// FixedArray with all hit breakpoint objects.
|
||||
static MaybeHandle<FixedArray> CheckBreakPoints(Isolate*,
|
||||
Handle<WasmSharedModuleData>,
|
||||
int position);
|
||||
};
|
||||
|
||||
// This represents the set of wasm compiled functions, together
|
||||
// with all the information necessary for re-specializing them.
|
||||
class WasmCompiledModule : public Struct {
|
||||
|
@ -590,16 +590,13 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
|
||||
DCHECK(module_bytes->IsSeqOneByteString());
|
||||
// The {managed_module} will take ownership of the {WasmModule} object,
|
||||
// and it will be destroyed when the GC reclaims it.
|
||||
size_t module_size = EstimateWasmModuleSize(decode_result.val.get());
|
||||
WasmModule* module = decode_result.val.get();
|
||||
size_t module_size = EstimateWasmModuleSize(module);
|
||||
Handle<Managed<WasmModule>> managed_module =
|
||||
Managed<WasmModule>::FromUniquePtr(isolate, module_size,
|
||||
std::move(decode_result.val));
|
||||
Handle<Script> script = CreateWasmScript(isolate, wire_bytes);
|
||||
Handle<WasmSharedModuleData> shared = WasmSharedModuleData::New(
|
||||
isolate, managed_module, Handle<SeqOneByteString>::cast(module_bytes),
|
||||
script, Handle<ByteArray>::null());
|
||||
int export_wrappers_size =
|
||||
static_cast<int>(shared->module()->num_exported_functions);
|
||||
int export_wrappers_size = static_cast<int>(module->num_exported_functions);
|
||||
Handle<FixedArray> export_wrappers = isolate->factory()->NewFixedArray(
|
||||
static_cast<int>(export_wrappers_size), TENURED);
|
||||
|
||||
@ -607,12 +604,11 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
|
||||
// handler was used or not when serializing.
|
||||
UseTrapHandler use_trap_handler =
|
||||
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler;
|
||||
wasm::ModuleEnv env(shared->module(), use_trap_handler,
|
||||
wasm::ModuleEnv env(module, use_trap_handler,
|
||||
wasm::RuntimeExceptionSupport::kRuntimeExceptionSupport);
|
||||
Handle<WasmCompiledModule> compiled_module =
|
||||
WasmCompiledModule::New(isolate, shared->module(), env);
|
||||
WasmCompiledModule::New(isolate, module, env);
|
||||
NativeModule* native_module = compiled_module->GetNativeModule();
|
||||
native_module->SetSharedModuleData(shared);
|
||||
if (FLAG_wasm_lazy_compilation) {
|
||||
native_module->SetLazyBuiltin(BUILTIN_CODE(isolate, WasmCompileLazy));
|
||||
}
|
||||
@ -621,8 +617,11 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
|
||||
Reader reader(data + kVersionSize);
|
||||
if (!deserializer.Read(&reader)) return {};
|
||||
|
||||
Handle<WasmModuleObject> module_object =
|
||||
WasmModuleObject::New(isolate, compiled_module, export_wrappers, shared);
|
||||
Handle<WasmModuleObject> module_object = WasmModuleObject::New(
|
||||
isolate, compiled_module, export_wrappers, managed_module,
|
||||
Handle<SeqOneByteString>::cast(module_bytes), script,
|
||||
Handle<ByteArray>::null());
|
||||
native_module->SetModuleObject(module_object);
|
||||
|
||||
// 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;
|
||||
CHECK_EQ(
|
||||
memcmp(
|
||||
reinterpret_cast<const uint8_t*>(
|
||||
module_object->shared()->module_bytes()->GetCharsAddress()),
|
||||
wire_bytes().first, wire_bytes().second),
|
||||
0);
|
||||
CHECK_EQ(memcmp(reinterpret_cast<const uint8_t*>(
|
||||
module_object->module_bytes()->GetCharsAddress()),
|
||||
wire_bytes().first, wire_bytes().second),
|
||||
0);
|
||||
}
|
||||
Handle<WasmInstanceObject> instance =
|
||||
current_isolate()
|
||||
@ -343,10 +341,8 @@ 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, shared);
|
||||
v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj);
|
||||
v8::Local<v8::Object> v8_module_obj =
|
||||
v8::Utils::ToLocal(Handle<JSObject>::cast(module_object));
|
||||
CHECK(v8_module_obj->IsWebAssemblyCompiledModule());
|
||||
|
||||
v8::Local<v8::WasmCompiledModule> v8_compiled_module =
|
||||
@ -1180,7 +1176,7 @@ TEST(AtomicOpDisassembly) {
|
||||
isolate->wasm_engine()->SyncCompile(
|
||||
isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end()));
|
||||
|
||||
module_object.ToHandleChecked()->shared()->DisassembleFunction(0);
|
||||
module_object.ToHandleChecked()->DisassembleFunction(0);
|
||||
}
|
||||
Cleanup();
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ namespace wasm {
|
||||
namespace {
|
||||
|
||||
void CheckLocations(
|
||||
WasmSharedModuleData* shared, debug::Location start, debug::Location end,
|
||||
WasmModuleObject* module_object, debug::Location start, debug::Location end,
|
||||
std::initializer_list<debug::Location> expected_locations_init) {
|
||||
std::vector<debug::BreakLocation> locations;
|
||||
bool success = shared->GetPossibleBreakpoints(start, end, &locations);
|
||||
bool success = module_object->GetPossibleBreakpoints(start, end, &locations);
|
||||
CHECK(success);
|
||||
|
||||
printf("got %d locations: ", static_cast<int>(locations.size()));
|
||||
@ -45,10 +45,10 @@ void CheckLocations(
|
||||
}
|
||||
}
|
||||
|
||||
void CheckLocationsFail(WasmSharedModuleData* shared, debug::Location start,
|
||||
void CheckLocationsFail(WasmModuleObject* module_object, debug::Location start,
|
||||
debug::Location end) {
|
||||
std::vector<debug::BreakLocation> locations;
|
||||
bool success = shared->GetPossibleBreakpoints(start, end, &locations);
|
||||
bool success = module_object->GetPossibleBreakpoints(start, end, &locations);
|
||||
CHECK(!success);
|
||||
}
|
||||
|
||||
@ -247,25 +247,25 @@ 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->module_object()->shared();
|
||||
WasmModuleObject* module_object = instance->module_object();
|
||||
|
||||
std::vector<debug::Location> locations;
|
||||
// Check all locations for function 0.
|
||||
CheckLocations(shared, {0, 0}, {1, 0},
|
||||
CheckLocations(module_object, {0, 0}, {1, 0},
|
||||
{{0, 1}, {0, 2}, {0, 4}, {0, 6}, {0, 7}});
|
||||
// Check a range ending at an instruction.
|
||||
CheckLocations(shared, {0, 2}, {0, 4}, {{0, 2}});
|
||||
CheckLocations(module_object, {0, 2}, {0, 4}, {{0, 2}});
|
||||
// Check a range ending one behind an instruction.
|
||||
CheckLocations(shared, {0, 2}, {0, 5}, {{0, 2}, {0, 4}});
|
||||
CheckLocations(module_object, {0, 2}, {0, 5}, {{0, 2}, {0, 4}});
|
||||
// Check a range starting at an instruction.
|
||||
CheckLocations(shared, {0, 7}, {0, 8}, {{0, 7}});
|
||||
CheckLocations(module_object, {0, 7}, {0, 8}, {{0, 7}});
|
||||
// Check from an instruction to beginning of next function.
|
||||
CheckLocations(shared, {0, 7}, {1, 0}, {{0, 7}});
|
||||
CheckLocations(module_object, {0, 7}, {1, 0}, {{0, 7}});
|
||||
// Check from end of one function (no valid instruction position) to beginning
|
||||
// of next function. Must be empty, but not fail.
|
||||
CheckLocations(shared, {0, 8}, {1, 0}, {});
|
||||
CheckLocations(module_object, {0, 8}, {1, 0}, {});
|
||||
// Check from one after the end of the function. Must fail.
|
||||
CheckLocationsFail(shared, {0, 9}, {1, 0});
|
||||
CheckLocationsFail(module_object, {0, 9}, {1, 0});
|
||||
}
|
||||
|
||||
WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) {
|
||||
|
@ -173,9 +173,9 @@ void TestingModuleBuilder::PopulateIndirectFunctionTable() {
|
||||
}
|
||||
|
||||
uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) {
|
||||
Handle<WasmSharedModuleData> shared(
|
||||
instance_object_->module_object()->shared(), isolate_);
|
||||
Handle<SeqOneByteString> old_bytes(shared->module_bytes(), isolate_);
|
||||
Handle<WasmModuleObject> module_object(instance_object_->module_object(),
|
||||
isolate_);
|
||||
Handle<SeqOneByteString> old_bytes(module_object->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
|
||||
// set", e.g. for function names.
|
||||
@ -185,7 +185,7 @@ uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) {
|
||||
memcpy(new_bytes.start() + bytes_offset, bytes.start(), bytes.length());
|
||||
Handle<SeqOneByteString> new_bytes_str = Handle<SeqOneByteString>::cast(
|
||||
isolate_->factory()->NewStringFromOneByte(new_bytes).ToHandleChecked());
|
||||
shared->set_module_bytes(*new_bytes_str);
|
||||
module_object->set_module_bytes(*new_bytes_str);
|
||||
return bytes_offset;
|
||||
}
|
||||
|
||||
@ -217,16 +217,14 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() {
|
||||
Handle<Script> script =
|
||||
isolate_->factory()->NewScript(isolate_->factory()->empty_string());
|
||||
script->set_type(Script::TYPE_WASM);
|
||||
Handle<WasmSharedModuleData> shared_module_data =
|
||||
WasmSharedModuleData::New(isolate_, managed_module, empty_string, script,
|
||||
Handle<ByteArray>::null());
|
||||
Handle<FixedArray> export_wrappers = isolate_->factory()->NewFixedArray(0);
|
||||
ModuleEnv env = CreateModuleEnv();
|
||||
Handle<WasmCompiledModule> compiled_module =
|
||||
WasmCompiledModule::New(isolate_, test_module_ptr_, env);
|
||||
compiled_module->GetNativeModule()->SetSharedModuleData(shared_module_data);
|
||||
Handle<WasmModuleObject> module_object = WasmModuleObject::New(
|
||||
isolate_, compiled_module, export_wrappers, shared_module_data);
|
||||
isolate_, compiled_module, export_wrappers, managed_module, empty_string,
|
||||
script, Handle<ByteArray>::null());
|
||||
compiled_module->GetNativeModule()->SetModuleObject(module_object);
|
||||
// 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.
|
||||
@ -412,8 +410,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
|
||||
builder_->instance_object()->compiled_module(), isolate());
|
||||
NativeModule* native_module = compiled_module->GetNativeModule();
|
||||
Handle<SeqOneByteString> wire_bytes(
|
||||
builder_->instance_object()->module_object()->shared()->module_bytes(),
|
||||
isolate());
|
||||
builder_->instance_object()->module_object()->module_bytes(), isolate());
|
||||
|
||||
ModuleEnv module_env = builder_->CreateModuleEnv();
|
||||
ErrorThrower thrower(isolate(), "WasmFunctionCompiler::Build");
|
||||
|
@ -77,44 +77,43 @@ INSTANCE_TYPES = {
|
||||
173: "WASM_COMPILED_MODULE_TYPE",
|
||||
174: "WASM_DEBUG_INFO_TYPE",
|
||||
175: "WASM_EXPORTED_FUNCTION_DATA_TYPE",
|
||||
176: "WASM_SHARED_MODULE_DATA_TYPE",
|
||||
177: "CALLABLE_TASK_TYPE",
|
||||
178: "CALLBACK_TASK_TYPE",
|
||||
179: "PROMISE_FULFILL_REACTION_JOB_TASK_TYPE",
|
||||
180: "PROMISE_REJECT_REACTION_JOB_TASK_TYPE",
|
||||
181: "PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE",
|
||||
182: "ALLOCATION_SITE_TYPE",
|
||||
183: "FIXED_ARRAY_TYPE",
|
||||
184: "BOILERPLATE_DESCRIPTION_TYPE",
|
||||
185: "HASH_TABLE_TYPE",
|
||||
186: "EPHEMERON_HASH_TABLE_TYPE",
|
||||
187: "SCOPE_INFO_TYPE",
|
||||
188: "BLOCK_CONTEXT_TYPE",
|
||||
189: "CATCH_CONTEXT_TYPE",
|
||||
190: "DEBUG_EVALUATE_CONTEXT_TYPE",
|
||||
191: "EVAL_CONTEXT_TYPE",
|
||||
192: "FUNCTION_CONTEXT_TYPE",
|
||||
193: "MODULE_CONTEXT_TYPE",
|
||||
194: "NATIVE_CONTEXT_TYPE",
|
||||
195: "SCRIPT_CONTEXT_TYPE",
|
||||
196: "WITH_CONTEXT_TYPE",
|
||||
197: "WEAK_FIXED_ARRAY_TYPE",
|
||||
198: "DESCRIPTOR_ARRAY_TYPE",
|
||||
199: "TRANSITION_ARRAY_TYPE",
|
||||
200: "CALL_HANDLER_INFO_TYPE",
|
||||
201: "CELL_TYPE",
|
||||
202: "CODE_DATA_CONTAINER_TYPE",
|
||||
203: "FEEDBACK_CELL_TYPE",
|
||||
204: "FEEDBACK_VECTOR_TYPE",
|
||||
205: "LOAD_HANDLER_TYPE",
|
||||
206: "PROPERTY_ARRAY_TYPE",
|
||||
207: "PROPERTY_CELL_TYPE",
|
||||
208: "SHARED_FUNCTION_INFO_TYPE",
|
||||
209: "SMALL_ORDERED_HASH_MAP_TYPE",
|
||||
210: "SMALL_ORDERED_HASH_SET_TYPE",
|
||||
211: "STORE_HANDLER_TYPE",
|
||||
212: "WEAK_CELL_TYPE",
|
||||
213: "WEAK_ARRAY_LIST_TYPE",
|
||||
176: "CALLABLE_TASK_TYPE",
|
||||
177: "CALLBACK_TASK_TYPE",
|
||||
178: "PROMISE_FULFILL_REACTION_JOB_TASK_TYPE",
|
||||
179: "PROMISE_REJECT_REACTION_JOB_TASK_TYPE",
|
||||
180: "PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE",
|
||||
181: "ALLOCATION_SITE_TYPE",
|
||||
182: "FIXED_ARRAY_TYPE",
|
||||
183: "BOILERPLATE_DESCRIPTION_TYPE",
|
||||
184: "HASH_TABLE_TYPE",
|
||||
185: "EPHEMERON_HASH_TABLE_TYPE",
|
||||
186: "SCOPE_INFO_TYPE",
|
||||
187: "BLOCK_CONTEXT_TYPE",
|
||||
188: "CATCH_CONTEXT_TYPE",
|
||||
189: "DEBUG_EVALUATE_CONTEXT_TYPE",
|
||||
190: "EVAL_CONTEXT_TYPE",
|
||||
191: "FUNCTION_CONTEXT_TYPE",
|
||||
192: "MODULE_CONTEXT_TYPE",
|
||||
193: "NATIVE_CONTEXT_TYPE",
|
||||
194: "SCRIPT_CONTEXT_TYPE",
|
||||
195: "WITH_CONTEXT_TYPE",
|
||||
196: "WEAK_FIXED_ARRAY_TYPE",
|
||||
197: "DESCRIPTOR_ARRAY_TYPE",
|
||||
198: "TRANSITION_ARRAY_TYPE",
|
||||
199: "CALL_HANDLER_INFO_TYPE",
|
||||
200: "CELL_TYPE",
|
||||
201: "CODE_DATA_CONTAINER_TYPE",
|
||||
202: "FEEDBACK_CELL_TYPE",
|
||||
203: "FEEDBACK_VECTOR_TYPE",
|
||||
204: "LOAD_HANDLER_TYPE",
|
||||
205: "PROPERTY_ARRAY_TYPE",
|
||||
206: "PROPERTY_CELL_TYPE",
|
||||
207: "SHARED_FUNCTION_INFO_TYPE",
|
||||
208: "SMALL_ORDERED_HASH_MAP_TYPE",
|
||||
209: "SMALL_ORDERED_HASH_SET_TYPE",
|
||||
210: "STORE_HANDLER_TYPE",
|
||||
211: "WEAK_CELL_TYPE",
|
||||
212: "WEAK_ARRAY_LIST_TYPE",
|
||||
1024: "JS_PROXY_TYPE",
|
||||
1025: "JS_GLOBAL_OBJECT_TYPE",
|
||||
1026: "JS_GLOBAL_PROXY_TYPE",
|
||||
@ -164,9 +163,9 @@ KNOWN_MAPS = {
|
||||
("RO_SPACE", 0x02201): (138, "FreeSpaceMap"),
|
||||
("RO_SPACE", 0x02259): (132, "MetaMap"),
|
||||
("RO_SPACE", 0x022e1): (131, "NullMap"),
|
||||
("RO_SPACE", 0x02359): (198, "DescriptorArrayMap"),
|
||||
("RO_SPACE", 0x023c1): (183, "FixedArrayMap"),
|
||||
("RO_SPACE", 0x02429): (212, "WeakCellMap"),
|
||||
("RO_SPACE", 0x02359): (197, "DescriptorArrayMap"),
|
||||
("RO_SPACE", 0x023c1): (182, "FixedArrayMap"),
|
||||
("RO_SPACE", 0x02429): (211, "WeakCellMap"),
|
||||
("RO_SPACE", 0x024d1): (152, "OnePointerFillerMap"),
|
||||
("RO_SPACE", 0x02539): (152, "TwoPointerFillerMap"),
|
||||
("RO_SPACE", 0x025d1): (131, "UninitializedMap"),
|
||||
@ -176,62 +175,62 @@ KNOWN_MAPS = {
|
||||
("RO_SPACE", 0x02831): (131, "TheHoleMap"),
|
||||
("RO_SPACE", 0x028f9): (131, "BooleanMap"),
|
||||
("RO_SPACE", 0x02a09): (136, "ByteArrayMap"),
|
||||
("RO_SPACE", 0x02a71): (183, "FixedCOWArrayMap"),
|
||||
("RO_SPACE", 0x02ad9): (185, "HashTableMap"),
|
||||
("RO_SPACE", 0x02a71): (182, "FixedCOWArrayMap"),
|
||||
("RO_SPACE", 0x02ad9): (184, "HashTableMap"),
|
||||
("RO_SPACE", 0x02b41): (128, "SymbolMap"),
|
||||
("RO_SPACE", 0x02ba9): (72, "OneByteStringMap"),
|
||||
("RO_SPACE", 0x02c11): (187, "ScopeInfoMap"),
|
||||
("RO_SPACE", 0x02c79): (208, "SharedFunctionInfoMap"),
|
||||
("RO_SPACE", 0x02c11): (186, "ScopeInfoMap"),
|
||||
("RO_SPACE", 0x02c79): (207, "SharedFunctionInfoMap"),
|
||||
("RO_SPACE", 0x02ce1): (133, "CodeMap"),
|
||||
("RO_SPACE", 0x02d49): (192, "FunctionContextMap"),
|
||||
("RO_SPACE", 0x02db1): (201, "CellMap"),
|
||||
("RO_SPACE", 0x02e19): (207, "GlobalPropertyCellMap"),
|
||||
("RO_SPACE", 0x02d49): (191, "FunctionContextMap"),
|
||||
("RO_SPACE", 0x02db1): (200, "CellMap"),
|
||||
("RO_SPACE", 0x02e19): (206, "GlobalPropertyCellMap"),
|
||||
("RO_SPACE", 0x02e81): (135, "ForeignMap"),
|
||||
("RO_SPACE", 0x02ee9): (199, "TransitionArrayMap"),
|
||||
("RO_SPACE", 0x02f51): (204, "FeedbackVectorMap"),
|
||||
("RO_SPACE", 0x02ee9): (198, "TransitionArrayMap"),
|
||||
("RO_SPACE", 0x02f51): (203, "FeedbackVectorMap"),
|
||||
("RO_SPACE", 0x02ff9): (131, "ArgumentsMarkerMap"),
|
||||
("RO_SPACE", 0x030b9): (131, "ExceptionMap"),
|
||||
("RO_SPACE", 0x03179): (131, "TerminationExceptionMap"),
|
||||
("RO_SPACE", 0x03241): (131, "OptimizedOutMap"),
|
||||
("RO_SPACE", 0x03301): (131, "StaleRegisterMap"),
|
||||
("RO_SPACE", 0x03391): (194, "NativeContextMap"),
|
||||
("RO_SPACE", 0x033f9): (193, "ModuleContextMap"),
|
||||
("RO_SPACE", 0x03461): (191, "EvalContextMap"),
|
||||
("RO_SPACE", 0x034c9): (195, "ScriptContextMap"),
|
||||
("RO_SPACE", 0x03531): (188, "BlockContextMap"),
|
||||
("RO_SPACE", 0x03599): (189, "CatchContextMap"),
|
||||
("RO_SPACE", 0x03601): (196, "WithContextMap"),
|
||||
("RO_SPACE", 0x03669): (190, "DebugEvaluateContextMap"),
|
||||
("RO_SPACE", 0x036d1): (183, "ScriptContextTableMap"),
|
||||
("RO_SPACE", 0x03391): (193, "NativeContextMap"),
|
||||
("RO_SPACE", 0x033f9): (192, "ModuleContextMap"),
|
||||
("RO_SPACE", 0x03461): (190, "EvalContextMap"),
|
||||
("RO_SPACE", 0x034c9): (194, "ScriptContextMap"),
|
||||
("RO_SPACE", 0x03531): (187, "BlockContextMap"),
|
||||
("RO_SPACE", 0x03599): (188, "CatchContextMap"),
|
||||
("RO_SPACE", 0x03601): (195, "WithContextMap"),
|
||||
("RO_SPACE", 0x03669): (189, "DebugEvaluateContextMap"),
|
||||
("RO_SPACE", 0x036d1): (182, "ScriptContextTableMap"),
|
||||
("RO_SPACE", 0x03739): (151, "FeedbackMetadataArrayMap"),
|
||||
("RO_SPACE", 0x037a1): (183, "ArrayListMap"),
|
||||
("RO_SPACE", 0x037a1): (182, "ArrayListMap"),
|
||||
("RO_SPACE", 0x03809): (130, "BigIntMap"),
|
||||
("RO_SPACE", 0x03871): (184, "BoilerplateDescriptionMap"),
|
||||
("RO_SPACE", 0x03871): (183, "BoilerplateDescriptionMap"),
|
||||
("RO_SPACE", 0x038d9): (137, "BytecodeArrayMap"),
|
||||
("RO_SPACE", 0x03941): (202, "CodeDataContainerMap"),
|
||||
("RO_SPACE", 0x03941): (201, "CodeDataContainerMap"),
|
||||
("RO_SPACE", 0x039a9): (150, "FixedDoubleArrayMap"),
|
||||
("RO_SPACE", 0x03a11): (185, "GlobalDictionaryMap"),
|
||||
("RO_SPACE", 0x03a79): (203, "ManyClosuresCellMap"),
|
||||
("RO_SPACE", 0x03ae1): (183, "ModuleInfoMap"),
|
||||
("RO_SPACE", 0x03a11): (184, "GlobalDictionaryMap"),
|
||||
("RO_SPACE", 0x03a79): (202, "ManyClosuresCellMap"),
|
||||
("RO_SPACE", 0x03ae1): (182, "ModuleInfoMap"),
|
||||
("RO_SPACE", 0x03b49): (134, "MutableHeapNumberMap"),
|
||||
("RO_SPACE", 0x03bb1): (185, "NameDictionaryMap"),
|
||||
("RO_SPACE", 0x03c19): (203, "NoClosuresCellMap"),
|
||||
("RO_SPACE", 0x03c81): (185, "NumberDictionaryMap"),
|
||||
("RO_SPACE", 0x03ce9): (203, "OneClosureCellMap"),
|
||||
("RO_SPACE", 0x03d51): (185, "OrderedHashMapMap"),
|
||||
("RO_SPACE", 0x03db9): (185, "OrderedHashSetMap"),
|
||||
("RO_SPACE", 0x03e21): (206, "PropertyArrayMap"),
|
||||
("RO_SPACE", 0x03e89): (200, "SideEffectCallHandlerInfoMap"),
|
||||
("RO_SPACE", 0x03ef1): (200, "SideEffectFreeCallHandlerInfoMap"),
|
||||
("RO_SPACE", 0x03f59): (200, "NextCallSideEffectFreeCallHandlerInfoMap"),
|
||||
("RO_SPACE", 0x03fc1): (185, "SimpleNumberDictionaryMap"),
|
||||
("RO_SPACE", 0x04029): (183, "SloppyArgumentsElementsMap"),
|
||||
("RO_SPACE", 0x04091): (209, "SmallOrderedHashMapMap"),
|
||||
("RO_SPACE", 0x040f9): (210, "SmallOrderedHashSetMap"),
|
||||
("RO_SPACE", 0x04161): (185, "StringTableMap"),
|
||||
("RO_SPACE", 0x041c9): (197, "WeakFixedArrayMap"),
|
||||
("RO_SPACE", 0x04231): (213, "WeakArrayListMap"),
|
||||
("RO_SPACE", 0x04299): (186, "EphemeronHashTableMap"),
|
||||
("RO_SPACE", 0x03bb1): (184, "NameDictionaryMap"),
|
||||
("RO_SPACE", 0x03c19): (202, "NoClosuresCellMap"),
|
||||
("RO_SPACE", 0x03c81): (184, "NumberDictionaryMap"),
|
||||
("RO_SPACE", 0x03ce9): (202, "OneClosureCellMap"),
|
||||
("RO_SPACE", 0x03d51): (184, "OrderedHashMapMap"),
|
||||
("RO_SPACE", 0x03db9): (184, "OrderedHashSetMap"),
|
||||
("RO_SPACE", 0x03e21): (205, "PropertyArrayMap"),
|
||||
("RO_SPACE", 0x03e89): (199, "SideEffectCallHandlerInfoMap"),
|
||||
("RO_SPACE", 0x03ef1): (199, "SideEffectFreeCallHandlerInfoMap"),
|
||||
("RO_SPACE", 0x03f59): (199, "NextCallSideEffectFreeCallHandlerInfoMap"),
|
||||
("RO_SPACE", 0x03fc1): (184, "SimpleNumberDictionaryMap"),
|
||||
("RO_SPACE", 0x04029): (182, "SloppyArgumentsElementsMap"),
|
||||
("RO_SPACE", 0x04091): (208, "SmallOrderedHashMapMap"),
|
||||
("RO_SPACE", 0x040f9): (209, "SmallOrderedHashSetMap"),
|
||||
("RO_SPACE", 0x04161): (184, "StringTableMap"),
|
||||
("RO_SPACE", 0x041c9): (196, "WeakFixedArrayMap"),
|
||||
("RO_SPACE", 0x04231): (212, "WeakArrayListMap"),
|
||||
("RO_SPACE", 0x04299): (185, "EphemeronHashTableMap"),
|
||||
("RO_SPACE", 0x04301): (106, "NativeSourceStringMap"),
|
||||
("RO_SPACE", 0x04369): (64, "StringMap"),
|
||||
("RO_SPACE", 0x043d1): (73, "ConsOneByteStringMap"),
|
||||
@ -288,14 +287,13 @@ KNOWN_MAPS = {
|
||||
("RO_SPACE", 0x0a651): (173, "WasmCompiledModuleMap"),
|
||||
("RO_SPACE", 0x0a6b9): (174, "WasmDebugInfoMap"),
|
||||
("RO_SPACE", 0x0a721): (175, "WasmExportedFunctionDataMap"),
|
||||
("RO_SPACE", 0x0a789): (176, "WasmSharedModuleDataMap"),
|
||||
("RO_SPACE", 0x0a7f1): (177, "CallableTaskMap"),
|
||||
("RO_SPACE", 0x0a859): (178, "CallbackTaskMap"),
|
||||
("RO_SPACE", 0x0a8c1): (179, "PromiseFulfillReactionJobTaskMap"),
|
||||
("RO_SPACE", 0x0a929): (180, "PromiseRejectReactionJobTaskMap"),
|
||||
("RO_SPACE", 0x0a991): (181, "PromiseResolveThenableJobTaskMap"),
|
||||
("RO_SPACE", 0x0a9f9): (182, "AllocationSiteMap"),
|
||||
("RO_SPACE", 0x0aa61): (182, "AllocationSiteMap"),
|
||||
("RO_SPACE", 0x0a789): (176, "CallableTaskMap"),
|
||||
("RO_SPACE", 0x0a7f1): (177, "CallbackTaskMap"),
|
||||
("RO_SPACE", 0x0a859): (178, "PromiseFulfillReactionJobTaskMap"),
|
||||
("RO_SPACE", 0x0a8c1): (179, "PromiseRejectReactionJobTaskMap"),
|
||||
("RO_SPACE", 0x0a929): (180, "PromiseResolveThenableJobTaskMap"),
|
||||
("RO_SPACE", 0x0a991): (181, "AllocationSiteMap"),
|
||||
("RO_SPACE", 0x0a9f9): (181, "AllocationSiteMap"),
|
||||
("MAP_SPACE", 0x02201): (1057, "ExternalMap"),
|
||||
("MAP_SPACE", 0x02259): (1072, "JSMessageObjectMap"),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user