Index: src/compiler/code-generator.cc |
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
index c69e86e0a5367c4a1724b4ecc33fb66e9394d039..dee3b2b3a337f491a555a6bff07ffb5352f79378 100644 |
--- a/src/compiler/code-generator.cc |
+++ b/src/compiler/code-generator.cc |
@@ -33,8 +33,10 @@ class CodeGenerator::JumpTable final : public ZoneObject { |
size_t const target_count_; |
}; |
-CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, |
- InstructionSequence* code, CompilationInfo* info) |
+CodeGenerator::CodeGenerator( |
+ Frame* frame, Linkage* linkage, InstructionSequence* code, |
+ CompilationInfo* info, |
+ ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions) |
: frame_access_state_(nullptr), |
linkage_(linkage), |
code_(code), |
@@ -57,7 +59,8 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, |
ools_(nullptr), |
osr_pc_offset_(-1), |
source_position_table_builder_(code->zone(), |
- info->SourcePositionRecordingMode()) { |
+ info->SourcePositionRecordingMode()), |
+ protected_instructions_(protected_instructions) { |
for (int i = 0; i < code->InstructionBlockCount(); ++i) { |
new (&labels_[i]) Label; |
} |
@@ -71,6 +74,15 @@ void CodeGenerator::CreateFrameAccessState(Frame* frame) { |
frame_access_state_ = new (code()->zone()) FrameAccessState(frame); |
} |
+void CodeGenerator::AddProtectedInstruction(int instr_offset, |
+ int landing_offset) { |
+ if (protected_instructions_ != nullptr) { |
+ trap_handler::ProtectedInstructionData data = {instr_offset, |
+ landing_offset}; |
+ protected_instructions_->emplace_back(data); |
+ } |
+} |
+ |
Handle<Code> CodeGenerator::GenerateCode() { |
CompilationInfo* info = this->info(); |