OLD | NEW |
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/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 source_position_table_builder_.EndJitLogging(AbstractCode::cast(*result)); | 222 source_position_table_builder_.EndJitLogging(AbstractCode::cast(*result)); |
223 | 223 |
224 // Emit exception handler table. | 224 // Emit exception handler table. |
225 if (!handlers_.empty()) { | 225 if (!handlers_.empty()) { |
226 Handle<HandlerTable> table = | 226 Handle<HandlerTable> table = |
227 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( | 227 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( |
228 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())), | 228 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())), |
229 TENURED)); | 229 TENURED)); |
230 for (size_t i = 0; i < handlers_.size(); ++i) { | 230 for (size_t i = 0; i < handlers_.size(); ++i) { |
231 int position = handlers_[i].handler->pos(); | 231 int position = handlers_[i].handler->pos(); |
232 HandlerTable::CatchPrediction prediction = handlers_[i].caught_locally | |
233 ? HandlerTable::CAUGHT | |
234 : HandlerTable::UNCAUGHT; | |
235 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset); | 232 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset); |
236 table->SetReturnHandler(static_cast<int>(i), position, prediction); | 233 table->SetReturnHandler(static_cast<int>(i), position, |
| 234 handlers_[i].catch_prediction); |
237 } | 235 } |
238 result->set_handler_table(*table); | 236 result->set_handler_table(*table); |
239 } | 237 } |
240 | 238 |
241 PopulateDeoptimizationData(result); | 239 PopulateDeoptimizationData(result); |
242 | 240 |
243 // Ensure there is space for lazy deoptimization in the relocation info. | 241 // Ensure there is space for lazy deoptimization in the relocation info. |
244 if (info->ShouldEnsureSpaceForLazyDeopt()) { | 242 if (info->ShouldEnsureSpaceForLazyDeopt()) { |
245 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result); | 243 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result); |
246 } | 244 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); | 596 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); |
599 | 597 |
600 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); | 598 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); |
601 | 599 |
602 RecordSafepoint( | 600 RecordSafepoint( |
603 instr->reference_map(), Safepoint::kSimple, 0, | 601 instr->reference_map(), Safepoint::kSimple, 0, |
604 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); | 602 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); |
605 | 603 |
606 if (flags & CallDescriptor::kHasExceptionHandler) { | 604 if (flags & CallDescriptor::kHasExceptionHandler) { |
607 InstructionOperandConverter i(this, instr); | 605 InstructionOperandConverter i(this, instr); |
608 bool caught = flags & CallDescriptor::kHasLocalCatchHandler; | 606 HandlerTable::CatchPrediction prediction = HandlerTable::UNCAUGHT; |
| 607 if (flags & CallDescriptor::kHasLocalCatchHandler) { |
| 608 prediction = HandlerTable::CAUGHT; |
| 609 } else if (flags & CallDescriptor::kHasLocalCatchHandlerForPromiseReject) { |
| 610 prediction = HandlerTable::PROMISE; |
| 611 } |
609 RpoNumber handler_rpo = i.InputRpo(instr->InputCount() - 1); | 612 RpoNumber handler_rpo = i.InputRpo(instr->InputCount() - 1); |
610 handlers_.push_back({caught, GetLabel(handler_rpo), masm()->pc_offset()}); | 613 handlers_.push_back( |
| 614 {prediction, GetLabel(handler_rpo), masm()->pc_offset()}); |
611 } | 615 } |
612 | 616 |
613 if (needs_frame_state) { | 617 if (needs_frame_state) { |
614 MarkLazyDeoptSite(); | 618 MarkLazyDeoptSite(); |
615 // If the frame state is present, it starts at argument 1 (just after the | 619 // If the frame state is present, it starts at argument 1 (just after the |
616 // code address). | 620 // code address). |
617 size_t frame_state_offset = 1; | 621 size_t frame_state_offset = 1; |
618 FrameStateDescriptor* descriptor = | 622 FrameStateDescriptor* descriptor = |
619 GetDeoptimizationEntry(instr, frame_state_offset).descriptor(); | 623 GetDeoptimizationEntry(instr, frame_state_offset).descriptor(); |
620 int pc_offset = masm()->pc_offset(); | 624 int pc_offset = masm()->pc_offset(); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 916 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
913 gen->ools_ = this; | 917 gen->ools_ = this; |
914 } | 918 } |
915 | 919 |
916 | 920 |
917 OutOfLineCode::~OutOfLineCode() {} | 921 OutOfLineCode::~OutOfLineCode() {} |
918 | 922 |
919 } // namespace compiler | 923 } // namespace compiler |
920 } // namespace internal | 924 } // namespace internal |
921 } // namespace v8 | 925 } // namespace v8 |
OLD | NEW |