| Index: src/compiler/wasm-compiler.cc
|
| diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
|
| index 49d24285031b8abfc916f9165e067f8141b7465e..0e886cf75acb13655b4c3f2e34b2c6f6f75b76b2 100644
|
| --- a/src/compiler/wasm-compiler.cc
|
| +++ b/src/compiler/wasm-compiler.cc
|
| @@ -3411,7 +3411,8 @@ WasmCompilationUnit::WasmCompilationUnit(wasm::ErrorThrower* thrower,
|
| Code::ComputeFlags(Code::WASM_FUNCTION)),
|
| job_(),
|
| index_(index),
|
| - ok_(true) {
|
| + ok_(true),
|
| + protected_instructions_(&compilation_zone_) {
|
| // Create and cache this node in the main thread.
|
| jsgraph_->CEntryStubConstant(1);
|
| }
|
| @@ -3452,7 +3453,8 @@ void WasmCompilationUnit::ExecuteCompilation() {
|
| module_env_->GetI32WasmCallDescriptor(&compilation_zone_, descriptor);
|
| }
|
| job_.reset(Pipeline::NewWasmCompilationJob(&info_, jsgraph_, descriptor,
|
| - source_positions));
|
| + source_positions,
|
| + &protected_instructions_));
|
| ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED;
|
| // TODO(bradnelson): Improve histogram handling of size_t.
|
| // TODO(ahaas): The counters are not thread-safe at the moment.
|
| @@ -3510,9 +3512,27 @@ Handle<Code> WasmCompilationUnit::FinishCompilation() {
|
| compile_ms);
|
| }
|
|
|
| + Handle<FixedArray> protected_instructions = PackProtectedInstructions();
|
| + code->set_protected_instructions(*protected_instructions);
|
| +
|
| return code;
|
| }
|
|
|
| +Handle<FixedArray> WasmCompilationUnit::PackProtectedInstructions() const {
|
| + const int num_instructions = static_cast<int>(protected_instructions_.size());
|
| + Handle<FixedArray> fn_protected = isolate_->factory()->NewFixedArray(
|
| + num_instructions * Code::kTrapDataSize, TENURED);
|
| + for (unsigned i = 0; i < protected_instructions_.size(); ++i) {
|
| + const trap_handler::ProtectedInstructionData& instruction =
|
| + protected_instructions_[i];
|
| + fn_protected->set(Code::kTrapDataSize * i + Code::kTrapCodeOffset,
|
| + Smi::FromInt(instruction.instr_offset));
|
| + fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset,
|
| + Smi::FromInt(instruction.landing_offset));
|
| + }
|
| + return fn_protected;
|
| +}
|
| +
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|