| 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 = HandlerTable::UNCAUGHT; |
| 232 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset); | 233 table->SetReturnOffset(static_cast<int>(i), handlers_[i].pc_offset); |
| 233 table->SetReturnHandler(static_cast<int>(i), position, | 234 table->SetReturnHandler(static_cast<int>(i), position, prediction); |
| 234 handlers_[i].catch_prediction); | |
| 235 } | 235 } |
| 236 result->set_handler_table(*table); | 236 result->set_handler_table(*table); |
| 237 } | 237 } |
| 238 | 238 |
| 239 PopulateDeoptimizationData(result); | 239 PopulateDeoptimizationData(result); |
| 240 | 240 |
| 241 // Ensure there is space for lazy deoptimization in the relocation info. | 241 // Ensure there is space for lazy deoptimization in the relocation info. |
| 242 if (info->ShouldEnsureSpaceForLazyDeopt()) { | 242 if (info->ShouldEnsureSpaceForLazyDeopt()) { |
| 243 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result); | 243 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result); |
| 244 } | 244 } |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); | 596 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); |
| 597 | 597 |
| 598 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); | 598 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); |
| 599 | 599 |
| 600 RecordSafepoint( | 600 RecordSafepoint( |
| 601 instr->reference_map(), Safepoint::kSimple, 0, | 601 instr->reference_map(), Safepoint::kSimple, 0, |
| 602 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); | 602 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); |
| 603 | 603 |
| 604 if (flags & CallDescriptor::kHasExceptionHandler) { | 604 if (flags & CallDescriptor::kHasExceptionHandler) { |
| 605 InstructionOperandConverter i(this, instr); | 605 InstructionOperandConverter i(this, instr); |
| 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 } | |
| 612 RpoNumber handler_rpo = i.InputRpo(instr->InputCount() - 1); | 606 RpoNumber handler_rpo = i.InputRpo(instr->InputCount() - 1); |
| 613 handlers_.push_back( | 607 handlers_.push_back({GetLabel(handler_rpo), masm()->pc_offset()}); |
| 614 {prediction, GetLabel(handler_rpo), masm()->pc_offset()}); | |
| 615 } | 608 } |
| 616 | 609 |
| 617 if (needs_frame_state) { | 610 if (needs_frame_state) { |
| 618 MarkLazyDeoptSite(); | 611 MarkLazyDeoptSite(); |
| 619 // If the frame state is present, it starts at argument 1 (just after the | 612 // If the frame state is present, it starts at argument 1 (just after the |
| 620 // code address). | 613 // code address). |
| 621 size_t frame_state_offset = 1; | 614 size_t frame_state_offset = 1; |
| 622 FrameStateDescriptor* descriptor = | 615 FrameStateDescriptor* descriptor = |
| 623 GetDeoptimizationEntry(instr, frame_state_offset).descriptor(); | 616 GetDeoptimizationEntry(instr, frame_state_offset).descriptor(); |
| 624 int pc_offset = masm()->pc_offset(); | 617 int pc_offset = masm()->pc_offset(); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 919 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
| 927 gen->ools_ = this; | 920 gen->ools_ = this; |
| 928 } | 921 } |
| 929 | 922 |
| 930 | 923 |
| 931 OutOfLineCode::~OutOfLineCode() {} | 924 OutOfLineCode::~OutOfLineCode() {} |
| 932 | 925 |
| 933 } // namespace compiler | 926 } // namespace compiler |
| 934 } // namespace internal | 927 } // namespace internal |
| 935 } // namespace v8 | 928 } // namespace v8 |
| OLD | NEW |