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/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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Place function entry hook if requested to do so. | 38 // Place function entry hook if requested to do so. |
39 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { | 39 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { |
40 ProfileEntryHookStub::MaybeCallEntryHook(masm()); | 40 ProfileEntryHookStub::MaybeCallEntryHook(masm()); |
41 } | 41 } |
42 | 42 |
43 // Architecture-specific, linkage-specific prologue. | 43 // Architecture-specific, linkage-specific prologue. |
44 info->set_prologue_offset(masm()->pc_offset()); | 44 info->set_prologue_offset(masm()->pc_offset()); |
45 AssemblePrologue(); | 45 AssemblePrologue(); |
46 | 46 |
47 // Assemble all instructions. | 47 // Assemble all non-deferred instructions. |
48 for (InstructionSequence::const_iterator i = code()->begin(); | 48 for (auto const block : code()->instruction_blocks()) { |
49 i != code()->end(); ++i) { | 49 if (block->IsDeferred()) continue; |
50 AssembleInstruction(*i); | 50 for (int i = block->code_start(); i < block->code_end(); ++i) { |
| 51 AssembleInstruction(code()->InstructionAt(i)); |
| 52 } |
| 53 } |
| 54 |
| 55 // Assemble all deferred instructions. |
| 56 for (auto const block : code()->instruction_blocks()) { |
| 57 if (!block->IsDeferred()) continue; |
| 58 for (int i = block->code_start(); i < block->code_end(); ++i) { |
| 59 AssembleInstruction(code()->InstructionAt(i)); |
| 60 } |
51 } | 61 } |
52 | 62 |
53 FinishCode(masm()); | 63 FinishCode(masm()); |
54 | 64 |
55 // Ensure there is space for lazy deopt. | 65 // Ensure there is space for lazy deopt. |
56 if (!info->IsStub()) { | 66 if (!info->IsStub()) { |
57 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); | 67 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); |
58 while (masm()->pc_offset() < target_offset) { | 68 while (masm()->pc_offset() < target_offset) { |
59 masm()->nop(); | 69 masm()->nop(); |
60 } | 70 } |
(...skipping 15 matching lines...) Expand all Loading... |
76 PopulateDeoptimizationData(result); | 86 PopulateDeoptimizationData(result); |
77 | 87 |
78 // Emit a code line info recording stop event. | 88 // Emit a code line info recording stop event. |
79 void* line_info = recorder->DetachJITHandlerData(); | 89 void* line_info = recorder->DetachJITHandlerData(); |
80 LOG_CODE_EVENT(isolate(), CodeEndLinePosInfoRecordEvent(*result, line_info)); | 90 LOG_CODE_EVENT(isolate(), CodeEndLinePosInfoRecordEvent(*result, line_info)); |
81 | 91 |
82 return result; | 92 return result; |
83 } | 93 } |
84 | 94 |
85 | 95 |
| 96 bool CodeGenerator::IsNextInAssemblyOrder(BasicBlock::RpoNumber block) const { |
| 97 return code()->InstructionBlockAt(current_block_)->ao_number().IsNext( |
| 98 code()->InstructionBlockAt(block)->ao_number()); |
| 99 } |
| 100 |
| 101 |
86 void CodeGenerator::RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, | 102 void CodeGenerator::RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind, |
87 int arguments, | 103 int arguments, |
88 Safepoint::DeoptMode deopt_mode) { | 104 Safepoint::DeoptMode deopt_mode) { |
89 const ZoneList<InstructionOperand*>* operands = | 105 const ZoneList<InstructionOperand*>* operands = |
90 pointers->GetNormalizedOperands(); | 106 pointers->GetNormalizedOperands(); |
91 Safepoint safepoint = | 107 Safepoint safepoint = |
92 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); | 108 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); |
93 for (int i = 0; i < operands->length(); i++) { | 109 for (int i = 0; i < operands->length(); i++) { |
94 InstructionOperand* pointer = operands->at(i); | 110 InstructionOperand* pointer = operands->at(i); |
95 if (pointer->IsStackSlot()) { | 111 if (pointer->IsStackSlot()) { |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } | 524 } |
509 | 525 |
510 | 526 |
511 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } | 527 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } |
512 | 528 |
513 #endif // !V8_TURBOFAN_BACKEND | 529 #endif // !V8_TURBOFAN_BACKEND |
514 | 530 |
515 } // namespace compiler | 531 } // namespace compiler |
516 } // namespace internal | 532 } // namespace internal |
517 } // namespace v8 | 533 } // namespace v8 |
OLD | NEW |