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

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

Issue 943503003: Emit exception handler table in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_trycatch-4
Patch Set: Fix Win64 compilation failure. Created 5 years, 10 months 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/ia32/code-generator-ia32.cc » ('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 1a4566d60994dbba96e72fcde285c215d5f2120e..f0dd6f8d46cf0b41c3663b8fb6441f339f20a692 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -42,6 +42,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
masm_(info->isolate(), NULL, 0),
resolver_(this),
safepoints_(code->zone()),
+ handlers_(code->zone()),
deoptimization_states_(code->zone()),
deoptimization_literals_(code->zone()),
translations_(code->zone()),
@@ -131,6 +132,18 @@ Handle<Code> CodeGenerator::GenerateCode() {
result->set_stack_slots(frame()->GetSpillSlotCount());
result->set_safepoint_table_offset(safepoints()->GetCodeOffset());
+ // Emit exception handler table.
+ if (!handlers_.empty()) {
+ Handle<FixedArray> table = isolate()->factory()->NewFixedArray(
+ static_cast<int>(handlers_.size()) * 2, TENURED);
+ for (size_t i = 0; i < handlers_.size(); ++i) {
+ int table_index = static_cast<int>(i * 2);
+ table->set(table_index + 0, Smi::FromInt(handlers_[i].pc_offset));
+ table->set(table_index + 1, Smi::FromInt(handlers_[i].handler->pos()));
+ }
+ result->set_handler_table(*table);
+ }
+
PopulateDeoptimizationData(result);
// Ensure there is space for lazy deoptimization in the relocation info.
@@ -321,7 +334,7 @@ Label* CodeGenerator::AddJumpTable(Label** targets, size_t target_count) {
}
-void CodeGenerator::AddSafepointAndDeopt(Instruction* instr) {
+void CodeGenerator::RecordCallPosition(Instruction* instr) {
CallDescriptor::Flags flags(MiscField::decode(instr->opcode()));
bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState);
@@ -330,16 +343,21 @@ void CodeGenerator::AddSafepointAndDeopt(Instruction* instr) {
instr->pointer_map(), Safepoint::kSimple, 0,
needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt);
+ if (flags & CallDescriptor::kHasExceptionHandler) {
+ InstructionOperandConverter i(this, instr);
+ BasicBlock::RpoNumber handler_rpo =
+ i.InputRpo(static_cast<int>(instr->InputCount()) - 1);
+ handlers_.push_back({GetLabel(handler_rpo), masm()->pc_offset()});
+ }
+
if (flags & CallDescriptor::kNeedsNopAfterCall) {
AddNopForSmiCodeInlining();
}
if (needs_frame_state) {
MarkLazyDeoptSite();
- // If the frame state is present, it starts at argument 1
- // (just after the code address).
- InstructionOperandConverter converter(this, instr);
- // Deoptimization info starts at argument 1
+ // If the frame state is present, it starts at argument 1 (just after the
+ // code address).
size_t frame_state_offset = 1;
FrameStateDescriptor* descriptor =
GetFrameStateDescriptor(instr, frame_state_offset);
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698