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

Side by Side Diff: src/compiler/code-generator.cc

Issue 1158563008: [turbofan] Introduce prediction for exception handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Architecture ports. Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/pipeline.h" 9 #include "src/compiler/pipeline.h"
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 result->set_stack_slots(frame()->GetSpillSlotCount()); 137 result->set_stack_slots(frame()->GetSpillSlotCount());
138 result->set_safepoint_table_offset(safepoints()->GetCodeOffset()); 138 result->set_safepoint_table_offset(safepoints()->GetCodeOffset());
139 139
140 // Emit exception handler table. 140 // Emit exception handler table.
141 if (!handlers_.empty()) { 141 if (!handlers_.empty()) {
142 Handle<HandlerTable> table = 142 Handle<HandlerTable> table =
143 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( 143 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray(
144 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())), 144 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())),
145 TENURED)); 145 TENURED));
146 for (size_t i = 0; i < handlers_.size(); ++i) { 146 for (size_t i = 0; i < handlers_.size(); ++i) {
147 int position = handlers_[i].handler->pos();
148 HandlerTable::CatchPrediction prediction = handlers_[i].caught_locally
149 ? HandlerTable::CAUGHT
150 : HandlerTable::UNCAUGHT;
147 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset); 151 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset);
148 table->SetReturnHandler(static_cast<int>(i), handlers_[i].handler->pos()); 152 table->SetReturnHandler(static_cast<int>(i), position, prediction);
149 } 153 }
150 result->set_handler_table(*table); 154 result->set_handler_table(*table);
151 } 155 }
152 156
153 PopulateDeoptimizationData(result); 157 PopulateDeoptimizationData(result);
154 158
155 // Ensure there is space for lazy deoptimization in the relocation info. 159 // Ensure there is space for lazy deoptimization in the relocation info.
156 if (!info->IsStub()) { 160 if (!info->IsStub()) {
157 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result); 161 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result);
158 } 162 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); 363 CallDescriptor::Flags flags(MiscField::decode(instr->opcode()));
360 364
361 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); 365 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState);
362 366
363 RecordSafepoint( 367 RecordSafepoint(
364 instr->reference_map(), Safepoint::kSimple, 0, 368 instr->reference_map(), Safepoint::kSimple, 0,
365 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); 369 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt);
366 370
367 if (flags & CallDescriptor::kHasExceptionHandler) { 371 if (flags & CallDescriptor::kHasExceptionHandler) {
368 InstructionOperandConverter i(this, instr); 372 InstructionOperandConverter i(this, instr);
369 RpoNumber handler_rpo = 373 bool caught = flags & CallDescriptor::kHasLocalCatchHandler;
370 i.InputRpo(static_cast<int>(instr->InputCount()) - 1); 374 RpoNumber handler_rpo = i.InputRpo(instr->InputCount() - 1);
371 handlers_.push_back({GetLabel(handler_rpo), masm()->pc_offset()}); 375 handlers_.push_back({caught, GetLabel(handler_rpo), masm()->pc_offset()});
372 } 376 }
373 377
374 if (flags & CallDescriptor::kNeedsNopAfterCall) { 378 if (flags & CallDescriptor::kNeedsNopAfterCall) {
375 AddNopForSmiCodeInlining(); 379 AddNopForSmiCodeInlining();
376 } 380 }
377 381
378 if (needs_frame_state) { 382 if (needs_frame_state) {
379 MarkLazyDeoptSite(); 383 MarkLazyDeoptSite();
380 // If the frame state is present, it starts at argument 1 (just after the 384 // If the frame state is present, it starts at argument 1 (just after the
381 // code address). 385 // code address).
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 : masm_(gen->masm()), next_(gen->ools_) { 668 : masm_(gen->masm()), next_(gen->ools_) {
665 gen->ools_ = this; 669 gen->ools_ = this;
666 } 670 }
667 671
668 672
669 OutOfLineCode::~OutOfLineCode() {} 673 OutOfLineCode::~OutOfLineCode() {}
670 674
671 } // namespace compiler 675 } // namespace compiler
672 } // namespace internal 676 } // namespace internal
673 } // namespace v8 677 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698