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/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 // Architecture-specific, linkage-specific prologue. | 81 // Architecture-specific, linkage-specific prologue. |
82 info->set_prologue_offset(masm()->pc_offset()); | 82 info->set_prologue_offset(masm()->pc_offset()); |
83 AssemblePrologue(); | 83 AssemblePrologue(); |
84 if (linkage()->GetIncomingDescriptor()->InitializeRootRegister()) { | 84 if (linkage()->GetIncomingDescriptor()->InitializeRootRegister()) { |
85 masm()->InitializeRootRegister(); | 85 masm()->InitializeRootRegister(); |
86 } | 86 } |
87 | 87 |
88 // Define deoptimization literals for all inlined functions. | 88 // Define deoptimization literals for all inlined functions. |
89 DCHECK_EQ(0u, deoptimization_literals_.size()); | 89 DCHECK_EQ(0u, deoptimization_literals_.size()); |
90 for (auto& inlined : info->inlined_functions()) { | 90 for (const CompilationInfo::InlinedFunctionHolder& inlined : |
| 91 info->inlined_functions()) { |
91 if (!inlined.shared_info.is_identical_to(info->shared_info())) { | 92 if (!inlined.shared_info.is_identical_to(info->shared_info())) { |
92 DefineDeoptimizationLiteral(inlined.shared_info); | 93 DefineDeoptimizationLiteral(inlined.shared_info); |
93 } | 94 } |
94 } | 95 } |
95 inlined_function_count_ = deoptimization_literals_.size(); | 96 inlined_function_count_ = deoptimization_literals_.size(); |
96 | 97 |
97 // Define deoptimization literals for all unoptimized code objects of inlined | 98 // Define deoptimization literals for all unoptimized code objects of inlined |
98 // functions. This ensures unoptimized code is kept alive by optimized code. | 99 // functions. This ensures unoptimized code is kept alive by optimized code. |
99 for (auto& inlined : info->inlined_functions()) { | 100 for (const CompilationInfo::InlinedFunctionHolder& inlined : |
| 101 info->inlined_functions()) { |
100 if (!inlined.shared_info.is_identical_to(info->shared_info())) { | 102 if (!inlined.shared_info.is_identical_to(info->shared_info())) { |
101 DefineDeoptimizationLiteral(inlined.inlined_code_object_root); | 103 DefineDeoptimizationLiteral(inlined.inlined_code_object_root); |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 // Assemble all non-deferred blocks, followed by deferred ones. | 107 // Assemble all non-deferred blocks, followed by deferred ones. |
106 for (int deferred = 0; deferred < 2; ++deferred) { | 108 for (int deferred = 0; deferred < 2; ++deferred) { |
107 for (auto const block : code()->instruction_blocks()) { | 109 for (const InstructionBlock* block : code()->instruction_blocks()) { |
108 if (block->IsDeferred() == (deferred == 0)) { | 110 if (block->IsDeferred() == (deferred == 0)) { |
109 continue; | 111 continue; |
110 } | 112 } |
111 // Align loop headers on 16-byte boundaries. | 113 // Align loop headers on 16-byte boundaries. |
112 if (block->IsLoopHeader()) masm()->Align(16); | 114 if (block->IsLoopHeader()) masm()->Align(16); |
113 // Ensure lazy deopt doesn't patch handler entry points. | 115 // Ensure lazy deopt doesn't patch handler entry points. |
114 if (block->IsHandler()) EnsureSpaceForLazyDeopt(); | 116 if (block->IsHandler()) EnsureSpaceForLazyDeopt(); |
115 // Bind a label for a block. | 117 // Bind a label for a block. |
116 current_block_ = block->rpo_number(); | 118 current_block_ = block->rpo_number(); |
117 if (FLAG_code_comments) { | 119 if (FLAG_code_comments) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 233 } |
232 | 234 |
233 | 235 |
234 void CodeGenerator::RecordSafepoint(ReferenceMap* references, | 236 void CodeGenerator::RecordSafepoint(ReferenceMap* references, |
235 Safepoint::Kind kind, int arguments, | 237 Safepoint::Kind kind, int arguments, |
236 Safepoint::DeoptMode deopt_mode) { | 238 Safepoint::DeoptMode deopt_mode) { |
237 Safepoint safepoint = | 239 Safepoint safepoint = |
238 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); | 240 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); |
239 int stackSlotToSpillSlotDelta = | 241 int stackSlotToSpillSlotDelta = |
240 frame()->GetTotalFrameSlotCount() - frame()->GetSpillSlotCount(); | 242 frame()->GetTotalFrameSlotCount() - frame()->GetSpillSlotCount(); |
241 for (auto& operand : references->reference_operands()) { | 243 for (const InstructionOperand& operand : references->reference_operands()) { |
242 if (operand.IsStackSlot()) { | 244 if (operand.IsStackSlot()) { |
243 int index = LocationOperand::cast(operand).index(); | 245 int index = LocationOperand::cast(operand).index(); |
244 DCHECK(index >= 0); | 246 DCHECK(index >= 0); |
245 // We might index values in the fixed part of the frame (i.e. the | 247 // We might index values in the fixed part of the frame (i.e. the |
246 // closure pointer or the context pointer); these are not spill slots | 248 // closure pointer or the context pointer); these are not spill slots |
247 // and therefore don't work with the SafepointTable currently, but | 249 // and therefore don't work with the SafepointTable currently, but |
248 // we also don't need to worry about them, since the GC has special | 250 // we also don't need to worry about them, since the GC has special |
249 // knowledge about those fields anyway. | 251 // knowledge about those fields anyway. |
250 if (index < stackSlotToSpillSlotDelta) continue; | 252 if (index < stackSlotToSpillSlotDelta) continue; |
251 safepoint.DefinePointerSlot(index, zone()); | 253 safepoint.DefinePointerSlot(index, zone()); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 775 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
774 gen->ools_ = this; | 776 gen->ools_ = this; |
775 } | 777 } |
776 | 778 |
777 | 779 |
778 OutOfLineCode::~OutOfLineCode() {} | 780 OutOfLineCode::~OutOfLineCode() {} |
779 | 781 |
780 } // namespace compiler | 782 } // namespace compiler |
781 } // namespace internal | 783 } // namespace internal |
782 } // namespace v8 | 784 } // namespace v8 |
OLD | NEW |