Commit e5e19bf7 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Move source position tables off-heap.

This moves source position tables associated with WasmCode objects to be
located outside the garbage-collected heap. There now is a clear link to
the source position table from code, making the one-to-one relationship
and its lifetime explicit.

R=ahaas@chromium.org
BUG=v8:7424

Change-Id: I9d0b332732508c302ba525059ef02559f45aa2f6
Reviewed-on: https://chromium-review.googlesource.com/975565
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52178}
parent 32d0e026
...@@ -5292,7 +5292,9 @@ wasm::WasmCode* WasmCompilationUnit::FinishTurbofanCompilation( ...@@ -5292,7 +5292,9 @@ wasm::WasmCode* WasmCompilationUnit::FinishTurbofanCompilation(
func_index_, func_index_,
tf_.job_->compilation_info()->wasm_code_desc()->safepoint_table_offset, tf_.job_->compilation_info()->wasm_code_desc()->safepoint_table_offset,
tf_.job_->compilation_info()->wasm_code_desc()->handler_table_offset, tf_.job_->compilation_info()->wasm_code_desc()->handler_table_offset,
std::move(protected_instructions_), wasm::WasmCode::kTurbofan); std::move(protected_instructions_),
tf_.job_->compilation_info()->wasm_code_desc()->source_positions_table,
wasm::WasmCode::kTurbofan);
if (!code) return code; if (!code) return code;
if (FLAG_trace_wasm_decode_time) { if (FLAG_trace_wasm_decode_time) {
double codegen_ms = codegen_timer.Elapsed().InMillisecondsF(); double codegen_ms = codegen_timer.Elapsed().InMillisecondsF();
...@@ -5301,11 +5303,6 @@ wasm::WasmCode* WasmCompilationUnit::FinishTurbofanCompilation( ...@@ -5301,11 +5303,6 @@ wasm::WasmCode* WasmCompilationUnit::FinishTurbofanCompilation(
codegen_ms); codegen_ms);
} }
Handle<ByteArray> source_positions =
tf_.job_->compilation_info()->wasm_code_desc()->source_positions_table;
native_module_->compiled_module()->source_positions()->set(func_index_,
*source_positions);
return code; return code;
} }
...@@ -5317,12 +5314,10 @@ wasm::WasmCode* WasmCompilationUnit::FinishLiftoffCompilation( ...@@ -5317,12 +5314,10 @@ wasm::WasmCode* WasmCompilationUnit::FinishLiftoffCompilation(
Handle<ByteArray> source_positions = Handle<ByteArray> source_positions =
liftoff_.source_position_table_builder_.ToSourcePositionTable(isolate_); liftoff_.source_position_table_builder_.ToSourcePositionTable(isolate_);
native_module_->compiled_module()->source_positions()->set(func_index_,
*source_positions);
wasm::WasmCode* code = native_module_->AddCode( wasm::WasmCode* code = native_module_->AddCode(
desc, liftoff_.asm_.GetTotalFrameSlotCount(), func_index_, desc, liftoff_.asm_.GetTotalFrameSlotCount(), func_index_,
liftoff_.safepoint_table_offset_, 0, std::move(protected_instructions_), liftoff_.safepoint_table_offset_, 0, std::move(protected_instructions_),
wasm::WasmCode::kLiftoff); source_positions, wasm::WasmCode::kLiftoff);
return code; return code;
} }
......
...@@ -1324,10 +1324,7 @@ int FrameSummary::WasmCompiledFrameSummary::GetWasmSourcePosition( ...@@ -1324,10 +1324,7 @@ int FrameSummary::WasmCompiledFrameSummary::GetWasmSourcePosition(
int position = 0; int position = 0;
// Subtract one because the current PC is one instruction after the call site. // Subtract one because the current PC is one instruction after the call site.
offset--; offset--;
Handle<ByteArray> source_position_table(ByteArray::cast( for (SourcePositionTableIterator iterator(code->source_positions());
code->native_module()->compiled_module()->source_positions()->get(
code->index())));
for (SourcePositionTableIterator iterator(source_position_table);
!iterator.done() && iterator.code_offset() <= offset; !iterator.done() && iterator.code_offset() <= offset;
iterator.Advance()) { iterator.Advance()) {
position = iterator.source_position().ScriptOffset(); position = iterator.source_position().ScriptOffset();
......
...@@ -1285,26 +1285,41 @@ void Logger::CodeMoveEvent(AbstractCode* from, Address to) { ...@@ -1285,26 +1285,41 @@ void Logger::CodeMoveEvent(AbstractCode* from, Address to) {
MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), to); MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), to);
} }
void Logger::CodeLinePosInfoRecordEvent(Address code_start, namespace {
ByteArray* source_position_table) {
if (jit_logger_) { void CodeLinePosEvent(JitLogger* jit_logger, Address code_start,
void* jit_handler_data = jit_logger_->StartCodePosInfoEvent(); SourcePositionTableIterator& iter) {
for (SourcePositionTableIterator iter(source_position_table); !iter.done(); if (jit_logger) {
iter.Advance()) { void* jit_handler_data = jit_logger->StartCodePosInfoEvent();
for (; !iter.done(); iter.Advance()) {
if (iter.is_statement()) { if (iter.is_statement()) {
jit_logger_->AddCodeLinePosInfoEvent( jit_logger->AddCodeLinePosInfoEvent(
jit_handler_data, iter.code_offset(), jit_handler_data, iter.code_offset(),
iter.source_position().ScriptOffset(), iter.source_position().ScriptOffset(),
JitCodeEvent::STATEMENT_POSITION); JitCodeEvent::STATEMENT_POSITION);
} }
jit_logger_->AddCodeLinePosInfoEvent( jit_logger->AddCodeLinePosInfoEvent(jit_handler_data, iter.code_offset(),
jit_handler_data, iter.code_offset(), iter.source_position().ScriptOffset(),
iter.source_position().ScriptOffset(), JitCodeEvent::POSITION); JitCodeEvent::POSITION);
} }
jit_logger_->EndCodePosInfoEvent(code_start, jit_handler_data); jit_logger->EndCodePosInfoEvent(code_start, jit_handler_data);
} }
} }
} // namespace
void Logger::CodeLinePosInfoRecordEvent(Address code_start,
ByteArray* source_position_table) {
SourcePositionTableIterator iter(source_position_table);
CodeLinePosEvent(jit_logger_, code_start, iter);
}
void Logger::CodeLinePosInfoRecordEvent(
Address code_start, Vector<const byte> source_position_table) {
SourcePositionTableIterator iter(source_position_table);
CodeLinePosEvent(jit_logger_, code_start, iter);
}
void Logger::CodeNameEvent(Address addr, int pos, const char* code_name) { void Logger::CodeNameEvent(Address addr, int pos, const char* code_name) {
if (code_name == nullptr) return; // Not a code object. if (code_name == nullptr) return; // Not a code object.
Log::MessageBuilder msg(log_); Log::MessageBuilder msg(log_);
......
...@@ -193,6 +193,8 @@ class Logger : public CodeEventListener { ...@@ -193,6 +193,8 @@ class Logger : public CodeEventListener {
// Emits a code line info record event. // Emits a code line info record event.
void CodeLinePosInfoRecordEvent(Address code_start, void CodeLinePosInfoRecordEvent(Address code_start,
ByteArray* source_position_table); ByteArray* source_position_table);
void CodeLinePosInfoRecordEvent(Address code_start,
Vector<const byte> source_position_table);
void SharedFunctionInfoMoveEvent(Address from, Address to); void SharedFunctionInfoMoveEvent(Address from, Address to);
......
...@@ -1450,7 +1450,6 @@ void WasmCompiledModule::WasmCompiledModuleVerify() { ...@@ -1450,7 +1450,6 @@ void WasmCompiledModule::WasmCompiledModuleVerify() {
VerifyObjectField(kPrevInstanceOffset); VerifyObjectField(kPrevInstanceOffset);
VerifyObjectField(kOwningInstanceOffset); VerifyObjectField(kOwningInstanceOffset);
VerifyObjectField(kWasmModuleOffset); VerifyObjectField(kWasmModuleOffset);
VerifyObjectField(kSourcePositionsOffset);
VerifyObjectField(kNativeModuleOffset); VerifyObjectField(kNativeModuleOffset);
VerifyObjectField(kLazyCompileDataOffset); VerifyObjectField(kLazyCompileDataOffset);
VerifyObjectField(kUseTrapHandlerOffset); VerifyObjectField(kUseTrapHandlerOffset);
......
...@@ -75,13 +75,13 @@ void EncodeEntry(std::vector<byte>& bytes, const PositionTableEntry& entry) { ...@@ -75,13 +75,13 @@ void EncodeEntry(std::vector<byte>& bytes, const PositionTableEntry& entry) {
// Helper: Decode an integer. // Helper: Decode an integer.
template <typename T> template <typename T>
T DecodeInt(ByteArray* bytes, int* index) { T DecodeInt(Vector<const byte> bytes, int* index) {
byte current; byte current;
int shift = 0; int shift = 0;
T decoded = 0; T decoded = 0;
bool more; bool more;
do { do {
current = bytes->get((*index)++); current = bytes[(*index)++];
decoded |= static_cast<typename std::make_unsigned<T>::type>( decoded |= static_cast<typename std::make_unsigned<T>::type>(
ValueBits::decode(current)) ValueBits::decode(current))
<< shift; << shift;
...@@ -93,7 +93,8 @@ T DecodeInt(ByteArray* bytes, int* index) { ...@@ -93,7 +93,8 @@ T DecodeInt(ByteArray* bytes, int* index) {
return decoded; return decoded;
} }
void DecodeEntry(ByteArray* bytes, int* index, PositionTableEntry* entry) { void DecodeEntry(Vector<const byte> bytes, int* index,
PositionTableEntry* entry) {
int tmp = DecodeInt<int>(bytes, index); int tmp = DecodeInt<int>(bytes, index);
if (tmp >= 0) { if (tmp >= 0) {
entry->is_statement = true; entry->is_statement = true;
...@@ -105,6 +106,11 @@ void DecodeEntry(ByteArray* bytes, int* index, PositionTableEntry* entry) { ...@@ -105,6 +106,11 @@ void DecodeEntry(ByteArray* bytes, int* index, PositionTableEntry* entry) {
entry->source_position = DecodeInt<int64_t>(bytes, index); entry->source_position = DecodeInt<int64_t>(bytes, index);
} }
Vector<const byte> VectorFromByteArray(ByteArray* byte_array) {
return Vector<const byte>(byte_array->GetDataStartAddress(),
byte_array->length());
}
} // namespace } // namespace
SourcePositionTableBuilder::SourcePositionTableBuilder( SourcePositionTableBuilder::SourcePositionTableBuilder(
...@@ -159,7 +165,7 @@ Handle<ByteArray> SourcePositionTableBuilder::ToSourcePositionTable( ...@@ -159,7 +165,7 @@ Handle<ByteArray> SourcePositionTableBuilder::ToSourcePositionTable(
} }
SourcePositionTableIterator::SourcePositionTableIterator(ByteArray* byte_array) SourcePositionTableIterator::SourcePositionTableIterator(ByteArray* byte_array)
: raw_table_(byte_array) { : raw_table_(VectorFromByteArray(byte_array)) {
Advance(); Advance();
} }
...@@ -171,15 +177,24 @@ SourcePositionTableIterator::SourcePositionTableIterator( ...@@ -171,15 +177,24 @@ SourcePositionTableIterator::SourcePositionTableIterator(
no_gc.Release(); no_gc.Release();
} }
SourcePositionTableIterator::SourcePositionTableIterator(
Vector<const byte> bytes)
: raw_table_(bytes) {
Advance();
// We can enable allocation because the underlying vector does not move.
no_gc.Release();
}
void SourcePositionTableIterator::Advance() { void SourcePositionTableIterator::Advance() {
ByteArray* table = raw_table_ ? raw_table_ : *table_; Vector<const byte> bytes =
table_.is_null() ? raw_table_ : VectorFromByteArray(*table_);
DCHECK(!done()); DCHECK(!done());
DCHECK(index_ >= 0 && index_ <= table->length()); DCHECK(index_ >= 0 && index_ <= bytes.length());
if (index_ >= table->length()) { if (index_ >= bytes.length()) {
index_ = kDone; index_ = kDone;
} else { } else {
PositionTableEntry tmp; PositionTableEntry tmp;
DecodeEntry(table, &index_, &tmp); DecodeEntry(bytes, &index_, &tmp);
AddAndSetEntry(current_, tmp); AddAndSetEntry(current_, tmp);
} }
} }
......
...@@ -64,7 +64,7 @@ class V8_EXPORT_PRIVATE SourcePositionTableIterator { ...@@ -64,7 +64,7 @@ class V8_EXPORT_PRIVATE SourcePositionTableIterator {
PositionTableEntry position_; PositionTableEntry position_;
}; };
// We expose two flavours of the iterator, depending on the argument passed // We expose three flavours of the iterator, depending on the argument passed
// to the constructor: // to the constructor:
// Handlified iterator allows allocation, but it needs a handle (and thus // Handlified iterator allows allocation, but it needs a handle (and thus
...@@ -76,6 +76,10 @@ class V8_EXPORT_PRIVATE SourcePositionTableIterator { ...@@ -76,6 +76,10 @@ class V8_EXPORT_PRIVATE SourcePositionTableIterator {
// scope around. // scope around.
explicit SourcePositionTableIterator(ByteArray* byte_array); explicit SourcePositionTableIterator(ByteArray* byte_array);
// Handle-safe iterator based on an a vector located outside the garbage
// collected heap, allows allocation during its lifetime.
explicit SourcePositionTableIterator(Vector<const byte> bytes);
void Advance(); void Advance();
int code_offset() const { int code_offset() const {
...@@ -102,7 +106,7 @@ class V8_EXPORT_PRIVATE SourcePositionTableIterator { ...@@ -102,7 +106,7 @@ class V8_EXPORT_PRIVATE SourcePositionTableIterator {
private: private:
static const int kDone = -1; static const int kDone = -1;
ByteArray* raw_table_ = nullptr; Vector<const byte> raw_table_;
Handle<ByteArray> table_; Handle<ByteArray> table_;
int index_ = 0; int index_ = 0;
PositionTableEntry current_; PositionTableEntry current_;
......
...@@ -738,8 +738,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileDirectCall( ...@@ -738,8 +738,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileDirectCall(
SeqOneByteString* module_bytes = caller_module->shared()->module_bytes(); SeqOneByteString* module_bytes = caller_module->shared()->module_bytes();
uint32_t caller_func_index = wasm_caller->index(); uint32_t caller_func_index = wasm_caller->index();
SourcePositionTableIterator source_pos_iterator( SourcePositionTableIterator source_pos_iterator(
Handle<ByteArray>(ByteArray::cast( wasm_caller->source_positions());
caller_module->source_positions()->get(caller_func_index))));
const byte* func_bytes = const byte* func_bytes =
module_bytes->GetChars() + caller_module->shared() module_bytes->GetChars() + caller_module->shared()
......
...@@ -253,13 +253,9 @@ void WasmCode::LogCode(Isolate* isolate) const { ...@@ -253,13 +253,9 @@ void WasmCode::LogCode(Isolate* isolate) const {
} }
#endif #endif
MaybeHandle<ByteArray> src_pos = native_module_->compiled_module() if (!source_positions().is_empty()) {
->source_positions() LOG_CODE_EVENT(isolate, CodeLinePosInfoRecordEvent(instructions().start(),
->GetValue<ByteArray>(isolate, index); source_positions()));
if (!src_pos.is_null()) {
LOG_CODE_EVENT(isolate,
CodeLinePosInfoRecordEvent(this->instructions().start(),
*src_pos.ToHandleChecked()));
} }
} }
} }
...@@ -295,21 +291,15 @@ void WasmCode::Disassemble(const char* name, Isolate* isolate, ...@@ -295,21 +291,15 @@ void WasmCode::Disassemble(const char* name, Isolate* isolate,
instructions().start() + instruction_size, nullptr); instructions().start() + instruction_size, nullptr);
os << "\n"; os << "\n";
// Anonymous functions don't have source positions. if (!source_positions().is_empty()) {
if (!IsAnonymous()) { os << "Source positions:\n pc offset position\n";
Object* source_positions_or_undef = for (SourcePositionTableIterator it(source_positions()); !it.done();
native_module_->compiled_module()->source_positions()->get(index()); it.Advance()) {
if (!source_positions_or_undef->IsUndefined(isolate)) { os << std::setw(10) << std::hex << it.code_offset() << std::dec
os << "Source positions:\n pc offset position\n"; << std::setw(10) << it.source_position().ScriptOffset()
for (SourcePositionTableIterator it( << (it.is_statement() ? " statement" : "") << "\n";
ByteArray::cast(source_positions_or_undef));
!it.done(); it.Advance()) {
os << std::setw(10) << std::hex << it.code_offset() << std::dec
<< std::setw(10) << it.source_position().ScriptOffset()
<< (it.is_statement() ? " statement" : "") << "\n";
}
os << "\n";
} }
os << "\n";
} }
os << "RelocInfo (size = " << reloc_size_ << ")\n"; os << "RelocInfo (size = " << reloc_size_ << ")\n";
...@@ -454,15 +444,7 @@ NativeModule::NativeModule(uint32_t num_functions, uint32_t num_imports, ...@@ -454,15 +444,7 @@ NativeModule::NativeModule(uint32_t num_functions, uint32_t num_imports,
void NativeModule::ResizeCodeTableForTest(size_t last_index) { void NativeModule::ResizeCodeTableForTest(size_t last_index) {
size_t new_size = last_index + 1; size_t new_size = last_index + 1;
if (new_size > FunctionCount()) { if (new_size > FunctionCount()) {
Isolate* isolate = compiled_module()->GetIsolate();
code_table_.resize(new_size); code_table_.resize(new_size);
int grow_by = static_cast<int>(new_size) -
compiled_module()->source_positions()->length();
Handle<FixedArray> source_positions(compiled_module()->source_positions(),
isolate);
source_positions = isolate->factory()->CopyFixedArrayAndGrow(
source_positions, grow_by, TENURED);
compiled_module()->set_source_positions(*source_positions);
} }
} }
...@@ -478,6 +460,7 @@ uint32_t NativeModule::FunctionCount() const { ...@@ -478,6 +460,7 @@ uint32_t NativeModule::FunctionCount() const {
WasmCode* NativeModule::AddOwnedCode( WasmCode* NativeModule::AddOwnedCode(
Vector<const byte> orig_instructions, Vector<const byte> orig_instructions,
std::unique_ptr<const byte[]> reloc_info, size_t reloc_size, std::unique_ptr<const byte[]> reloc_info, size_t reloc_size,
std::unique_ptr<const byte[]> source_pos, size_t source_pos_size,
Maybe<uint32_t> index, WasmCode::Kind kind, size_t constant_pool_offset, Maybe<uint32_t> index, WasmCode::Kind kind, size_t constant_pool_offset,
uint32_t stack_slots, size_t safepoint_table_offset, uint32_t stack_slots, size_t safepoint_table_offset,
size_t handler_table_offset, size_t handler_table_offset,
...@@ -495,9 +478,9 @@ WasmCode* NativeModule::AddOwnedCode( ...@@ -495,9 +478,9 @@ WasmCode* NativeModule::AddOwnedCode(
orig_instructions.size()); orig_instructions.size());
std::unique_ptr<WasmCode> code(new WasmCode( std::unique_ptr<WasmCode> code(new WasmCode(
{executable_buffer, orig_instructions.size()}, std::move(reloc_info), {executable_buffer, orig_instructions.size()}, std::move(reloc_info),
reloc_size, this, index, kind, constant_pool_offset, stack_slots, reloc_size, std::move(source_pos), source_pos_size, this, index, kind,
safepoint_table_offset, handler_table_offset, constant_pool_offset, stack_slots, safepoint_table_offset,
std::move(protected_instructions), tier)); handler_table_offset, std::move(protected_instructions), tier));
WasmCode* ret = code.get(); WasmCode* ret = code.get();
// TODO(mtrofin): We allocate in increasing address order, and // TODO(mtrofin): We allocate in increasing address order, and
...@@ -519,8 +502,6 @@ WasmCode* NativeModule::AddCodeCopy(Handle<Code> code, WasmCode::Kind kind, ...@@ -519,8 +502,6 @@ WasmCode* NativeModule::AddCodeCopy(Handle<Code> code, WasmCode::Kind kind,
WasmCode* ret = AddAnonymousCode(code, kind); WasmCode* ret = AddAnonymousCode(code, kind);
code_table_[index] = ret; code_table_[index] = ret;
ret->index_ = Just(index); ret->index_ = Just(index);
compiled_module()->source_positions()->set(static_cast<int>(index),
code->source_position_table());
return ret; return ret;
} }
...@@ -555,6 +536,12 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code, ...@@ -555,6 +536,12 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
reloc_info.reset(new byte[code->relocation_size()]); reloc_info.reset(new byte[code->relocation_size()]);
memcpy(reloc_info.get(), code->relocation_start(), code->relocation_size()); memcpy(reloc_info.get(), code->relocation_start(), code->relocation_size());
} }
std::unique_ptr<byte[]> source_pos;
Handle<ByteArray> source_pos_table(code->SourcePositionTable());
if (source_pos_table->length() > 0) {
source_pos.reset(new byte[source_pos_table->length()]);
source_pos_table->copy_out(0, source_pos.get(), source_pos_table->length());
}
std::shared_ptr<ProtectedInstructions> protected_instructions( std::shared_ptr<ProtectedInstructions> protected_instructions(
new ProtectedInstructions(0)); new ProtectedInstructions(0));
Vector<const byte> orig_instructions( Vector<const byte> orig_instructions(
...@@ -566,8 +553,10 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code, ...@@ -566,8 +553,10 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
AddOwnedCode(orig_instructions, // instructions AddOwnedCode(orig_instructions, // instructions
std::move(reloc_info), // reloc_info std::move(reloc_info), // reloc_info
static_cast<size_t>(code->relocation_size()), // reloc_size static_cast<size_t>(code->relocation_size()), // reloc_size
Nothing<uint32_t>(), // index std::move(source_pos), // source positions
kind, // kind static_cast<size_t>(source_pos_table->length()),
Nothing<uint32_t>(), // index
kind, // kind
code->constant_pool_offset(), // constant_pool_offset code->constant_pool_offset(), // constant_pool_offset
stack_slots, // stack_slots stack_slots, // stack_slots
safepoint_table_offset, // safepoint_table_offset safepoint_table_offset, // safepoint_table_offset
...@@ -607,19 +596,26 @@ WasmCode* NativeModule::AddCode( ...@@ -607,19 +596,26 @@ WasmCode* NativeModule::AddCode(
const CodeDesc& desc, uint32_t frame_slots, uint32_t index, const CodeDesc& desc, uint32_t frame_slots, uint32_t index,
size_t safepoint_table_offset, size_t handler_table_offset, size_t safepoint_table_offset, size_t handler_table_offset,
std::unique_ptr<ProtectedInstructions> protected_instructions, std::unique_ptr<ProtectedInstructions> protected_instructions,
WasmCode::Tier tier) { Handle<ByteArray> source_pos_table, WasmCode::Tier tier) {
std::unique_ptr<byte[]> reloc_info; std::unique_ptr<byte[]> reloc_info;
if (desc.reloc_size) { if (desc.reloc_size) {
reloc_info.reset(new byte[desc.reloc_size]); reloc_info.reset(new byte[desc.reloc_size]);
memcpy(reloc_info.get(), desc.buffer + desc.buffer_size - desc.reloc_size, memcpy(reloc_info.get(), desc.buffer + desc.buffer_size - desc.reloc_size,
desc.reloc_size); desc.reloc_size);
} }
std::unique_ptr<byte[]> source_pos;
if (source_pos_table->length() > 0) {
source_pos.reset(new byte[source_pos_table->length()]);
source_pos_table->copy_out(0, source_pos.get(), source_pos_table->length());
}
TurboAssembler* origin = reinterpret_cast<TurboAssembler*>(desc.origin); TurboAssembler* origin = reinterpret_cast<TurboAssembler*>(desc.origin);
WasmCode* ret = AddOwnedCode( WasmCode* ret = AddOwnedCode(
{desc.buffer, static_cast<size_t>(desc.instr_size)}, {desc.buffer, static_cast<size_t>(desc.instr_size)},
std::move(reloc_info), static_cast<size_t>(desc.reloc_size), Just(index), std::move(reloc_info), static_cast<size_t>(desc.reloc_size),
WasmCode::kFunction, desc.instr_size - desc.constant_pool_size, std::move(source_pos), static_cast<size_t>(source_pos_table->length()),
frame_slots, safepoint_table_offset, handler_table_offset, Just(index), WasmCode::kFunction,
desc.instr_size - desc.constant_pool_size, frame_slots,
safepoint_table_offset, handler_table_offset,
std::move(protected_instructions), tier, WasmCode::kNoFlushICache); std::move(protected_instructions), tier, WasmCode::kNoFlushICache);
code_table_[index] = ret; code_table_[index] = ret;
...@@ -674,6 +670,8 @@ Address NativeModule::CreateTrampolineTo(Handle<Code> code) { ...@@ -674,6 +670,8 @@ Address NativeModule::CreateTrampolineTo(Handle<Code> code) {
WasmCode* wasm_code = AddOwnedCode(instructions, // instructions WasmCode* wasm_code = AddOwnedCode(instructions, // instructions
nullptr, // reloc_info nullptr, // reloc_info
0, // reloc_size 0, // reloc_size
nullptr, // source_pos
0, // source_pos_size
Nothing<uint32_t>(), // index Nothing<uint32_t>(), // index
WasmCode::kTrampoline, // kind WasmCode::kTrampoline, // kind
0, // constant_pool_offset 0, // constant_pool_offset
...@@ -840,9 +838,16 @@ WasmCode* NativeModule::CloneCode(const WasmCode* original_code, ...@@ -840,9 +838,16 @@ WasmCode* NativeModule::CloneCode(const WasmCode* original_code,
memcpy(reloc_info.get(), original_code->reloc_info().start(), memcpy(reloc_info.get(), original_code->reloc_info().start(),
original_code->reloc_info().size()); original_code->reloc_info().size());
} }
std::unique_ptr<byte[]> source_pos;
if (original_code->source_positions().size() > 0) {
source_pos.reset(new byte[original_code->source_positions().size()]);
memcpy(source_pos.get(), original_code->source_positions().start(),
original_code->source_positions().size());
}
WasmCode* ret = AddOwnedCode( WasmCode* ret = AddOwnedCode(
original_code->instructions(), std::move(reloc_info), original_code->instructions(), std::move(reloc_info),
original_code->reloc_info().size(), original_code->index_, original_code->reloc_info().size(), std::move(source_pos),
original_code->source_positions().size(), original_code->index_,
original_code->kind(), original_code->constant_pool_offset_, original_code->kind(), original_code->constant_pool_offset_,
original_code->stack_slots(), original_code->safepoint_table_offset_, original_code->stack_slots(), original_code->safepoint_table_offset_,
original_code->handler_table_offset_, original_code->handler_table_offset_,
......
...@@ -106,6 +106,9 @@ class V8_EXPORT_PRIVATE WasmCode final { ...@@ -106,6 +106,9 @@ class V8_EXPORT_PRIVATE WasmCode final {
Vector<const byte> reloc_info() const { Vector<const byte> reloc_info() const {
return {reloc_info_.get(), reloc_size_}; return {reloc_info_.get(), reloc_size_};
} }
Vector<const byte> source_positions() const {
return {source_position_table_.get(), source_position_size_};
}
uint32_t index() const { return index_.ToChecked(); } uint32_t index() const { return index_.ToChecked(); }
// Anonymous functions are functions that don't carry an index, like // Anonymous functions are functions that don't carry an index, like
...@@ -148,6 +151,7 @@ class V8_EXPORT_PRIVATE WasmCode final { ...@@ -148,6 +151,7 @@ class V8_EXPORT_PRIVATE WasmCode final {
WasmCode(Vector<byte> instructions, WasmCode(Vector<byte> instructions,
std::unique_ptr<const byte[]>&& reloc_info, size_t reloc_size, std::unique_ptr<const byte[]>&& reloc_info, size_t reloc_size,
std::unique_ptr<const byte[]>&& source_pos, size_t source_pos_size,
NativeModule* native_module, Maybe<uint32_t> index, Kind kind, NativeModule* native_module, Maybe<uint32_t> index, Kind kind,
size_t constant_pool_offset, uint32_t stack_slots, size_t constant_pool_offset, uint32_t stack_slots,
size_t safepoint_table_offset, size_t handler_table_offset, size_t safepoint_table_offset, size_t handler_table_offset,
...@@ -156,6 +160,8 @@ class V8_EXPORT_PRIVATE WasmCode final { ...@@ -156,6 +160,8 @@ class V8_EXPORT_PRIVATE WasmCode final {
: instructions_(instructions), : instructions_(instructions),
reloc_info_(std::move(reloc_info)), reloc_info_(std::move(reloc_info)),
reloc_size_(reloc_size), reloc_size_(reloc_size),
source_position_table_(std::move(source_pos)),
source_position_size_(source_pos_size),
native_module_(native_module), native_module_(native_module),
index_(index), index_(index),
kind_(kind), kind_(kind),
...@@ -173,6 +179,8 @@ class V8_EXPORT_PRIVATE WasmCode final { ...@@ -173,6 +179,8 @@ class V8_EXPORT_PRIVATE WasmCode final {
Vector<byte> instructions_; Vector<byte> instructions_;
std::unique_ptr<const byte[]> reloc_info_; std::unique_ptr<const byte[]> reloc_info_;
size_t reloc_size_ = 0; size_t reloc_size_ = 0;
std::unique_ptr<const byte[]> source_position_table_;
size_t source_position_size_ = 0;
NativeModule* native_module_ = nullptr; NativeModule* native_module_ = nullptr;
Maybe<uint32_t> index_; Maybe<uint32_t> index_;
Kind kind_; Kind kind_;
...@@ -227,6 +235,7 @@ class V8_EXPORT_PRIVATE NativeModule final { ...@@ -227,6 +235,7 @@ class V8_EXPORT_PRIVATE NativeModule final {
WasmCode* AddCode(const CodeDesc& desc, uint32_t frame_count, uint32_t index, WasmCode* AddCode(const CodeDesc& desc, uint32_t frame_count, uint32_t index,
size_t safepoint_table_offset, size_t handler_table_offset, size_t safepoint_table_offset, size_t handler_table_offset,
std::unique_ptr<ProtectedInstructions>, std::unique_ptr<ProtectedInstructions>,
Handle<ByteArray> source_position_table,
WasmCode::Tier tier); WasmCode::Tier tier);
// A way to copy over JS-allocated code. This is because we compile // A way to copy over JS-allocated code. This is because we compile
...@@ -300,7 +309,9 @@ class V8_EXPORT_PRIVATE NativeModule final { ...@@ -300,7 +309,9 @@ class V8_EXPORT_PRIVATE NativeModule final {
// whether it has an index or is anonymous, etc. // whether it has an index or is anonymous, etc.
WasmCode* AddOwnedCode(Vector<const byte> orig_instructions, WasmCode* AddOwnedCode(Vector<const byte> orig_instructions,
std::unique_ptr<const byte[]> reloc_info, std::unique_ptr<const byte[]> reloc_info,
size_t reloc_size, Maybe<uint32_t> index, size_t reloc_size,
std::unique_ptr<const byte[]> source_pos,
size_t source_pos_size, Maybe<uint32_t> index,
WasmCode::Kind kind, size_t constant_pool_offset, WasmCode::Kind kind, size_t constant_pool_offset,
uint32_t stack_slots, size_t safepoint_table_offset, uint32_t stack_slots, size_t safepoint_table_offset,
size_t handler_table_offset, size_t handler_table_offset,
......
...@@ -44,10 +44,7 @@ int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator, ...@@ -44,10 +44,7 @@ int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator,
class PatchDirectCallsHelper { class PatchDirectCallsHelper {
public: public:
PatchDirectCallsHelper(NativeModule* native_module, const WasmCode* code) PatchDirectCallsHelper(NativeModule* native_module, const WasmCode* code)
: source_pos_it(ByteArray::cast( : source_pos_it(code->source_positions()), decoder(nullptr, nullptr) {
native_module->compiled_module()->source_positions()->get(
static_cast<int>(code->index())))),
decoder(nullptr, nullptr) {
uint32_t func_index = code->index(); uint32_t func_index = code->index();
WasmCompiledModule* comp_mod = native_module->compiled_module(); WasmCompiledModule* comp_mod = native_module->compiled_module();
func_bytes = func_bytes =
......
...@@ -160,7 +160,6 @@ WCM_OBJECT(WasmCompiledModule, next_instance, kNextInstanceOffset) ...@@ -160,7 +160,6 @@ WCM_OBJECT(WasmCompiledModule, next_instance, kNextInstanceOffset)
WCM_OBJECT(WasmCompiledModule, prev_instance, kPrevInstanceOffset) WCM_OBJECT(WasmCompiledModule, prev_instance, kPrevInstanceOffset)
WCM_WEAK_LINK(WasmInstanceObject, owning_instance, kOwningInstanceOffset) WCM_WEAK_LINK(WasmInstanceObject, owning_instance, kOwningInstanceOffset)
WCM_WEAK_LINK(WasmModuleObject, wasm_module, kWasmModuleOffset) WCM_WEAK_LINK(WasmModuleObject, wasm_module, kWasmModuleOffset)
WCM_OBJECT(FixedArray, source_positions, kSourcePositionsOffset)
WCM_OBJECT(Foreign, native_module, kNativeModuleOffset) WCM_OBJECT(Foreign, native_module, kNativeModuleOffset)
WCM_OBJECT(FixedArray, lazy_compile_data, kLazyCompileDataOffset) WCM_OBJECT(FixedArray, lazy_compile_data, kLazyCompileDataOffset)
WCM_SMALL_CONST_NUMBER(bool, use_trap_handler, kUseTrapHandlerOffset) WCM_SMALL_CONST_NUMBER(bool, use_trap_handler, kUseTrapHandlerOffset)
......
...@@ -1260,10 +1260,6 @@ Handle<WasmCompiledModule> WasmCompiledModule::New( ...@@ -1260,10 +1260,6 @@ Handle<WasmCompiledModule> WasmCompiledModule::New(
compiled_module->GetNativeModule()->SetCompiledModule(weak_link); compiled_module->GetNativeModule()->SetCompiledModule(weak_link);
} }
int function_count = static_cast<int>(module->functions.size());
Handle<FixedArray> source_positions =
isolate->factory()->NewFixedArray(function_count, TENURED);
compiled_module->set_source_positions(*source_positions);
// TODO(mtrofin): copy the rest of the specialization parameters over. // TODO(mtrofin): copy the rest of the specialization parameters over.
// We're currently OK because we're only using defaults. // We're currently OK because we're only using defaults.
return compiled_module; return compiled_module;
...@@ -1278,7 +1274,6 @@ Handle<WasmCompiledModule> WasmCompiledModule::Clone( ...@@ -1278,7 +1274,6 @@ Handle<WasmCompiledModule> WasmCompiledModule::Clone(
ret->set_weak_native_context(module->weak_native_context()); ret->set_weak_native_context(module->weak_native_context());
ret->set_export_wrappers(module->export_wrappers()); ret->set_export_wrappers(module->export_wrappers());
ret->set_weak_wasm_module(module->weak_wasm_module()); ret->set_weak_wasm_module(module->weak_wasm_module());
ret->set_source_positions(module->source_positions());
ret->set_native_module(module->native_module()); ret->set_native_module(module->native_module());
if (module->has_lazy_compile_data()) { if (module->has_lazy_compile_data()) {
ret->set_lazy_compile_data(module->lazy_compile_data()); ret->set_lazy_compile_data(module->lazy_compile_data());
......
...@@ -451,7 +451,6 @@ class WasmCompiledModule : public Struct { ...@@ -451,7 +451,6 @@ class WasmCompiledModule : public Struct {
V(kPrevInstanceOffset, kPointerSize) \ V(kPrevInstanceOffset, kPointerSize) \
V(kOwningInstanceOffset, kPointerSize) \ V(kOwningInstanceOffset, kPointerSize) \
V(kWasmModuleOffset, kPointerSize) \ V(kWasmModuleOffset, kPointerSize) \
V(kSourcePositionsOffset, kPointerSize) \
V(kNativeModuleOffset, kPointerSize) \ V(kNativeModuleOffset, kPointerSize) \
V(kLazyCompileDataOffset, kPointerSize) \ V(kLazyCompileDataOffset, kPointerSize) \
V(kUseTrapHandlerOffset, kPointerSize) \ V(kUseTrapHandlerOffset, kPointerSize) \
...@@ -500,7 +499,6 @@ class WasmCompiledModule : public Struct { ...@@ -500,7 +499,6 @@ class WasmCompiledModule : public Struct {
WCM_CONST_OBJECT(WasmCompiledModule, prev_instance) WCM_CONST_OBJECT(WasmCompiledModule, prev_instance)
WCM_WEAK_LINK(WasmInstanceObject, owning_instance) WCM_WEAK_LINK(WasmInstanceObject, owning_instance)
WCM_WEAK_LINK(WasmModuleObject, wasm_module) WCM_WEAK_LINK(WasmModuleObject, wasm_module)
WCM_OBJECT(FixedArray, source_positions)
WCM_OBJECT(Foreign, native_module) WCM_OBJECT(Foreign, native_module)
WCM_OBJECT(FixedArray, lazy_compile_data) WCM_OBJECT(FixedArray, lazy_compile_data)
// TODO(mstarzinger): Make {use_trap_handler} smaller. // TODO(mstarzinger): Make {use_trap_handler} smaller.
......
...@@ -157,7 +157,6 @@ class V8_EXPORT_PRIVATE NativeModuleSerializer { ...@@ -157,7 +157,6 @@ class V8_EXPORT_PRIVATE NativeModuleSerializer {
static size_t GetCodeHeaderSize(); static size_t GetCodeHeaderSize();
size_t MeasureCode(const WasmCode*) const; size_t MeasureCode(const WasmCode*) const;
size_t MeasureCopiedStubs() const; size_t MeasureCopiedStubs() const;
ByteArray* GetSourcePositions(const WasmCode*) const;
void BufferHeader(); void BufferHeader();
// we buffer all the stubs because they are small // we buffer all the stubs because they are small
...@@ -252,20 +251,16 @@ size_t NativeModuleSerializer::GetCodeHeaderSize() { ...@@ -252,20 +251,16 @@ size_t NativeModuleSerializer::GetCodeHeaderSize() {
sizeof(uint32_t) + // stack slots sizeof(uint32_t) + // stack slots
sizeof(size_t) + // code size sizeof(size_t) + // code size
sizeof(size_t) + // reloc size sizeof(size_t) + // reloc size
sizeof(uint32_t) + // source positions size sizeof(size_t) + // source positions size
sizeof(size_t) + // protected instructions size sizeof(size_t) + // protected instructions size
sizeof(WasmCode::Tier); // tier sizeof(WasmCode::Tier); // tier
} }
size_t NativeModuleSerializer::MeasureCode(const WasmCode* code) const { size_t NativeModuleSerializer::MeasureCode(const WasmCode* code) const {
ByteArray* source_positions = GetSourcePositions(code);
return GetCodeHeaderSize() + code->instructions().size() + // code return GetCodeHeaderSize() + code->instructions().size() + // code
code->reloc_info().size() + // reloc info code->reloc_info().size() + // reloc info
(source_positions == nullptr code->source_positions().size() + // source pos.
? 0 code->protected_instructions().size() * // protected inst.
: static_cast<uint32_t>(
source_positions->length())) + // source positions
code->protected_instructions().size() *
sizeof(trap_handler::ProtectedInstructionData); sizeof(trap_handler::ProtectedInstructionData);
} }
...@@ -330,19 +325,6 @@ void NativeModuleSerializer::BufferCopiedStubs() { ...@@ -330,19 +325,6 @@ void NativeModuleSerializer::BufferCopiedStubs() {
} }
} }
ByteArray* NativeModuleSerializer::GetSourcePositions(
const WasmCode* code) const {
if (code->kind() != WasmCode::kFunction) return nullptr;
uint32_t index = code->index();
Object* source_positions_entry =
native_module_->compiled_module()->source_positions()->get(
static_cast<int>(index));
if (source_positions_entry->IsByteArray()) {
return ByteArray::cast(source_positions_entry);
}
return nullptr;
}
void NativeModuleSerializer::BufferCurrentWasmCode() { void NativeModuleSerializer::BufferCurrentWasmCode() {
const WasmCode* code = native_module_->GetCode(index_); const WasmCode* code = native_module_->GetCode(index_);
size_t size = MeasureCode(code); size_t size = MeasureCode(code);
...@@ -355,14 +337,6 @@ void NativeModuleSerializer::BufferCodeInAllocatedScratch( ...@@ -355,14 +337,6 @@ void NativeModuleSerializer::BufferCodeInAllocatedScratch(
const WasmCode* code) { const WasmCode* code) {
// We write the address, the size, and then copy the code as-is, followed // We write the address, the size, and then copy the code as-is, followed
// by reloc info, followed by source positions. // by reloc info, followed by source positions.
ByteArray* source_positions_entry = GetSourcePositions(code);
Address source_positions = nullptr;
uint32_t source_positions_size = 0;
if (source_positions_entry != nullptr) {
source_positions = source_positions_entry->GetDataStartAddress();
source_positions_size =
static_cast<uint32_t>(source_positions_entry->length());
}
Writer writer(remaining_); Writer writer(remaining_);
// write the header // write the header
writer.Write(MeasureCode(code)); writer.Write(MeasureCode(code));
...@@ -372,7 +346,7 @@ void NativeModuleSerializer::BufferCodeInAllocatedScratch( ...@@ -372,7 +346,7 @@ void NativeModuleSerializer::BufferCodeInAllocatedScratch(
writer.Write(code->stack_slots()); writer.Write(code->stack_slots());
writer.Write(code->instructions().size()); writer.Write(code->instructions().size());
writer.Write(code->reloc_info().size()); writer.Write(code->reloc_info().size());
writer.Write(source_positions_size); writer.Write(code->source_positions().size());
writer.Write(code->protected_instructions().size()); writer.Write(code->protected_instructions().size());
writer.Write(code->tier()); writer.Write(code->tier());
// next is the code, which we have to reloc. // next is the code, which we have to reloc.
...@@ -381,7 +355,7 @@ void NativeModuleSerializer::BufferCodeInAllocatedScratch( ...@@ -381,7 +355,7 @@ void NativeModuleSerializer::BufferCodeInAllocatedScratch(
// write the code and everything else // write the code and everything else
writer.WriteVector(code->instructions()); writer.WriteVector(code->instructions());
writer.WriteVector(code->reloc_info()); writer.WriteVector(code->reloc_info());
writer.WriteVector({source_positions, source_positions_size}); writer.WriteVector(code->source_positions());
writer.WriteVector( writer.WriteVector(
{reinterpret_cast<const byte*>(code->protected_instructions().data()), {reinterpret_cast<const byte*>(code->protected_instructions().data()),
sizeof(trap_handler::ProtectedInstructionData) * sizeof(trap_handler::ProtectedInstructionData) *
...@@ -559,7 +533,7 @@ bool NativeModuleDeserializer::ReadCode() { ...@@ -559,7 +533,7 @@ bool NativeModuleDeserializer::ReadCode() {
uint32_t stack_slot_count = reader.Read<uint32_t>(); uint32_t stack_slot_count = reader.Read<uint32_t>();
size_t code_size = reader.Read<size_t>(); size_t code_size = reader.Read<size_t>();
size_t reloc_size = reader.Read<size_t>(); size_t reloc_size = reader.Read<size_t>();
uint32_t source_position_size = reader.Read<uint32_t>(); size_t source_position_size = reader.Read<size_t>();
size_t protected_instructions_size = reader.Read<size_t>(); size_t protected_instructions_size = reader.Read<size_t>();
WasmCode::Tier tier = reader.Read<WasmCode::Tier>(); WasmCode::Tier tier = reader.Read<WasmCode::Tier>();
...@@ -573,11 +547,17 @@ bool NativeModuleDeserializer::ReadCode() { ...@@ -573,11 +547,17 @@ bool NativeModuleDeserializer::ReadCode() {
reloc_info.reset(new byte[reloc_size]); reloc_info.reset(new byte[reloc_size]);
reader.ReadIntoVector({reloc_info.get(), reloc_size}); reader.ReadIntoVector({reloc_info.get(), reloc_size});
} }
std::unique_ptr<byte[]> source_pos;
if (source_position_size > 0) {
source_pos.reset(new byte[source_position_size]);
reader.ReadIntoVector({source_pos.get(), source_position_size});
}
WasmCode* ret = native_module_->AddOwnedCode( WasmCode* ret = native_module_->AddOwnedCode(
code_buffer, std::move(reloc_info), reloc_size, Just(index_), code_buffer, std::move(reloc_info), reloc_size, std::move(source_pos),
WasmCode::kFunction, constant_pool_offset, stack_slot_count, source_position_size, Just(index_), WasmCode::kFunction,
safepoint_table_offset, handler_table_offset, protected_instructions, constant_pool_offset, stack_slot_count, safepoint_table_offset,
tier, WasmCode::kNoFlushICache); handler_table_offset, protected_instructions, tier,
WasmCode::kNoFlushICache);
native_module_->code_table_[index_] = ret; native_module_->code_table_[index_] = ret;
// now relocate the code // now relocate the code
...@@ -619,14 +599,6 @@ bool NativeModuleDeserializer::ReadCode() { ...@@ -619,14 +599,6 @@ bool NativeModuleDeserializer::ReadCode() {
Assembler::FlushICache(ret->instructions().start(), Assembler::FlushICache(ret->instructions().start(),
ret->instructions().size()); ret->instructions().size());
if (source_position_size > 0) {
Handle<ByteArray> source_positions = isolate_->factory()->NewByteArray(
static_cast<int>(source_position_size), TENURED);
reader.ReadIntoVector(
{source_positions->GetDataStartAddress(), source_position_size});
native_module_->compiled_module()->source_positions()->set(
static_cast<int>(index_), *source_positions);
}
if (protected_instructions_size > 0) { if (protected_instructions_size > 0) {
reader.ReadIntoVector( reader.ReadIntoVector(
{reinterpret_cast<byte*>(protected_instructions->data()), {reinterpret_cast<byte*>(protected_instructions->data()),
......
...@@ -128,15 +128,6 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate, ...@@ -128,15 +128,6 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate,
std::unique_ptr<wasm::NativeModule> module = std::unique_ptr<wasm::NativeModule> module =
isolate->wasm_engine()->code_manager()->NewNativeModule(code_size, 1, 0, isolate->wasm_engine()->code_manager()->NewNativeModule(code_size, 1, 0,
false); false);
// TODO(mstarzinger): Remove the WasmCompiledModule here as soon as source
// positions are stored in the WasmCode directly.
Handle<WasmCompiledModule> compiled_module = Handle<WasmCompiledModule>::cast(
isolate->factory()->NewStruct(WASM_COMPILED_MODULE_TYPE, TENURED));
Handle<FixedArray> source_positions =
isolate->factory()->NewFixedArray(1, TENURED);
compiled_module->set_source_positions(*source_positions);
module->SetCompiledModule(compiled_module);
return module; return module;
} }
......
...@@ -155,15 +155,6 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(i::Isolate* isolate, ...@@ -155,15 +155,6 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(i::Isolate* isolate,
std::unique_ptr<wasm::NativeModule> module = std::unique_ptr<wasm::NativeModule> module =
isolate->wasm_engine()->code_manager()->NewNativeModule(code_size, 1, 0, isolate->wasm_engine()->code_manager()->NewNativeModule(code_size, 1, 0,
false); false);
// TODO(mstarzinger): Remove the WasmCompiledModule here as soon as source
// positions are stored in the WasmCode directly.
Handle<WasmCompiledModule> compiled_module = Handle<WasmCompiledModule>::cast(
isolate->factory()->NewStruct(WASM_COMPILED_MODULE_TYPE, TENURED));
Handle<FixedArray> source_positions =
isolate->factory()->NewFixedArray(1, TENURED);
compiled_module->set_source_positions(*source_positions);
module->SetCompiledModule(compiled_module);
return module; return module;
} }
......
...@@ -186,7 +186,9 @@ class WasmCodeManagerTest : public TestWithContext, ...@@ -186,7 +186,9 @@ class WasmCodeManagerTest : public TestWithContext,
std::unique_ptr<byte[]> exec_buff(new byte[size]); std::unique_ptr<byte[]> exec_buff(new byte[size]);
desc.buffer = exec_buff.get(); desc.buffer = exec_buff.get();
desc.instr_size = static_cast<int>(size); desc.instr_size = static_cast<int>(size);
return native_module->AddCode(desc, 0, index, 0, 0, {}, WasmCode::kOther); Handle<ByteArray> source_pos = i_isolate()->factory()->empty_byte_array();
return native_module->AddCode(desc, 0, index, 0, 0, {}, source_pos,
WasmCode::kOther);
} }
size_t page() const { return AllocatePageSize(); } size_t page() const { return AllocatePageSize(); }
......
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