Store protected instructions as unique_ptr
When generating code, store the vector of protected instruction data as unique_ptr. It only becomes a shared_ptr once ownership has been transferred to the NativeModule, because it can be shared between different instances of the same function. Drive-by: Remove dead accessor in PipelineData. R=ahaas@chromium.org Change-Id: I7571b32bf89f3c816683c5a77ac08fe8c22eb968 Reviewed-on: https://chromium-review.googlesource.com/853496 Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#50404}
This commit is contained in:
parent
d81536564d
commit
d7b33bf623
@ -253,11 +253,6 @@ class PipelineData {
|
||||
source_position_output_ = source_position_output;
|
||||
}
|
||||
|
||||
std::vector<trap_handler::ProtectedInstructionData>* protected_instructions()
|
||||
const {
|
||||
return protected_instructions_;
|
||||
}
|
||||
|
||||
JumpOptimizationInfo* jump_optimization_info() const {
|
||||
return jump_optimization_info_;
|
||||
}
|
||||
|
@ -5139,7 +5139,7 @@ WasmCodeWrapper WasmCompilationUnit::FinishTurbofanCompilation(
|
||||
desc, tf_.job_->compilation_info()->wasm_code_desc()->frame_slot_count,
|
||||
func_index_,
|
||||
tf_.job_->compilation_info()->wasm_code_desc()->safepoint_table_offset,
|
||||
protected_instructions_);
|
||||
std::move(protected_instructions_));
|
||||
if (!code) {
|
||||
return WasmCodeWrapper(code);
|
||||
}
|
||||
@ -5243,9 +5243,10 @@ WasmCodeWrapper WasmCompilationUnit::FinishLiftoffCompilation(
|
||||
// Consider lifting them both to FinishCompilation.
|
||||
native_module_->compiled_module()->source_positions()->set(
|
||||
func_index_, *source_positions);
|
||||
return WasmCodeWrapper(native_module_->AddCode(
|
||||
desc, liftoff_.asm_.GetTotalFrameSlotCount(), func_index_,
|
||||
liftoff_.safepoint_table_offset_, protected_instructions_, true));
|
||||
return WasmCodeWrapper(
|
||||
native_module_->AddCode(desc, liftoff_.asm_.GetTotalFrameSlotCount(),
|
||||
func_index_, liftoff_.safepoint_table_offset_,
|
||||
std::move(protected_instructions_), true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ class WasmCompilationUnit final {
|
||||
size_t memory_cost_ = 0;
|
||||
wasm::NativeModule* native_module_;
|
||||
bool lower_simd_;
|
||||
std::shared_ptr<std::vector<trap_handler::ProtectedInstructionData>>
|
||||
std::unique_ptr<std::vector<trap_handler::ProtectedInstructionData>>
|
||||
protected_instructions_;
|
||||
CompilationMode mode_;
|
||||
// {liftoff_} is valid if mode_ == kLiftoff, tf_ if mode_ == kTurbofan.
|
||||
|
@ -387,7 +387,7 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
|
||||
WasmCode* NativeModule::AddCode(
|
||||
const CodeDesc& desc, uint32_t frame_slots, uint32_t index,
|
||||
size_t safepoint_table_offset,
|
||||
std::shared_ptr<ProtectedInstructions> protected_instructions,
|
||||
std::unique_ptr<ProtectedInstructions> protected_instructions,
|
||||
bool is_liftoff) {
|
||||
std::unique_ptr<byte[]> reloc_info;
|
||||
if (desc.reloc_size) {
|
||||
|
@ -151,7 +151,7 @@ class V8_EXPORT_PRIVATE WasmCode final {
|
||||
constant_pool_offset_(constant_pool_offset),
|
||||
stack_slots_(stack_slots),
|
||||
safepoint_table_offset_(safepoint_table_offset),
|
||||
protected_instructions_(protected_instructions),
|
||||
protected_instructions_(std::move(protected_instructions)),
|
||||
is_liftoff_(is_liftoff) {}
|
||||
|
||||
WasmCode(const WasmCode&) = delete;
|
||||
@ -190,7 +190,7 @@ class V8_EXPORT_PRIVATE NativeModule final {
|
||||
|
||||
WasmCode* AddCode(const CodeDesc& desc, uint32_t frame_count, uint32_t index,
|
||||
size_t safepoint_table_offset,
|
||||
std::shared_ptr<ProtectedInstructions>,
|
||||
std::unique_ptr<ProtectedInstructions>,
|
||||
bool is_liftoff = false);
|
||||
|
||||
// A way to copy over JS-allocated code. This is because we compile
|
||||
|
Loading…
Reference in New Issue
Block a user