Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: src/compiler/code-generator.cc

Issue 2500443004: [wasm] OOB traps: build protected instruction list during codegen (Closed)
Patch Set: Removing spurious changes Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/pipeline.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/pipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698