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 #include "src/snapshot/serialize.h" // TODO(turbofan): RootIndexMap | 10 #include "src/snapshot/serialize.h" // TODO(turbofan): RootIndexMap |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 if (block->IsDeferred() == (deferred == 0)) { | 90 if (block->IsDeferred() == (deferred == 0)) { |
91 continue; | 91 continue; |
92 } | 92 } |
93 // Align loop headers on 16-byte boundaries. | 93 // Align loop headers on 16-byte boundaries. |
94 if (block->IsLoopHeader()) masm()->Align(16); | 94 if (block->IsLoopHeader()) masm()->Align(16); |
95 // Bind a label for a block. | 95 // Bind a label for a block. |
96 current_block_ = block->rpo_number(); | 96 current_block_ = block->rpo_number(); |
97 if (FLAG_code_comments) { | 97 if (FLAG_code_comments) { |
98 // TODO(titzer): these code comments are a giant memory leak. | 98 // TODO(titzer): these code comments are a giant memory leak. |
99 Vector<char> buffer = Vector<char>::New(200); | 99 Vector<char> buffer = Vector<char>::New(200); |
100 SNPrintF(buffer, "-- B%d start%s%s%s%s --", block->rpo_number().ToInt(), | 100 char* buffer_start = buffer.start(); |
101 block->IsDeferred() ? " (deferred)" : "", | 101 |
102 block->needs_frame() ? "" : " (no frame)", | 102 int next = SNPrintF( |
103 block->must_construct_frame() ? " (construct frame)" : "", | 103 buffer, "-- B%d start%s%s%s%s", block->rpo_number().ToInt(), |
104 block->must_deconstruct_frame() ? " (deconstruct frame)" : ""); | 104 block->IsDeferred() ? " (deferred)" : "", |
105 masm()->RecordComment(buffer.start()); | 105 block->needs_frame() ? "" : " (no frame)", |
| 106 block->must_construct_frame() ? " (construct frame)" : "", |
| 107 block->must_deconstruct_frame() ? " (deconstruct frame)" : ""); |
| 108 |
| 109 buffer = buffer.SubVector(next, buffer.length()); |
| 110 |
| 111 if (block->IsLoopHeader()) { |
| 112 next = |
| 113 SNPrintF(buffer, " (loop up to %d)", block->loop_end().ToInt()); |
| 114 buffer = buffer.SubVector(next, buffer.length()); |
| 115 } |
| 116 if (block->loop_header().IsValid()) { |
| 117 next = |
| 118 SNPrintF(buffer, " (in loop %d)", block->loop_header().ToInt()); |
| 119 buffer = buffer.SubVector(next, buffer.length()); |
| 120 } |
| 121 SNPrintF(buffer, " --"); |
| 122 masm()->RecordComment(buffer_start); |
106 } | 123 } |
107 masm()->bind(GetLabel(current_block_)); | 124 masm()->bind(GetLabel(current_block_)); |
108 for (int i = block->code_start(); i < block->code_end(); ++i) { | 125 for (int i = block->code_start(); i < block->code_end(); ++i) { |
109 AssembleInstruction(code()->InstructionAt(i)); | 126 AssembleInstruction(code()->InstructionAt(i)); |
110 } | 127 } |
111 } | 128 } |
112 } | 129 } |
113 | 130 |
114 // Assemble all out-of-line code. | 131 // Assemble all out-of-line code. |
115 if (ools_) { | 132 if (ools_) { |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 : masm_(gen->masm()), next_(gen->ools_) { | 705 : masm_(gen->masm()), next_(gen->ools_) { |
689 gen->ools_ = this; | 706 gen->ools_ = this; |
690 } | 707 } |
691 | 708 |
692 | 709 |
693 OutOfLineCode::~OutOfLineCode() {} | 710 OutOfLineCode::~OutOfLineCode() {} |
694 | 711 |
695 } // namespace compiler | 712 } // namespace compiler |
696 } // namespace internal | 713 } // namespace internal |
697 } // namespace v8 | 714 } // namespace v8 |
OLD | NEW |