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

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

Issue 2500443004: [wasm] OOB traps: build protected instruction list during codegen (Closed)
Patch Set: Merging with master Created 4 years, 1 month 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
Index: src/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index a7c2c65c0856a72fd33f832528c42eca167bd5c9..c6ad74a70d092f74f44f48c08d56a17937e57ea9 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,
+ trap_handler::ProtectedInstructionList* 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,16 @@ 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;
titzer 2016/11/30 17:31:12 This can be a little shorter if you either introdu
Eric Holk 2016/11/30 20:16:19 Done.
+ data.instr_offset = instr_offset;
+ data.landing_offset = landing_offset;
+ protected_instructions_->push_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') | src/compiler/pipeline.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698