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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 AssemblePrologue(); | 146 AssemblePrologue(); |
147 // We need to setup the root register after we assemble the prologue, to | 147 // We need to setup the root register after we assemble the prologue, to |
148 // avoid clobbering callee saved registers in case of C linkage and | 148 // avoid clobbering callee saved registers in case of C linkage and |
149 // using the roots. | 149 // using the roots. |
150 // TODO(mtrofin): investigate how we can avoid doing this repeatedly. | 150 // TODO(mtrofin): investigate how we can avoid doing this repeatedly. |
151 if (linkage()->GetIncomingDescriptor()->InitializeRootRegister()) { | 151 if (linkage()->GetIncomingDescriptor()->InitializeRootRegister()) { |
152 masm()->InitializeRootRegister(); | 152 masm()->InitializeRootRegister(); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 for (int i = block->code_start(); i < block->code_end(); ++i) { | 156 if (FLAG_enable_embedded_constant_pool && !block->needs_frame()) { |
157 Instruction* instr = code()->InstructionAt(i); | 157 ConstantPoolUnavailableScope constant_pool_unavailable(masm()); |
158 AssembleInstruction(instr, block); | 158 AssembleBlock(block); |
| 159 } else { |
| 160 AssembleBlock(block); |
159 } | 161 } |
160 } | 162 } |
161 } | 163 } |
162 | 164 |
163 // Assemble all out-of-line code. | 165 // Assemble all out-of-line code. |
164 if (ools_) { | 166 if (ools_) { |
165 masm()->RecordComment("-- Out of line code --"); | 167 masm()->RecordComment("-- Out of line code --"); |
166 for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) { | 168 for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) { |
167 masm()->bind(ool->entry()); | 169 masm()->bind(ool->entry()); |
168 ool->Generate(); | 170 ool->Generate(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 RootIndexMap map(isolate()); | 295 RootIndexMap map(isolate()); |
294 int root_index = map.Lookup(*object); | 296 int root_index = map.Lookup(*object); |
295 if (root_index != RootIndexMap::kInvalidRootIndex) { | 297 if (root_index != RootIndexMap::kInvalidRootIndex) { |
296 *index_return = static_cast<Heap::RootListIndex>(root_index); | 298 *index_return = static_cast<Heap::RootListIndex>(root_index); |
297 return true; | 299 return true; |
298 } | 300 } |
299 } | 301 } |
300 return false; | 302 return false; |
301 } | 303 } |
302 | 304 |
| 305 void CodeGenerator::AssembleBlock(const InstructionBlock* block) { |
| 306 for (int i = block->code_start(); i < block->code_end(); ++i) { |
| 307 Instruction* instr = code()->InstructionAt(i); |
| 308 AssembleInstruction(instr, block); |
| 309 } |
| 310 } |
| 311 |
303 void CodeGenerator::AssembleInstruction(Instruction* instr, | 312 void CodeGenerator::AssembleInstruction(Instruction* instr, |
304 const InstructionBlock* block) { | 313 const InstructionBlock* block) { |
305 AssembleGaps(instr); | 314 AssembleGaps(instr); |
306 if (instr->IsJump() && block->must_deconstruct_frame()) { | 315 if (instr->IsJump() && block->must_deconstruct_frame()) { |
307 AssembleDeconstructFrame(); | 316 AssembleDeconstructFrame(); |
308 } | 317 } |
309 AssembleSourcePosition(instr); | 318 AssembleSourcePosition(instr); |
310 // Assemble architecture-specific code for the instruction. | 319 // Assemble architecture-specific code for the instruction. |
311 AssembleArchInstruction(instr); | 320 AssembleArchInstruction(instr); |
312 | 321 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 798 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
790 gen->ools_ = this; | 799 gen->ools_ = this; |
791 } | 800 } |
792 | 801 |
793 | 802 |
794 OutOfLineCode::~OutOfLineCode() {} | 803 OutOfLineCode::~OutOfLineCode() {} |
795 | 804 |
796 } // namespace compiler | 805 } // namespace compiler |
797 } // namespace internal | 806 } // namespace internal |
798 } // namespace v8 | 807 } // namespace v8 |
OLD | NEW |